Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/v1.1.1 #11

Merged
merged 36 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a72d93c
start v1.1.0
IgorKilipenko May 14, 2024
9907790
clean includes
IgorKilipenko May 14, 2024
ecf8d5e
satrt dev
IgorKilipenko May 14, 2024
6a24a39
no fix
IgorKilipenko May 14, 2024
c88cccc
fix script
IgorKilipenko May 14, 2024
06b9b3e
clean
IgorKilipenko May 14, 2024
53cdbfc
rm antlr src
IgorKilipenko May 14, 2024
0895e1a
update antlr versin to 4.13.1
IgorKilipenko May 14, 2024
f3b528a
no fix
IgorKilipenko May 14, 2024
359f8f4
mig to add antlr as ExternalProject
IgorKilipenko May 14, 2024
e9f30c7
refactoring
IgorKilipenko May 14, 2024
3c32431
add clang ext
IgorKilipenko May 14, 2024
079cf32
mv Formula.g4 & add antlr invlude for libspreadsheet
IgorKilipenko May 14, 2024
9ffcf00
rm URL_HASH
IgorKilipenko May 14, 2024
68af143
no fix
IgorKilipenko May 14, 2024
31baee9
update cmake
IgorKilipenko May 14, 2024
688f73e
start mig to FetchContent_Declare
IgorKilipenko May 14, 2024
3d632f5
fix antlr build
IgorKilipenko May 14, 2024
5950111
rm ExternalProject
IgorKilipenko May 14, 2024
bd77858
split cmake
IgorKilipenko May 14, 2024
b9b378e
mv grammar file
IgorKilipenko May 14, 2024
1bb3594
add project config
IgorKilipenko May 14, 2024
e8ffd7c
Merge pull request #4 from IgorKilipenko/dev/devcontainer
IgorKilipenko May 14, 2024
5c511a7
Dev/devcontainer (#5)
IgorKilipenko May 14, 2024
0a1f47d
add build tasks
IgorKilipenko May 15, 2024
11c0a34
config cland
IgorKilipenko May 15, 2024
54339f7
add build & run
IgorKilipenko May 15, 2024
8dc05bb
rm src dir
IgorKilipenko May 15, 2024
7ff7aff
add ext cmake tools
IgorKilipenko May 15, 2024
002a2a6
Merge pull request #7 from IgorKilipenko:bev/build
IgorKilipenko May 15, 2024
a0f52a2
add docs
IgorKilipenko May 15, 2024
7091b18
fix config clangd
IgorKilipenko May 15, 2024
9ae1394
split targets & refactoring cmake files (#8)
IgorKilipenko May 16, 2024
4e563a0
add readme
IgorKilipenko May 16, 2024
42b37dc
Merge branch 'main' into dev/4e563a0
IgorKilipenko May 16, 2024
ba8834f
Merge branch 'main' into dev/42b37dc
IgorKilipenko May 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CompileFlags:
CompilationDatabase: "build"

Diagnostics:
ClangTidy:
Add: modernize*
Remove: modernize-use-trailing-return-type
UnusedIncludes: Strict
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
trim_trailing_whitespace = true
insert_final_newline = true
17 changes: 0 additions & 17 deletions .vscode/c_cpp_properties.json

This file was deleted.

5 changes: 3 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"llvm-vs-code-extensions.vscode-clangd",
"streetsidesoftware.code-spell-checker",
"donjayamanne.githistory",
"jeff-hykin.better-cpp-syntax"
"jeff-hykin.better-cpp-syntax",
"ms-vscode.cmake-tools"
]
}
}
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@
"ignoreFailures": true
}
]
},
{
"name": "Debug App",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/build/spreadsheet",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"externalConsole": false,
"MIMode": "gdb",
"preLaunchTask": "cmake: build",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
81 changes: 81 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "cmake: configure",
"type": "shell",
"command": "cmake",
"args": [
"-S", "${workspaceFolder}",
"-B", "${workspaceFolder}/build",
"-DCMAKE_BUILD_TYPE=${input:buildType}"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$gcc"],
"detail": "Generated task to configure CMake project"
},
{
"label": "cmake: build",
"type": "shell",
"command": "cmake",
"args": [
"--build", "${workspaceFolder}/build",
"--config", "${input:buildType}",
"--target", "all",
"--",
"-j8"
],
"dependsOn": "cmake: configure",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$gcc"],
"detail": "Generated task to build CMake project"
},
{
"label": "cleanup",
"type": "shell",
"command": "rm",
"args": [
"-rf",
"${workspaceFolder}/build/*"
],
"group": "none"
},
{
"label": "install libspreadsheet",
"type": "shell",
"command": "cmake",
"args": [
"--build", "${workspaceFolder}/build",
"--config", "${input:buildType}",
"--target", "install"
],
"dependsOn": "cmake: build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$gcc"],
"detail": "Install libspreadsheet"
}
],
"inputs": [
{
"id": "buildType",
"type": "pickString",
"description": "Select the build type",
"options": [
"Debug",
"Release",
"MinSizeRel",
"RelWithDebInfo"
],
"default": "Debug"
}
]
}
50 changes: 43 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,47 @@
cmake_minimum_required(VERSION 3.24)
set(CMAKE_VERBOSE_MAKEFILE ON)
project(spreadsheet
VERSION 1.1.0
DESCRIPTION "spreadsheet"
HOMEPAGE_URL "https://github.com/IgorKilipenko/cpp-spreadsheet"
LANGUAGES CXX
)

project(cpp-spreadsheet-app VERSION 1.1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Set C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-implicit-fallthrough")

# Add subdirectory with the library
add_subdirectory(spreadsheet)
# Source directiory
set(PROJECT_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")

# Public include directiory
set(PROJECT_PUBLIC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")

# Installation directiory
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/bin")

# Add threads library for all lib targets
find_package(Threads REQUIRED)
link_libraries(Threads::Threads)

# Find Java
find_package(Java REQUIRED)

# Include the ANTLR setup
include(cmake/install_antlr.cmake)

# Include the source files and create targets
include(cmake/install.cmake)

if(CMAKE_PROJECT_NAME STREQUAL "spreadsheet") # if spreadsheet is top-level project
# add include path
include_directories(include)
include_directories(src/include)
include_directories(src)

include(cmake/utils.cmake)
include(cmake/develop.cmake)
endif()

set_directory_properties(PROPERTIES VS_STARTUP_PROJECT spreadsheet)
83 changes: 80 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,80 @@
# Cpp-Spreadsheet

## Дипломный проект: Электронная таблица
# Cpp-Spreadsheet (Электронная таблица)

## Содержание

- [Описание проекта](#project-description)
- [Функциональность](#main-features)
- [Пример использования](#use-examples)
- [Технологии](#project-technology)
- [Установка](#project-installation)

## Описание проекта {#project-description}

Этот проект представляет собой упрощённый аналог электронных таблиц. В ячейках таблицы могут содержаться как текст, так и формулы, включающие индексы (ссылки) других ячеек.

## Функциональность {#main-features}

- Поддержка чисел и строк в ячейках
- Возможность использования формул с числами, строками и ссылками на другие ячейки
- Автоматическое обновление значений ячеек при изменении зависимых ячеек
- Обработка циклических зависимостей и ошибок в формулах

## Пример использования {#use-examples}

```cpp
#include "spreadsheet.h"
#include <iostream>

int main() {
// Создаем новую таблицу
auto sheet = CreateSheet();

// Задаем значения ячеек
sheet->SetCell("A1"_pos, "Hello, world!");
sheet->SetCell("B1"_pos, "=2+2");

// Получаем значения ячеек и выводим на экран
std::cout << "A1: " << sheet->GetCell("A1"_pos)->GetValue() << std::endl;
std::cout << "B1: " << sheet->GetCell("B1"_pos)->GetValue() << std::endl;

// Очищаем ячейку
sheet->ClearCell("B1"_pos);

// Получаем значение очищенной ячейки (должно быть пусто)
std::cout << "B1 after clearing: " << sheet->GetCell("B1"_pos)->GetValue() << std::endl;

return 0;
}
```

## Технологии {#project-technology}

- Стандарт языка: C++17
- Парсинг формул: [ANTLR4](https://www.antlr.org/)
- Основная логика приложения: библиотека `libspreadsheet`
- Пример использования: консольное приложение `spreadsheet`

## Установка {#project-installation}

<details>

<summary>Для установки проекта выполните следующие шаги:</summary>

```bash
# Клонировать репозиторий
git clone https://github.com/IgorKilipenko/cpp-spreadsheet.git

# Перейти в каталог проекта
cd cpp-spreadsheet

# Собрать проект с помощью CMake
mkdir build
cd build
cmake ..
make

# Установить
make install
```

</details>
36 changes: 36 additions & 0 deletions cmake/develop.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
message(STATUS "-------------DEVELOP SETTING------------")

# Enable address sanitizer
option(ENABLE_SANITIZER "Enable sanitizer(Debug+Gcc/Clang/AppleClang)" ON)

if(ENABLE_SANITIZER AND NOT MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
check_asan(HAS_ASAN)
if(HAS_ASAN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
else()
message(WARNING "sanitizer is no supported with current tool-chains")
endif()
endif()
endif()

# warning
option(ENABLE_WARNING "Enable warning for all project " OFF)
if(ENABLE_WARNING)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
list(APPEND MSVC_OPTIONS "/W3")
if(MSVC_VERSION GREATER 1900) # Allow non fatal security warnings for msvc 2015
list(APPEND MSVC_OPTIONS "/WX")
endif()
add_compile_options(MSVC_OPTIONS)
else()
add_compile_options(-Wall
-Wextra
-Wconversion
-pedantic
-Werror
-Wfatal-errors)
endif()
endif()

message(STATUS "--------------------------------------------")
Loading