8000 GitHub - DreamyCecil/VDF: Simple public domain VDF/KeyValues reader & writer in ANSI C.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Simple public domain VDF/KeyValues reader & writer in ANSI C.

License

Notifications You must be signed in to change notification settings

DreamyCecil/VDF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VDF

This is a simple reader/writer of Valve Data Format (a.k.a. KeyValues) written in ANSI C.

This library was made as a sort of an exercise in C, since I mainly use C++.
Hopefully no memory leaks! But if there still are, feel free to submit an issue or a pull request.

See DOCUMENTATION.md file for more information.

Features

Reading from character buffers & files

  • Character buffers may be null-terminated or limited to a maximum size.
  • The files are parsed using fopen() with "rb" and reading the contents into a character buffer.
  • The ability to create versatile contexts for reading data in a specific way, as well as functions for quick one-line parsing.

Writing into character buffers & files

  • Character buffers are created and expanded by the specified step size on the fly, without having to do it manually.
  • The files are written using fopen() with "w" in order to insert platform-specific line breaks.

Other

  • Case-insensitive #base & #include macro support that includes files from absolute paths or relative to the specified base directory.
  • Keys and string values of any length.
  • Context flags for toggling specific features:
    • Support for escape sequences in strings.
    • Support for multiple values under the same key name.
    • Value replacement in duplicate keys, if the aforementioned multi-key support is disabled.

Currently unsupported

  • Conditional statements before the pairs, e.g. [$WIN32] "key" "value".
  • Multiline/block comments.
  • Non-ASCII encodings.

How to use

  1. Include keyvalues.c in your project or link the library in your CMake project using CMakeLists.txt.
  2. Include keyvalues.h in your C/C++ code.

Sample code with usage examples can be found here.

License

This library is in the public domain. That means you can do absolutely anything you want with it, although I appreciate attribution.

It's also licensed under the MIT license, in case public domain doesn't work for you. Every source file includes an explicit dual-license for you to choose from.

0