libsgfc++ 2.0.1
A C++ library that uses SGFC to read and write SGF (Smart Game Format) data.
Loading...
Searching...
No Matches
libsgfc++

Build Status Github Releases Github Releases

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:

  1. The main dependency, of course, is SGFC. A transitive dependency inherited from SGFC is iconv (more on that see below).
  2. The second dependency is the unit test library Catch2.
  3. The third dependency is the build management tool CMake.
  4. 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

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](LICENSE).

SGFC is released under the terms of the BSD License.

Catch2 is released under the Boost Software License (1.0).