remove md files
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -6,3 +6,5 @@ CMakeLists.txt.user*
|
|||||||
/include
|
/include
|
||||||
/release
|
/release
|
||||||
/build*
|
/build*
|
||||||
|
/AGENTS.md
|
||||||
|
/plans
|
||||||
|
|||||||
166
AGENTS.md
166
AGENTS.md
@@ -1,166 +0,0 @@
|
|||||||
# AGENTS.md - Agent Guidelines for PIP
|
|
||||||
|
|
||||||
This file provides guidance for agentic coding agents working on the PIP (Platform Independent Primitives) codebase.
|
|
||||||
|
|
||||||
## Project Overview
|
|
||||||
|
|
||||||
PIP is a C++ cross-platform library providing platform-independent abstractions for:
|
|
||||||
- Core/Types: Strings, variants, containers, datetime, networks
|
|
||||||
- Threading: Mutexes, semaphores, thread pools, timers
|
|
||||||
- I/O: Files, serial, CAN, GPIO, SPI, Ethernet
|
|
||||||
- Math: Vectors, matrices, FFT, quaternions
|
|
||||||
- Crypto: MD5, SHA, BLAKE2, SipHash
|
|
||||||
- Compression: zlib support
|
|
||||||
- HTTP: Client and server support
|
|
||||||
- Serialization: JSON, binary, XML
|
|
||||||
|
|
||||||
## Build Commands
|
|
||||||
|
|
||||||
### Basic Build
|
|
||||||
```bash
|
|
||||||
cmake -B build
|
|
||||||
cmake --build build -j8
|
|
||||||
```
|
|
||||||
|
|
||||||
### Build with Tests
|
|
||||||
```bash
|
|
||||||
cmake -B build -DTESTS=ON
|
|
||||||
cmake --build build -j8
|
|
||||||
```
|
|
||||||
|
|
||||||
### Run Tests
|
|
||||||
```bash
|
|
||||||
ctest --test-dir build/tests # Run all tests
|
|
||||||
ctest --test-dir build/tests -R <regex> # Run specific tests matching regex
|
|
||||||
ctest --test-dir build/tests -V # Verbose output
|
|
||||||
```
|
|
||||||
|
|
||||||
To run a single test:
|
|
||||||
```bash
|
|
||||||
# Build the test executable, then run directly:
|
|
||||||
./build/tests/pip_<test_name>_test
|
|
||||||
# Or use ctest with specific test name
|
|
||||||
ctest --test-dir build/tests -R "TestName"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Other Commands
|
|
||||||
```bash
|
|
||||||
cmake --build build --target clean # Clean build
|
|
||||||
cmake --install build_pip # Install
|
|
||||||
cmake --build build --target doc # Build documentation
|
|
||||||
```
|
|
||||||
|
|
||||||
### Build Options
|
|
||||||
```bash
|
|
||||||
-DTESTS=ON # Build tests
|
|
||||||
-DCOVERAGE=ON # Build with coverage
|
|
||||||
-DICU=ON # ICU support for codepage conversion
|
|
||||||
-DSTD_IOSTREAM=ON # std::iostream operators support
|
|
||||||
-DINTROSPECTION=ON # Build with introspection
|
|
||||||
-DPIP_BUILD_CRYPT=ON # Crypt module (requires libsodium)
|
|
||||||
-DPIP_BUILD_FFTW=ON # FFT support
|
|
||||||
```
|
|
||||||
|
|
||||||
## Code Style Guidelines
|
|
||||||
|
|
||||||
### File Organization
|
|
||||||
- Header files: `libs/main/**/*.h`
|
|
||||||
- Source files: `libs/main/**/*.cpp`
|
|
||||||
- Private headers: `*_p.h`
|
|
||||||
- Tests: `tests/<module>/`
|
|
||||||
- Use Doxygen comments (`/*! ... */`) for documentation with `\brief`, `\param`, `\return`
|
|
||||||
|
|
||||||
### Naming Conventions
|
|
||||||
- **Classes**: PascalCase with `PI` prefix (e.g., `PIString`, `PIByteArray`, `PIVariant`)
|
|
||||||
- **Functions**: camelCase (e.g., `toAscii()`, `isEmpty()`, `append()`)
|
|
||||||
- **Member variables**: snake_case, or just lowercase (e.g., `array_size`, `count`)
|
|
||||||
- **Constants**: PascalCase or UPPER_SNAKE_CASE
|
|
||||||
- **Enums**: PascalCase for enum names and values
|
|
||||||
|
|
||||||
### Code Formatting
|
|
||||||
- **Indentation**: Use tabs (4 spaces equivalent) or spaces - match existing code
|
|
||||||
- **Braces**: Opening brace on same line for functions, new line for namespaces/classes
|
|
||||||
- **Includes**: System includes first, then project headers
|
|
||||||
- **Use forward declarations** where possible to reduce compile times
|
|
||||||
- **Use `nullptr`** instead of `NULL`
|
|
||||||
|
|
||||||
### C++ Standards
|
|
||||||
- C++11 standard (enforced in CMakeLists.txt)
|
|
||||||
- Use `override` keyword for virtual function overrides
|
|
||||||
- Use `explicit` for single-argument constructors
|
|
||||||
- Use `const` member functions where applicable
|
|
||||||
- Use range-based `for` loops when possible
|
|
||||||
|
|
||||||
### Error Handling
|
|
||||||
- Return error codes
|
|
||||||
- DO NOT USE exceptions
|
|
||||||
- Use `piCerr` and `piCout` for error messages
|
|
||||||
- Check for null pointers where appropriate
|
|
||||||
|
|
||||||
### Module Structure
|
|
||||||
|
|
||||||
Each module typically has:
|
|
||||||
1. Public header: `pip_<module>.h` or `<classname>.h`
|
|
||||||
2. Private implementation: `<classname>.cpp` or `<classname>_p.cpp`
|
|
||||||
3. Use `PIP_EXPORT` macro for symbols that need to be exported from the library
|
|
||||||
|
|
||||||
Example class structure:
|
|
||||||
```cpp
|
|
||||||
// header.h
|
|
||||||
#ifndef MODULE_CLASSNAME_H
|
|
||||||
#define MODULE_CLASSNAME_H
|
|
||||||
|
|
||||||
#include "pip_export.h"
|
|
||||||
|
|
||||||
class PIP_EXPORT ClassName {
|
|
||||||
public:
|
|
||||||
ClassName();
|
|
||||||
~ClassName();
|
|
||||||
|
|
||||||
void doSomething();
|
|
||||||
bool isValid() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void privateMethod();
|
|
||||||
int data;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // MODULE_CLASSNAME_H
|
|
||||||
|
|
||||||
// source.cpp
|
|
||||||
#include "header.h"
|
|
||||||
#include "piincludes_p.h"
|
|
||||||
|
|
||||||
ClassName::ClassName() : data(0) {}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Testing
|
|
||||||
- Use Google Test framework
|
|
||||||
- Test files go in `tests/<module>/`
|
|
||||||
- Use `TEST(TestSuite, TestName)` or `TEST_F(TestFixture, TestName)` for test cases
|
|
||||||
- Use `ASSERT_*` for fatal failures, `EXPECT_*` for non-fatal
|
|
||||||
- Test naming: `<ClassName>_<TestDescription>`
|
|
||||||
|
|
||||||
Example:
|
|
||||||
```cpp
|
|
||||||
#include "pistring.h"
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
|
|
||||||
TEST(PIString_Tests, constructor_empty) {
|
|
||||||
PIString str;
|
|
||||||
ASSERT_TRUE(str.isEmpty());
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Module Dependencies
|
|
||||||
- Main library: `libs/main/`
|
|
||||||
- Third-party: `3rd/`
|
|
||||||
- Utils: `utils/`
|
|
||||||
|
|
||||||
### Key Files
|
|
||||||
- `CMakeLists.txt` - Main build configuration
|
|
||||||
- `tests/CMakeLists.txt` - Test configuration
|
|
||||||
|
|
||||||
|
|
||||||
## Lint/Format Commands
|
|
||||||
- For formatting, use clang-format with .clang-format in repo root
|
|
||||||
115
README.md
115
README.md
@@ -40,3 +40,118 @@ You should add ${<out_var>} to your target.
|
|||||||
[🇷🇺 Онлайн документация](https://shstk.ru/pip/html/ru/index.html)
|
[🇷🇺 Онлайн документация](https://shstk.ru/pip/html/ru/index.html)
|
||||||
|
|
||||||
[🇷🇺 Qt-help](https://shstk.ru/pip/pip_ru.qch)
|
[🇷🇺 Qt-help](https://shstk.ru/pip/pip_ru.qch)
|
||||||
|
|
||||||
|
## Основные опции сборки
|
||||||
|
|
||||||
|
### Стандартные опции (option())
|
||||||
|
| Опция | Описание | По умолчанию |
|
||||||
|
|-------|----------|--------------|
|
||||||
|
| `ICU` | ICU support для конвертации кодовых страниц | ON (кроме Win/Android/Apple) |
|
||||||
|
| `STD_IOSTREAM` | Поддержка std::iostream операторов | OFF |
|
||||||
|
| `INTROSPECTION` | Сборка с интроспекцией | OFF |
|
||||||
|
| `TESTS` | Сборка тестов | OFF |
|
||||||
|
| `COVERAGE` | Сборка с информацией о покрытии | OFF |
|
||||||
|
| `PIP_FFTW_F` | Поддержка FFTW для float | ON |
|
||||||
|
| `PIP_FFTW_L` | Поддержка FFTW для long double | ON |
|
||||||
|
| `PIP_FFTW_Q` | Поддержка FFTW для quad double | OFF |
|
||||||
|
|
||||||
|
### Опции модулей (PIP_BUILD_*)
|
||||||
|
| Опция | Модуль |
|
||||||
|
|-------|--------|
|
||||||
|
| `PIP_BUILD_CONSOLE` | console |
|
||||||
|
| `PIP_BUILD_CRYPT` | crypt (требует libsodium) |
|
||||||
|
| `PIP_BUILD_COMPRESS` | compress (требует zlib) |
|
||||||
|
| `PIP_BUILD_USB` | usb |
|
||||||
|
| `PIP_BUILD_FFTW` | fftw |
|
||||||
|
| `PIP_BUILD_OPENCL` | opencl |
|
||||||
|
| `PIP_BUILD_IO_UTILS` | io_utils |
|
||||||
|
| `PIP_BUILD_CLIENT_SERVER` | client_server |
|
||||||
|
| `PIP_BUILD_CLOUD` | cloud |
|
||||||
|
| `PIP_BUILD_LUA` | lua |
|
||||||
|
| `PIP_BUILD_HTTP_CLIENT` | http_client (требует libcurl) |
|
||||||
|
| `PIP_BUILD_HTTP_SERVER` | http_server (требует libmicrohttpd) |
|
||||||
|
|
||||||
|
### Дополнительные переменные
|
||||||
|
| Переменная | Описание |
|
||||||
|
|------------|----------|
|
||||||
|
| `PIP_BUILD_DEBUG` | Сборка debug версии |
|
||||||
|
| `PIP_FREERTOS` | Режим сборки для FreeRTOS |
|
||||||
|
| `CROSSTOOLS` | Собрать инструменты кросс-сборки под хостовую систему (pip_cmg, pip_rc, ...) |
|
||||||
|
| `LOCAL` | Локальная установка (bin/lib/include) |
|
||||||
|
| `PIP_CONTAINERS_MIN_ALLOC` | Переопределить минимальный размер аллокации контейнеров |
|
||||||
|
| `PIP_CONTAINERS_MAX_POT_ALLOC` | Переопределить максимальный размер дополнительной аллокации (поддерживает X_KiB, X_MiB) |
|
||||||
|
|
||||||
|
### Примеры использования
|
||||||
|
```bash
|
||||||
|
# Базовая сборка с тестами
|
||||||
|
cmake -B build -DTESTS=ON
|
||||||
|
|
||||||
|
# Сборка с покрытием и ICU
|
||||||
|
cmake -B build -DTESTS=ON -DCOVERAGE=ON -DICU=ON
|
||||||
|
|
||||||
|
# Отключение отдельных модулей
|
||||||
|
cmake -B build -DPIP_BUILD_CRYPT=OFF -DPIP_BUILD_OPENCL=OFF
|
||||||
|
|
||||||
|
# Переопределение параметров контейнеров
|
||||||
|
cmake -B build -DPIP_CONTAINERS_MIN_ALLOC=64
|
||||||
|
|
||||||
|
# Локальная установка
|
||||||
|
cmake -B build -DLOCAL=ON
|
||||||
|
```
|
||||||
|
|
||||||
|
## PIP Dependencies
|
||||||
|
|
||||||
|
### Встроенные (included in 3rd/)
|
||||||
|
|
||||||
|
| Библиотека | Назначение | Модуль PIP |
|
||||||
|
|------------|------------|------------|
|
||||||
|
| **PCRE2** | Регулярные выражения | main (internal) |
|
||||||
|
| **BLAKE2** | Хеширование | main (internal) |
|
||||||
|
| **SipHash** | Хеширование | main (internal) |
|
||||||
|
| **Lua** | Lua scripting | lua |
|
||||||
|
| **LuaBridge** | Lua bindings | lua |
|
||||||
|
|
||||||
|
### Внешние (системные)
|
||||||
|
|
||||||
|
| Библиотека | Опция | Модуль PIP |
|
||||||
|
|------------|-------|------------|
|
||||||
|
| **ICU** | `-DICU=ON` | main (string conversion) |
|
||||||
|
| **zlib** | `PIP_BUILD_COMPRESS` | compress |
|
||||||
|
| **libsodium** | `PIP_BUILD_CRYPT` | crypt, io_utils, cloud |
|
||||||
|
| **libusb** | `PIP_BUILD_USB` | usb |
|
||||||
|
| **FFTW3** (+ threads) | `PIP_BUILD_FFTW` | fftw |
|
||||||
|
| **OpenCL** | `PIP_BUILD_OPENCL` | opencl |
|
||||||
|
| **libmicrohttpd** | `PIP_BUILD_HTTP_SERVER` | http_server |
|
||||||
|
| **libcurl** | `PIP_BUILD_HTTP_CLIENT` | http_client |
|
||||||
|
|
||||||
|
### Опциональные (тесты/документация)
|
||||||
|
|
||||||
|
| Инструмент | Назначение |
|
||||||
|
|------------|------------|
|
||||||
|
| **Google Test** | Тестирование (fetched automatically) |
|
||||||
|
| **Doxygen** | Генерация документации |
|
||||||
|
|
||||||
|
|
||||||
|
### Схема зависимостей модулей
|
||||||
|
|
||||||
|
```
|
||||||
|
main (core)
|
||||||
|
├── PCRE2 (встроен)
|
||||||
|
├── BLAKE2 (встроен)
|
||||||
|
├── SipHash (встроен)
|
||||||
|
└── ICU (опционально)
|
||||||
|
|
||||||
|
console → main
|
||||||
|
compress → zlib
|
||||||
|
crypt → libsodium
|
||||||
|
usb → libusb
|
||||||
|
fftw → FFTW3
|
||||||
|
opencl → OpenCL
|
||||||
|
io_utils → [crypt, если доступен]
|
||||||
|
client_server → io_utils
|
||||||
|
cloud → io_utils, crypt
|
||||||
|
lua → Lua (встроен), LuaBridge (встроен)
|
||||||
|
http_server → libmicrohttpd
|
||||||
|
http_client → libcurl
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
# PIP Dependencies
|
|
||||||
|
|
||||||
## Встроенные (included in 3rd/)
|
|
||||||
|
|
||||||
| Библиотека | Назначение | Модуль PIP |
|
|
||||||
|------------|------------|------------|
|
|
||||||
| **PCRE2** | Регулярные выражения | main (internal) |
|
|
||||||
| **BLAKE2** | Хеширование | main (internal) |
|
|
||||||
| **SipHash** | Хеширование | main (internal) |
|
|
||||||
| **Lua** | Lua scripting | lua |
|
|
||||||
| **LuaBridge** | Lua bindings | lua |
|
|
||||||
|
|
||||||
## Внешние (системные)
|
|
||||||
|
|
||||||
| Библиотека | Опция | Модуль PIP |
|
|
||||||
|------------|-------|------------|
|
|
||||||
| **ICU** | `-DICU=ON` | main (string conversion) |
|
|
||||||
| **zlib** | `PIP_BUILD_COMPRESS` | compress |
|
|
||||||
| **libsodium** | `PIP_BUILD_CRYPT` | crypt, io_utils, cloud |
|
|
||||||
| **libusb** | `PIP_BUILD_USB` | usb |
|
|
||||||
| **FFTW3** (+ threads) | `PIP_BUILD_FFTW` | fftw |
|
|
||||||
| **OpenCL** | `PIP_BUILD_OPENCL` | opencl |
|
|
||||||
| **libmicrohttpd** | `PIP_BUILD_HTTP_SERVER` | http_server |
|
|
||||||
| **libcurl** | `PIP_BUILD_HTTP_CLIENT` | http_client |
|
|
||||||
|
|
||||||
## Опциональные (тесты/документация)
|
|
||||||
|
|
||||||
| Инструмент | Назначение |
|
|
||||||
|------------|------------|
|
|
||||||
| **Google Test** | Тестирование (fetched automatically) |
|
|
||||||
| **Doxygen** | Генерация документации |
|
|
||||||
|
|
||||||
|
|
||||||
## Схема зависимостей модулей
|
|
||||||
|
|
||||||
```
|
|
||||||
main (core)
|
|
||||||
├── PCRE2 (встроен)
|
|
||||||
├── BLAKE2 (встроен)
|
|
||||||
├── SipHash (встроен)
|
|
||||||
└── ICU (опционально)
|
|
||||||
|
|
||||||
console → main
|
|
||||||
compress → zlib
|
|
||||||
crypt → libsodium
|
|
||||||
usb → libusb
|
|
||||||
fftw → FFTW3
|
|
||||||
opencl → OpenCL
|
|
||||||
io_utils → [crypt, если доступен]
|
|
||||||
client_server → io_utils
|
|
||||||
cloud → io_utils, crypt
|
|
||||||
lua → Lua (встроен), LuaBridge (встроен)
|
|
||||||
http_server → libmicrohttpd
|
|
||||||
http_client → libcurl
|
|
||||||
```
|
|
||||||
59
options.md
59
options.md
@@ -1,59 +0,0 @@
|
|||||||
# PIP Build Options
|
|
||||||
|
|
||||||
## Основные опции сборки
|
|
||||||
|
|
||||||
### Стандартные опции (option())
|
|
||||||
| Опция | Описание | По умолчанию |
|
|
||||||
|-------|----------|--------------|
|
|
||||||
| `ICU` | ICU support для конвертации кодовых страниц | ON (кроме Win/Android/Apple) |
|
|
||||||
| `STD_IOSTREAM` | Поддержка std::iostream операторов | OFF |
|
|
||||||
| `INTROSPECTION` | Сборка с интроспекцией | OFF |
|
|
||||||
| `TESTS` | Сборка тестов | OFF |
|
|
||||||
| `COVERAGE` | Сборка с информацией о покрытии | OFF |
|
|
||||||
| `PIP_FFTW_F` | Поддержка FFTW для float | ON |
|
|
||||||
| `PIP_FFTW_L` | Поддержка FFTW для long double | ON |
|
|
||||||
| `PIP_FFTW_Q` | Поддержка FFTW для quad double | OFF |
|
|
||||||
|
|
||||||
### Опции модулей (PIP_BUILD_*)
|
|
||||||
| Опция | Модуль |
|
|
||||||
|-------|--------|
|
|
||||||
| `PIP_BUILD_CONSOLE` | console |
|
|
||||||
| `PIP_BUILD_CRYPT` | crypt (требует libsodium) |
|
|
||||||
| `PIP_BUILD_COMPRESS` | compress (требует zlib) |
|
|
||||||
| `PIP_BUILD_USB` | usb |
|
|
||||||
| `PIP_BUILD_FFTW` | fftw |
|
|
||||||
| `PIP_BUILD_OPENCL` | opencl |
|
|
||||||
| `PIP_BUILD_IO_UTILS` | io_utils |
|
|
||||||
| `PIP_BUILD_CLIENT_SERVER` | client_server |
|
|
||||||
| `PIP_BUILD_CLOUD` | cloud |
|
|
||||||
| `PIP_BUILD_LUA` | lua |
|
|
||||||
| `PIP_BUILD_HTTP_CLIENT` | http_client (требует libcurl) |
|
|
||||||
| `PIP_BUILD_HTTP_SERVER` | http_server (требует libmicrohttpd) |
|
|
||||||
|
|
||||||
### Дополнительные переменные
|
|
||||||
| Переменная | Описание |
|
|
||||||
|------------|----------|
|
|
||||||
| `PIP_BUILD_DEBUG` | Сборка debug версии |
|
|
||||||
| `PIP_FREERTOS` | Режим сборки для FreeRTOS |
|
|
||||||
| `CROSSTOOLS` | Собрать инструменты кросс-сборки под хостовую систему (pip_cmg, pip_rc, ...) |
|
|
||||||
| `LOCAL` | Локальная установка (bin/lib/include) |
|
|
||||||
| `PIP_CONTAINERS_MIN_ALLOC` | Переопределить минимальный размер аллокации контейнеров |
|
|
||||||
| `PIP_CONTAINERS_MAX_POT_ALLOC` | Переопределить максимальный размер дополнительной аллокации (поддерживает X_KiB, X_MiB) |
|
|
||||||
|
|
||||||
### Примеры использования
|
|
||||||
```bash
|
|
||||||
# Базовая сборка с тестами
|
|
||||||
cmake -B build -DTESTS=ON
|
|
||||||
|
|
||||||
# Сборка с покрытием и ICU
|
|
||||||
cmake -B build -DTESTS=ON -DCOVERAGE=ON -DICU=ON
|
|
||||||
|
|
||||||
# Отключение отдельных модулей
|
|
||||||
cmake -B build -DPIP_BUILD_CRYPT=OFF -DPIP_BUILD_OPENCL=OFF
|
|
||||||
|
|
||||||
# Переопределение параметров контейнеров
|
|
||||||
cmake -B build -DPIP_CONTAINERS_MIN_ALLOC=64
|
|
||||||
|
|
||||||
# Локальная установка
|
|
||||||
cmake -B build -DLOCAL=ON
|
|
||||||
```
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
# План: Добавление документации Doxygen в заголовочные файлы PIP
|
|
||||||
|
|
||||||
## Обзор
|
|
||||||
|
|
||||||
Необходимо добавить базовую документацию Doxygen (`\brief`) во все публичные заголовочные файлы проекта. Каждый файл должен содержать:
|
|
||||||
- Документацию в начале файла (`\file`, `\brief`, группа)
|
|
||||||
- Документацию для каждого класса (`\class`, `\brief`)
|
|
||||||
- Документацию для всех публичных методов (`\brief`)
|
|
||||||
|
|
||||||
## Стиль документации
|
|
||||||
|
|
||||||
Используется два стиля комментариев (оба поддерживаются):
|
|
||||||
1. `//!` - однострочные комментарии (предпочтительно)
|
|
||||||
2. `/*! ... */` - многострочные блоки
|
|
||||||
|
|
||||||
## Пример оформления (на основе pipair.h)
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
//! \addtogroup Containers
|
|
||||||
//! \{
|
|
||||||
//! \file pipair.h
|
|
||||||
//! \brief
|
|
||||||
//! \~english Declares \a PIPair
|
|
||||||
//! \~russian Объявление \a PIPair
|
|
||||||
//! \~\authors
|
|
||||||
//! \~english Ivan Pelipenko peri4ko@yandex.ru; Andrey Bychkov work.a.b@yandex.ru
|
|
||||||
//! \~russian Иван Пелипенко peri4ko@yandex.ru; Андрей Бычков work.a.b@yandex.ru
|
|
||||||
//! \~\}
|
|
||||||
/*
|
|
||||||
Лицензия GPL
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PIPAIR_H
|
|
||||||
#define PIPAIR_H
|
|
||||||
|
|
||||||
#include "picout.h"
|
|
||||||
|
|
||||||
//! \addtogroup Containers
|
|
||||||
//! \{
|
|
||||||
//! \class PIPair
|
|
||||||
//! \brief
|
|
||||||
//! \~english Class template that provides a way to store two heterogeneous objects as a single unit.
|
|
||||||
//! \~russian Класс, который позволяет хранить два разнородных объекта как единое целое.
|
|
||||||
//! \~\}
|
|
||||||
//! \~\sa \a PIMap
|
|
||||||
template<typename Type0, typename Type1>
|
|
||||||
class PIPair {
|
|
||||||
public:
|
|
||||||
//! \~english Constructs an empty PIPair.
|
|
||||||
//! \~russian Создает пустой PIPair.
|
|
||||||
PIPair(): first(), second() {}
|
|
||||||
|
|
||||||
//! \~english Constructs PIPair from values `value0` and `value1`.
|
|
||||||
//! \~russian Создает PIPair из `value0` и `value1`.
|
|
||||||
PIPair(const Type0 & value0, const Type1 & value1) {
|
|
||||||
first = value0;
|
|
||||||
second = value1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! \~english First element.
|
|
||||||
//! \~russian Первый элемент.
|
|
||||||
Type0 first;
|
|
||||||
|
|
||||||
//! \~english Second element.
|
|
||||||
//! \~russian Второй элемент.
|
|
||||||
Type1 second;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! \~english Compare operator with PIPair.
|
|
||||||
//! \~russian Оператор сравнения с PIPair.
|
|
||||||
template<typename Type0, typename Type1>
|
|
||||||
inline bool operator==(const PIPair<Type0, Type1> & value0, const PIPair<Type0, Type1> & value1) {
|
|
||||||
return (value0.first == value1.first) && (value0.second == value1.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // PIPAIR_H
|
|
||||||
```
|
|
||||||
|
|
||||||
## Инструкции для агента (на один файл)
|
|
||||||
|
|
||||||
1. **Прочитать файл** и определить:
|
|
||||||
- Группу модуля (Container, Types, Core, IO, Thread, Math и т.д.)
|
|
||||||
- Все классы в файле
|
|
||||||
- Все публичные методы каждого класса
|
|
||||||
- Все свободные функции (non-member)
|
|
||||||
|
|
||||||
2. **Добавить документацию в начале файла** (если отсутствует):
|
|
||||||
```cpp
|
|
||||||
//! \addtogroup <GroupName>
|
|
||||||
//! \{
|
|
||||||
//! \file <filename>
|
|
||||||
//! \brief
|
|
||||||
//! \~english Brief description
|
|
||||||
//! \~russian Краткое описание
|
|
||||||
//! \~\}
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Добавить документацию для каждого класса**:
|
|
||||||
```cpp
|
|
||||||
//! \class ClassName
|
|
||||||
//! \brief
|
|
||||||
//! \~english Class description
|
|
||||||
//! \~russian Описание класса
|
|
||||||
```
|
|
||||||
|
|
||||||
4. **Добавить документацию для методов**:
|
|
||||||
```cpp
|
|
||||||
//! \~english Method description.
|
|
||||||
//! \~russian Описание метода.
|
|
||||||
ReturnType methodName(params);
|
|
||||||
```
|
|
||||||
|
|
||||||
5. **Проверить, что файл компилируется** после изменений
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
Ключевые элементы документации
|
|
||||||
|
|
||||||
| Элемент | Описание |
|
|
||||||
|---------|----------|
|
|
||||||
| //! \~english | Описание на английском языке |
|
|
||||||
| //! \~russian | Описание на русском языке |
|
|
||||||
| //! \details | |
|
|
||||||
| //! \~english | Детальное объяснение на английском языке |
|
|
||||||
| //! \~russian | Детальное объяснение на русском языке |
|
|
||||||
| //! \note | |
|
|
||||||
| //! \~english | Важное примечание о сложности/поведении на английском языке |
|
|
||||||
| //! \~russian | Важное примечание о сложности/поведении на русском языке |
|
|
||||||
| //! \~\sa | Ссылки на связанные функции |
|
|
||||||
|
|
||||||
NOTE: Не использовать секции \param и \return
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
# План рефакторинга PIVector2D
|
|
||||||
|
|
||||||
## Этап 1: Сборка
|
|
||||||
|
|
||||||
### 1.1 Собрать проект
|
|
||||||
- [x] собери проект, при необходимости поправь ошибки
|
|
||||||
|
|
||||||
## Этап 2: Проверить и поправить тесты
|
|
||||||
|
|
||||||
### 2.1 Запустить тесты
|
|
||||||
- [x] Запустить: `./build/tests/pip_math_test --gtest_filter="*Vector2D*"`
|
|
||||||
- [x] В случае ошибок внести правки в pivector2d.h
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Этап 3: Заменить PIPair<ssize_t, ssize_t> на PIVector2DIndex
|
|
||||||
|
|
||||||
### 3.1 Создать структуру PIVector2DIndex
|
|
||||||
- [x] Создано: `struct Index { ssize_t row; ssize_t col; };`
|
|
||||||
|
|
||||||
### 3.2 Обновить return types
|
|
||||||
- [x] indexOf() -> возвращает Index вместо PIPair<ssize_t, ssize_t>
|
|
||||||
- [x] lastIndexOf()
|
|
||||||
- [x] indexWhere()
|
|
||||||
- [x] lastIndexWhere()
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
Reference in New Issue
Block a user