Newer
Older
Import / research / string-tables / FixedStrings.h
@John Ryland John Ryland on 22 Dec 2020 568 bytes add new projects
#pragma once
#ifndef FIXED_STRINGS_H
#define FIXED_STRINGS_H

// A 'fixed-string' is a compile time string which is
// stored in the read only section of the executable
// and is available as an int. The mapping is fixed
// at compile time. The retrieval of the static string
// that the id maps to is thread safe.

#define FIXED_STRING_ID(x)       cFixedStringId_##x
#define DECLARE_FIXED_STRING(x)  extern const int FIXED_STRING_ID(x)

// Thread-safe
extern const char* FixedStringFromId(int aFixedStringId);
extern int StringTableSize();

#endif // FIXED_STRINGS_H