Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antonako1/atrc
ATRC is fast, simple to use, cross platform, single header resource file library made with C++.
https://github.com/antonako1/atrc
atrc cpp library linux resource-file windows
Last synced: 19 days ago
JSON representation
ATRC is fast, simple to use, cross platform, single header resource file library made with C++.
- Host: GitHub
- URL: https://github.com/antonako1/atrc
- Owner: Antonako1
- License: mit
- Created: 2024-05-12T14:23:05.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-10-27T11:20:43.000Z (24 days ago)
- Last Synced: 2024-10-27T12:59:00.865Z (24 days ago)
- Topics: atrc, cpp, library, linux, resource-file, windows
- Language: C++
- Homepage: https://github.com/Antonako1/ATRC
- Size: 3.57 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ATRC resource file library made
## Use with CMake
```
if (WIN32)
set(ATRC_DIR "${PROJECT_SOURCE_DIR}/ATRC/libs/win")
elseif (UNIX)
set(ATRC_DIR "${PROJECT_SOURCE_DIR}/ATRC/libs/linux")
endif()find_library(ATRC NAMES ATRC REQUIRED PATHS ${ATRC_DIR})
include_directories("${PROJECT_SOURCE_DIR}/atrc/include")
target_link_libraries(${project_name} PRIVATE ${ATRC})
```## Example program in C++
```cpp
#includeint main()
{
std::string filename = "test.atrc";
std::shared_ptr fd = Read(filename, "utf-8");
fd->AutoSave = true;
if (fd) {
AddBlock(fd, "block_name");
AddKey(fd, "block_name", "key_name", "value");
AddKey(fd, "block_name", "key_name2", "value");
RemoveKey(fd, "block_name", "key_name2");
ModifyKey(fd, "block_name", "key_name2", "new_value");
} else {
std::cerr << "Failed to read filedata." << std::endl;
}return 0;
}
```## Example resource file
```ini
%var_name%=value_1
<%priv_var>=value_2
[block_name]
key=value! reference variables
reference=variable values are: %var_name%, %priv_var%! insert variables
insert=insert a variable here: %*%! insert whitespaces
whitespace=&whitespaces&! insert reserved char
reserved=reserved characters: \%, \&, \!! insert variables in a sequence. These start counting from 0
insert2=insert second variable here: %*1% and first one here: %*0*
```## Building using ready made scripts
If needed, you can set Visual studio environmental values by running ```batch\msvs-dev-env.bat```
Check that ```batch\globals.bat``` has the right paths
- TOOLSPATH = Path to your tools directory containing Visual Studio dev-env scripts
- CMAKEPATH = Path to your CMAKE
- NINJAPATH = Path to your Ninja
- COMPILERPATH = Path to your compilerTo start build process, run ```msvs-dev-cmd.bat```, this script builds ATRC and ATRC.Test and runs the latter one
Run ```batch\del.bat``` to reset CMake cache and return source folders to starting point