Coder Social home page Coder Social logo

miniutf8's Introduction

miniutf8

An stb-style C++ library which allows easy UTF-8 Encoded String manipulation.

This library should work on C++17 since std::u32string and std::string_view were a thing.

How to use

This library is straight forward to use, you just need to copy miniutf8.hpp into your project, and have a .cpp file that includes it and defines MINIUTF8_IMPLEMENTATION (just like stb libraries).

Remember that this library is under the MIT license, the license is also inside the source file so you are not required to do anything. However, I would really appreciate to be credited.

Additional notes

If you do not want the UTF8 namespace to be global you can put it under a custom one:

Header:

// Do your usual header include guards

// Include files required by miniutf8
#include <cinttypes>
#include <cstring>
#include <string>
#include <string_view>

// MINIUTF8_EXT_INCLUDE disables includes from miniutf8
//  so that it does not include files inside a namespace.
#define MINIUTF8_EXT_INCLUDE
// MINIUTF8_NO_GUARDS tells miniutf8 to ignore include guards, so if the library
//  was already included in another file, it includes declarations anyway.
#define MINIUTF8_NO_GUARDS
// NOTE: MINIUTF8_NO_GUARDS is undefined after including miniutf8.

// Include miniutf8 under another namespace
namespace MyNamespace
{
    #include "miniutf8.hpp"
}

Source:

#define MINIUTF8_IMPLEMENTATION
#include "path-to-your-header"

Projects that use this

  • Marco4413/json
    • This project can also be used as an example on how to include miniutf8 under a different namespace.

miniutf8's People

Contributors

marco4413 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.