What is it?
libsgfc++ is a C++ wrapper library around SGFC. As such, libsgfc++ offers the same functionality as SGFC:
- Read and write SGF (Smart Game Format) files.
- Check the file content for correctness.
- Correct any errors.
- Convert FF[1] - FF[3] files to the FF[4] format.
- Convert files with a character encoding that is not UTF-8 to the UTF-8 character encoding.
libsgfc++ is not restricted to files, it also reads and writes SGF data from/to std::string
without filesystem interaction.
SGFC is written in pure C. libsgfc++ adds an object-oriented API layer written in C++ on top of that.
libsgfc++ is cross-platform. It builds on the three major desktop operating systems (macOS, Linux, Windows) as well as on iOS. Other platforms may work as well but have not been tested.
What it's not
The limitations of SGFC also apply to libsgfc++. Quoting from the SGFC website:
SGFC is intended to be a tool for SGF experts, coders and maintainers of large SGF archives. You ought to have quite some knowledge of SGF to use SGFC efficiently.
SGFC was written primarily for Go/WeiQi/Baduk (GM[1]) files. It can't handle other games yet, i.e. it doesn't check any game-specific properties and values of other games than Go. It may even save erronous game-specific properties of other games! Use SGFC for other games with care.
Dependencies
At runtime libsgfc++ depends on the C/C++ runtime library, the C++ standard library and possibly (depending on the platform) an iconv library.
At build time libsgfc++ has the following dependencies:
- The main dependency, of course, is SGFC. A transitive dependency inherited from SGFC is iconv (more on that see below).
- The second dependency is the unit test library Catch2.
- The third dependency is the build management tool CMake.
- A last dependency is Doxygen, used to optionally generate the project's API documentation.
SGFC and Catch2 are integrated via Git submodule.
iconv is integrated differently depending on the platform:
- On Apple platforms (macOS, iOS, etc.) and the Windows-based platforms Cygwin and MinGW/MSYS, iconv is expected to be present as a separate library, both at build time and at runtime. This typically is GNU
libiconv
. - On Win32 the win-iconv project provides the iconv implementation. win-iconv is integrated via Git submodule at build time. The win-iconv sources are statically linked into libsgfc++, so there is no dependency at runtime.
- On all other platforms iconv is expected to be present natively without a separate library. For instance on Linux the iconv implementation is provided by
glibc
.
Project build system
The project build system is documented here.
More documentation
- API documentation (the public API is in the "Public API" module)
- Why another library?
- SGF notes: SGF features and how libsgfc++ exposes them to the library client.
- Library design and working principles
- Assorted SGFC notes
- Other project notes
- Coding guidelines
Acknowledgment
Thanks to Arno Hollosi, for writing SGFC in the first place, and for responding to an initial alpha version of libsgfc++ with a virtual whirlwind of changes to SGFC to make it much more library-friendly.
License
libsgfc++ is released under the Apache License (2.0). Here's the link to the license file.
SGFC is released under the terms of the BSD License.
- Link to local license file. This works only if you have a local clone of the SGFC git submodule.
- Link to remote license file. This link points to the
master
branch version of the license file.
Catch2 is released under the Boost Software License (1.0).
- Link to local license file. This works only if you have a local clone of the SGFC git submodule.
- Link to remote license file. This link points to the
master
branch version of the license file.