XLE
v0.02.0
|
Utilities and reusable classes. More...
Namespaces | |
Interlocked | |
Typedefs | |
typedef void(* | OnThrowCallback) (const ::Exceptions::BasicLabel &) |
typedef SpanningHeap< uint16 > | SimpleSpanningHeap |
template<typename Type > | |
using | AlignedUniquePtr = std::unique_ptr< Type, AlignedDeletor< Type >> |
using | StringTable = std::vector< std::pair< const utf8 *, std::string >> |
template<typename Type > | |
using | SerializableVector = std::vector< Type, BlockSerializerAllocator< Type >> |
template<typename CharType = char> | |
using | MemoryOutputStream = StreamBuf< Internal::ResizeableMemoryBuffer< CharType >> |
template<typename CharType = char> | |
using | FixedMemoryOutputStream = StreamBuf< Internal::FixedMemoryBuffer2< CharType >> |
typedef size_t | ModuleId |
typedef uint32 | Millisecond |
typedef uint64 | Microsecond |
typedef uint8 | utf8_t |
typedef uint8 | utf8 |
typedef uint16 | ucs2_t |
typedef uint16 | ucs2 |
typedef uint16 | utf16 |
typedef uint32 | ucs4_t |
typedef uint32 | ucs4 |
typedef uint32 | utf32 |
typedef ucs2 | nchar |
typedef nchar | nchar_t |
Functions | |
OnThrowCallback & | GlobalOnThrowCallback () |
template<class E , typename std::enable_if< std::is_base_of<::Exceptions::BasicLabel, E >::value >::type * = nullptr> | |
void | Throw (const E &e) |
void | printbits (const void *blob, int len) |
void | printbits2 (const uint8 *k, int nbytes) |
void | printhex32 (const void *blob, int len) |
void | printbytes (const void *blob, int len) |
void | printbytes2 (const void *blob, int len) |
void | lshift1 (void *blob, int len, int c) |
void | lshift8 (void *blob, int nbytes, int c) |
void | lshift32 (void *blob, int len, int c) |
void | rshift1 (void *blob, int len, int c) |
void | rshift8 (void *blob, int nbytes, int c) |
void | rshift32 (void *blob, int len, int c) |
void | lrot1 (void *blob, int len, int c) |
void | lrot8 (void *blob, int len, int c) |
void | lrot32 (void *blob, int len, int c) |
void | rrot1 (void *blob, int len, int c) |
void | rrot8 (void *blob, int len, int c) |
void | rrot32 (void *blob, int len, int c) |
uint32 | window1 (void *blob, int len, int start, int count) |
uint32 | window8 (void *blob, int len, int start, int count) |
uint32 | window32 (void *blob, int len, int start, int count) |
uint32 | xl_clz1 (uint8 x) |
uint32 | xl_ctz1 (uint8 x) |
uint32 | xl_clz2 (uint16 x) |
uint32 | xl_ctz2 (uint16 x) |
uint32 | xl_ctz4 (const uint32 &x) |
uint32 | xl_clz4 (const uint32 &x) |
uint32 | xl_ctz8 (const uint64 &x) |
uint32 | xl_clz8 (const uint64 &x) |
uint32 | xl_bsr1 (const uint16 &x) |
uint32 | xl_bsr2 (const uint16 &x) |
uint32 | xl_bsr4 (const uint32 &x) |
uint32 | xl_bsr8 (const uint64 &x) |
uint32 | xl_lg (const size_t &x) |
uint32 | popcount (uint32 v) |
uint32 | parity (uint32 v) |
int | countbits (uint32 v) |
int | countbits (std::vector< uint32 > &v) |
int | countbits (const void *blob, int len) |
void | invert (std::vector< uint32 > &v) |
uint32 | getbit (const void *block, int len, uint32 bit) |
uint32 | getbit_wrap (const void *block, int len, uint32 bit) |
template<typename T > | |
uint32 | getbit (T &blob, uint32 bit) |
void | xl_setbit (void *block, int len, uint32 bit) |
void | xl_setbit (void *block, int len, uint32 bit, uint32 val) |
template<typename T > | |
void | xl_setbit (T &blob, uint32 bit) |
void | xl_clearbit (void *block, int len, uint32 bit) |
void | flipbit (void *block, int len, uint32 bit) |
template<typename T > | |
void | flipbit (T &blob, uint32 bit) |
void | lshift (void *blob, int len, int c) |
template<typename T > | |
void | lshift (T &blob, int c) |
void | rshift (void *blob, int len, int c) |
template<typename T > | |
void | rshift (T &blob, int c) |
void | lrot (void *blob, int len, int c) |
template<typename T > | |
void | lrot (T &blob, int c) |
void | rrot (void *blob, int len, int c) |
template<typename T > | |
void | rrot (T &blob, int c) |
uint32 | window (void *blob, int len, int start, int count) |
template<typename T > | |
uint32 | window (T &blob, int start, int count) |
template<> | |
uint32 | getbit (uint32 &blob, uint32 bit) |
template<> | |
uint32 | getbit (uint64 &blob, uint32 bit) |
template<> | |
void | xl_setbit (uint32 &blob, uint32 bit) |
template<> | |
void | xl_setbit (uint64 &blob, uint32 bit) |
template<> | |
void | flipbit (uint32 &blob, uint32 bit) |
template<> | |
void | flipbit (uint64 &blob, uint32 bit) |
template<> | |
void | lshift (uint32 &blob, int c) |
template<> | |
void | lshift (uint64 &blob, int c) |
template<> | |
void | rshift (uint32 &blob, int c) |
template<> | |
void | rshift (uint64 &blob, int c) |
template<> | |
void | lrot (uint32 &blob, int c) |
template<> | |
void | lrot (uint64 &blob, int c) |
template<> | |
void | rrot (uint32 &blob, int c) |
template<> | |
void | rrot (uint64 &blob, int c) |
template<> | |
uint32 | window (uint32 &blob, int start, int count) |
template<> | |
uint32 | window (uint64 &blob, int start, int count) |
template<typename Type > | |
bool | IsPowerOfTwo (Type x) |
uint32 | IntegerLog2 (uint8 x) |
uint32 | IntegerLog2 (uint16 x) |
uint32 | IntegerLog2 (uint32 x) |
uint32 | IntegerLog2 (uint64 x) |
uint32 | LeastSignificantBitSet (uint64 input) |
uint32 | CeilToMultiplePow2 (uint32 input, uint32 multiple) |
uint32 | FloorToMultiplePow2 (uint32 input, uint32 multiple) |
uint32 | CeilToMultiple (uint32 input, uint32 multiple) |
template<typename CharType , typename CharTraits > | |
std::basic_ostream< CharType, CharTraits > & | operator<< (std::basic_ostream< CharType, CharTraits > &stream, const ::Exceptions::BasicLabel &exception) |
template<typename CharType , typename CharTraits > | |
std::basic_ostream< CharType, CharTraits > & | operator<< (std::basic_ostream< CharType, CharTraits > &stream, const std::exception &exception) |
template<typename ReturnType , typename... Args, class T > | |
auto | MakeFunction (T &&t) -> std::function< decltype(ReturnType(t(std::declval< Args >()...)))(Args...)> |
template<typename ReturnType , typename... Args> | |
auto | MakeFunction (ReturnType(*p)(Args...)) -> std::function< ReturnType(Args...)> |
template<typename ReturnType , typename... Args, typename ClassType > | |
auto | MakeFunction (ReturnType(ClassType::*p)(Args...)) -> std::function< ReturnType(Args...)> |
auto | MakeFunction (nullptr_t) -> std::function< void()> |
template<typename Fn > | |
auto | MakeAutoCleanup (Fn &&fn) -> AutoCleanup |
uint64 | Hash64 (const void *begin, const void *end, uint64 seed) |
uint64 | Hash64 (const char str[], uint64 seed) |
uint64 | Hash64 (const std::string &str, uint64 seed) |
uint32 | Hash32 (const void *begin, const void *end, uint32 seed) |
uint32 | IntegerHash32 (uint32 key) |
uint64 | IntegerHash64 (uint64 key) |
templ MovePTRHelper< T > | moveptr (T *p) |
Utility for initialising an intrusive_ptr with move semantics More... | |
templ void | intrusive_ptr_add_ref (T *p) |
templ void | intrusive_ptr_release (T *p) |
templ T * | ReleaseOwnership (intrusive_ptr< T > &ptr) |
template<typename T , typename U > | |
bool | operator== (const intrusive_ptr< T > &lhs, const intrusive_ptr< U > &rhs) never_throws |
template<typename T , typename U > | |
bool | operator!= (const intrusive_ptr< T > &lhs, const intrusive_ptr< U > &rhs) never_throws |
templ bool | operator== (const intrusive_ptr< T > &a, T *b) never_throws |
templ bool | operator!= (const intrusive_ptr< T > &a, T *b) never_throws |
templ bool | operator== (T *a, const intrusive_ptr< T > &b) never_throws |
templ bool | operator!= (T *a, const intrusive_ptr< T > &b) never_throws |
template<typename T , typename U > | |
bool | operator< (const intrusive_ptr< T > &a, const intrusive_ptr< U > &b) never_throws |
template<typename Result > | |
intrusive_ptr< Result > | make_intrusive () |
template<typename Result , typename X1 > | |
intrusive_ptr< Result > | make_intrusive (X1 x1) |
template<typename Result , typename X1 , typename X2 > | |
intrusive_ptr< Result > | make_intrusive (X1 x1, X2 x2) |
template<typename Result , typename X1 , typename X2 , typename X3 > | |
intrusive_ptr< Result > | make_intrusive (X1 x1, X2 x2, X3 x3) |
template<typename Result , typename X1 , typename X2 , typename X3 , typename X4 > | |
intrusive_ptr< Result > | make_intrusive (X1 x1, X2 x2, X3 x3, X4 x4) |
template<typename Result , typename X1 , typename X2 , typename X3 , typename X4 , typename X5 > | |
intrusive_ptr< Result > | make_intrusive (X1 x1, X2 x2, X3 x3, X4 x4, X5 x5) |
template<typename Result , typename X1 , typename X2 , typename X3 , typename X4 , typename X5 , typename X6 > | |
intrusive_ptr< Result > | make_intrusive (X1 x1, X2 x2, X3 x3, X4 x4, X5 x5, X6 x6) |
template<typename Result , typename X1 , typename X2 , typename X3 , typename X4 , typename X5 , typename X6 , typename X7 > | |
intrusive_ptr< Result > | make_intrusive (X1 x1, X2 x2, X3 x3, X4 x4, X5 x5, X6 x6, X7 x7) |
template<typename SearchI , typename CompareI > | |
SearchI | FindFirstNotOf (SearchI searchStart, SearchI searchEnd, CompareI compareBegin, CompareI compareEnd) |
template<typename SearchI , typename CompareI > | |
SearchI | FindLastOf (SearchI searchStart, SearchI searchEnd, CompareI compareBegin, CompareI compareEnd) |
template<typename SearchI , typename CompareI > | |
SearchI | FindLastOf (SearchI searchStart, SearchI searchEnd, CompareI compare) |
template<typename Container > | |
IteratorRange< const typename Container::value_type * > | MakeIteratorRange (const Container &c) |
template<typename Container > | |
IteratorRange< typename Container::value_type * > | MakeIteratorRange (Container &c) |
template<typename Iterator > | |
IteratorRange< Iterator > | MakeIteratorRange (Iterator begin, Iterator end) |
template<typename ArrayElement , int Count> | |
IteratorRange< ArrayElement * > | MakeIteratorRange (ArrayElement(&c)[Count]) |
void | XlClearMemory (void *p, size_t size) |
void | XlSetMemory (void *p, int c, size_t size) |
void | XlCopyMemory (void *dest, const void *src, size_t size) |
void | XlCopyMemoryAlign16 (void *dest, const void *src, size_t size) |
void | XlMoveMemory (void *dest, const void *src, size_t size) |
int | XlCompareMemory (const void *a, const void *b, size_t size) |
template<typename Type > | |
void | XlZeroMemory (Type &destination) |
template<int Count> | |
void | XlSwapMemory (void *a, void *b) |
uint64 | HashCombine (uint64 high, uint64 low) |
uint64 | ConstHash64FromString (const char *begin, const char *end) |
template<typename Type > | |
std::unique_ptr< uint8[]> | DuplicateMemory (const Type &input) |
template<typename Formatter > | |
void | AccessorDeserialize (Formatter &formatter, void *obj, const ClassAccessors &props) |
void | AccessorSerialize (OutputStreamFormatter &formatter, const void *obj, const ClassAccessors &props) |
template void | AccessorDeserialize (InputStreamFormatter< utf8 > &formatter, void *obj, const ClassAccessors &props) |
void | SetParameters (void *obj, const ClassAccessors &accessors, const ParameterBox ¶mBox) |
template<typename Formatter , typename Type > | |
void | AccessorDeserialize (Formatter &formatter, Type &obj) |
Deserializes a type with attached ClassAccessors More... | |
template<typename Type > | |
void | AccessorSerialize (OutputStreamFormatter &formatter, const Type &obj) |
Serializes a type with attached ClassAccessors More... | |
template<typename Type > | |
Type | CreateFromParameters (const ParameterBox ¶mBox) |
template<typename CharType > | |
std::string | AsString (const std::vector< CharType > &buffer, size_t len) |
void | BuildStringTable (StringTable &defines, const ParameterBox &box) |
void | OverrideStringTable (StringTable &defines, const ParameterBox &box) |
template<class T , class... Args> | |
const T & | GetByType (const std::tuple< Args... > &t) |
uint32 | XlGetCurrentThreadId () |
template<typename Type > | |
Type * | PtrAdd (Type *input, ptrdiff_t offset) |
template<typename Type > | |
Type * | AsPointer (Type *i) |
template<typename VecType > | |
VecType::value_type * | AsPointer (const std::_Vector_iterator< VecType > &i) |
template<typename VecType > | |
const VecType::value_type * | AsPointer (const std::_Vector_const_iterator< VecType > &i) |
template<typename Type , typename Traits , typename Alloc > | |
Type * | AsPointer (const std::_String_iterator< Type, Traits, Alloc > &i) |
template<typename Type , typename Traits , typename Alloc > | |
const Type * | AsPointer (const std::_String_const_iterator< Type, Traits, Alloc > &i) |
template<typename Type , int Count> | |
Type * | ArrayEnd (Type(&input)[Count]) |
Finds the end of a fixed length array More... | |
template<typename DestinationType , typename SourceType > | |
DestinationType | checked_cast (SourceType source) |
Equivalent to static_cast, but with extra debugging in Debug builds More... | |
template<typename Type > | |
Type | Default () |
Returns a default value for a given type More... | |
template<typename Type , typename std::enable_if< std::is_pointer< Type >::value >::type * = nullptr> | |
Type * | Default () |
template<typename Ptr > | |
void | SafeDelete (Ptr &ptr) |
template<typename Ptr > | |
void | SafeDeleteArray (Ptr &ptr) |
char * | DupString (const char *src) |
std::unique_ptr< Data > | SerializeToData (const char name[], const std::vector< std::pair< const utf8 *, std::string >> &table) |
template<typename Type > | |
Type | Deserialize (const Data *source, const char name[], const Type &def) |
template<typename Type > | |
Type | Deserialize (const Data *source, const Type &def) |
template<typename Type , int Count> | |
cml::vector< Type, cml::fixed< Count > > | Deserialize (const Data *source, const cml::vector< Type, cml::fixed< Count >> &def) |
template<typename FirstType , typename SecondType > | |
std::pair< FirstType, SecondType > | Deserialize (const Data *source, const std::pair< FirstType, SecondType > &def) |
void | AttachFileSystemMonitor (StringSection< char > directoryName, StringSection< char > filename, std::shared_ptr< OnChangeCallback > callback) |
Monitor a file for changes More... | |
void | FakeFileChange (StringSection< char > directoryName, StringSection< char > filename) |
Executed all on-change callbacks associated with file More... | |
void | TerminateFileSystemMonitoring () |
Shut down all file system monitoring More... | |
std::unique_ptr< uint8[]> | LoadFileAsMemoryBlock (const char sourceFileName[], size_t *sizeResult) |
XL_UTILITY_API bool | DoesFileExist (const char filename[]) |
XL_UTILITY_API bool | DoesDirectoryExist (const char filename[]) |
XL_UTILITY_API void | CreateDirectoryRecursive (const StringSection< char > filename) |
XL_UTILITY_API uint64 | GetFileModificationTime (const char filename[]) |
XL_UTILITY_API uint64 | GetFileSize (const char filename[]) |
XL_UTILITY_API std::vector< std::string > | FindFiles (const std::string &searchPath, FindFilesFilter::BitField filter=FindFilesFilter::All) |
XL_UTILITY_API std::vector< std::string > | FindFilesHierarchical (const std::string &rootDirectory, const std::string &filePattern, FindFilesFilter::BitField filter=FindFilesFilter::All) |
template<class T > | |
void | concat_path (T *dst, int count, const T *a, const T *b, const T *bEnd) |
void | XlConcatPath (char *dst, int count, const char *a, const char *b, const char *bEnd) |
void | XlConcatPath (ucs2 *dst, int count, const ucs2 *a, const ucs2 *b, const ucs2 *bEnd) |
template<typename CharType > | |
const CharType * | XlExtension (const CharType *path) |
template const char * | XlExtension (const char *path) |
template const utf8 * | XlExtension (const utf8 *path) |
template const ucs2 * | XlExtension (const ucs2 *path) |
template const ucs4 * | XlExtension (const ucs4 *path) |
void | XlChopExtension (char *path) |
template<class T > | |
void | get_dir_name (T *dst, int count, const T *path) |
void | XlDirname (char *dst, int count, const char *path) |
void | XlDirname (ucs2 *dst, int count, const ucs2 *path) |
void | XlBasename (char *dst, int count, const char *path) |
const char * | XlBasename (const char *path) |
TC SplitPath< CharType >::SectionType | AsSectionType (StringSection< CharType > e) |
TC std::basic_string< CharType > | MakeRelativePath (const SplitPath< CharType > &iBasePath, const SplitPath< CharType > &iDestinationObject, const FilenameRules &rules) |
char | ConvertPathChar (char input, const FilenameRules &rules) |
utf8 | ConvertPathChar (utf8 input, const FilenameRules &rules) |
ucs2 | ConvertPathChar (ucs2 input, const FilenameRules &rules) |
template std::basic_string< char > | MakeRelativePath (const SplitPath< char > &, const SplitPath< char > &, const FilenameRules &) |
template std::basic_string< utf8 > | MakeRelativePath (const SplitPath< utf8 > &, const SplitPath< utf8 > &, const FilenameRules &) |
template std::basic_string< ucs2 > | MakeRelativePath (const SplitPath< ucs2 > &, const SplitPath< ucs2 > &, const FilenameRules &) |
template<typename CharType > | |
XL_UTILITY_API const CharType * | XlExtension (const CharType *path) |
template<typename CharType > | |
FileNameSplitter< CharType > | MakeFileNameSplitter (const CharType rawString[]) |
template<typename CharType > | |
FileNameSplitter< CharType > | MakeFileNameSplitter (const std::basic_string< CharType > &rawString) |
template<typename CharType > | |
FileNameSplitter< CharType > | MakeFileNameSplitter (StringSection< CharType > rawString) |
std::unique_ptr< OutputStream > | OpenFileOutput (const char *path, const char *mode) |
std::unique_ptr< InputStream > | OpenMemoryInput (const void *s, int len) |
template<typename OutChar , typename InChar , typename std::enable_if< CompatibleCharTypes< OutChar, InChar >::compatible >::type * = nullptr> | |
void | PushString (std::basic_streambuf< OutChar > &stream, StringSection< InChar > input) |
template<typename Type , typename CharType > | |
void | Serialize (OutputStreamFormatter &formatter, const CharType name[], const Type &obj) |
template<typename CharType > | |
void | Serialize (OutputStreamFormatter &formatter, const CharType name[], const CharType str[]) |
template<typename CharType > | |
void | Serialize (OutputStreamFormatter &formatter, const CharType name[], const std::basic_string< CharType > &str) |
template<typename FirstType , typename SecondType , typename CharType > | |
void | Serialize (OutputStreamFormatter &formatter, const CharType name[], const std::pair< FirstType, SecondType > &obj) |
template<typename Type , typename Formatter > | |
Type | Deserialize (DocElementHelper< Formatter > &ele, const typename Formatter::value_type name[], const Type &obj) |
template<typename FirstType , typename SecondType , typename Formatter > | |
std::pair< FirstType, SecondType > | Deserialize (DocElementHelper< Formatter > &ele, const typename Formatter::value_type name[], const std::pair< FirstType, SecondType > &def) |
template<typename CharType , int Count> | |
bool | TryEat (MemoryMappedInputStream &stream, CharType(&pattern)[Count]) |
template<typename CharType , int Count> | |
void | Eat (MemoryMappedInputStream &stream, CharType(&pattern)[Count], StreamLocation location) |
template<typename CharType > | |
const CharType * | ReadToStringEnd (MemoryMappedInputStream &stream, bool protectedStringMode, StreamLocation location) |
template<typename CharType > | |
void | EatWhitespace (MemoryMappedInputStream &stream) |
template<typename CharType > | |
int | AsInt (const CharType *inputStart, const CharType *inputEnd) |
unsigned int xl_thread_call | MonitoringEntryPoint (void *) |
void | CreateDirectory_Int (const char *dn) |
void | CreateDirectory_Int (const wchar_t *dn) |
template<typename Char > | |
void | CreateDirectoryRecursive_Int (StringSection< Char > filename) |
template<typename CharType > | |
bool | IsWhitespace (CharType chr) |
template<typename CharType > | |
bool | IsNameStartChar (CharType chr) |
template<typename CharType > | |
bool | IsNameChar (CharType chr) |
int | xl_snprintf (utf8 *buf, int count, const utf8 *fmt,...) |
template<typename T > | |
int | _PrintFormatV (OutputStream *stream, const T *fmt, va_list args) |
int | PrintFormatV (OutputStream *stream, const char *fmt, va_list args) |
int | PrintFormat (OutputStream *stream, const char *fmt,...) |
int | XlFormatStringV (char *buf, int count, const char *fmt, va_list args) never_throws |
int | XlFormatString (char *buf, int count, const char *fmt,...) |
std::string | XlDynFormatString (const char format[],...) |
XL_UTILITY_API int | xl_sprintf (char *buf, const char *fmt,...) |
XL_UTILITY_API int | xl_vsprintf (char *buf, const char *fmt, va_list args) |
XL_UTILITY_API int | xl_vsnprintf (char *buf, int size, const char *format, va_list &args) |
int | xl_snprintf (char *buf, int count, const char *fmt,...) |
template<typename CharType , int Count> | |
Internal::StringMeldInPlace< CharType > | StringMeldInPlace (CharType(&buffer)[Count]) |
template<typename CharType , int Count> | |
Internal::StringMeldInPlace< CharType > | StringMeldAppend (CharType(&buffer)[Count]) |
template<typename CharType > | |
Internal::StringMeldInPlace< CharType > | StringMeldInPlace (CharType *bufferStart, CharType *bufferEnd) |
template<typename CharType > | |
Internal::StringMeldInPlace< CharType > | StringMeldAppend (CharType *bufferStart, CharType *bufferEnd) |
long | GetTimezone () |
size_t | XlStrFTime (char *s, size_t maxsize, const char *format, const struct tm *t) |
void | XlInitStringUtil (const char locale[]) |
Locale::Enum | XlGetLocale () |
const char * | XlGetLocaleString (Locale::Enum locale) |
size_t | XlStringSize (const char *str) |
size_t | XlStringSizeSafe (const char *str, const char *end) |
size_t | XlStringSize (const ucs4 *str) |
size_t | XlStringSizeSafe (const ucs4 *str, const ucs4 *end) |
bool | IsUtfMultibyte (uint8 c) |
bool | CheckUtfMultibytes (size_t count, const char *s) |
size_t | XlStringLen (const char *s) |
size_t | XlStringLen (const utf8 *s) |
size_t | XlStringSize (const utf8 *s) |
size_t | XlStringLen (const ucs4 *str) |
void | XlCopyString (char *dst, size_t count, const char *src) |
void | XlCopyNString (char *dst, size_t count, const char *src, size_t length) |
void | XlCopySafeUtf (char *dst, size_t size, const char *src) |
void | XlCopySafeUtfN (char *dst, size_t size, const char *src, const uint32 numSeq) |
void | XlCopyString (utf8 *dst, size_t size, const utf8 *src) |
void | XlCopyNString (utf8 *dst, size_t count, const utf8 *src, size_t length) |
int | XlCompareString (const utf8 *x, const utf8 *y) |
int | XlCompareStringI (const utf8 *x, const utf8 *y) |
int | XlComparePrefix (const utf8 *x, const utf8 *y, size_t size) |
int | XlComparePrefixI (const utf8 *x, const utf8 *y, size_t size) |
void | XlCopyString (wchar_t *dst, size_t size, const wchar_t *src) |
void | XlCopyNString (wchar_t *dst, size_t count, const wchar_t *src, size_t length) |
void | XlCopyString (ucs2 *dst, size_t count, const ucs2 *src) |
void | XlCopyNString (ucs2 *dst, size_t count, const ucs2 *src, size_t length) |
void | XlCatString (ucs2 *dst, size_t size, const ucs2 *src) |
void | XlCatNString (ucs2 *dst, size_t size, const ucs2 *src, size_t length) |
size_t | XlStringSize (const ucs2 *str) |
size_t | XlStringLen (const ucs2 *str) |
size_t | XlCompareString (const ucs2 *x, const ucs2 *y) |
size_t | XlCompareStringI (const ucs2 *x, const ucs2 *y) |
void | XlCopyString (ucs4 *dst, size_t count, const ucs4 *src) |
void | XlCopyNString (ucs4 *dst, size_t count, const ucs4 *src, size_t length) |
void | XlCatString (char *dst, size_t size, const char *src) |
void | XlCatNString (char *dst, size_t size, const char *src, size_t length) |
void | XlCatSafeUtf (char *dst, size_t size, const char *src) |
void | XlCombineString (char dst[], size_t size, const char zero[], const char one[]) |
void | XlCatString (ucs4 *dst, size_t count, const ucs4 *src) |
void | XlCatString (char *dst, size_t size, char src) |
void | XlCatString (ucs2 *dst, size_t size, ucs2 src) |
void | XlCatString (ucs4 *dst, size_t count, ucs4 src) |
int | XlComparePrefix (const char *s1, const char *s2, size_t size) |
int | XlComparePrefixI (const char *s1, const char *s2, size_t size) |
int | XlComparePrefix (const ucs2 *x, const ucs2 *y, size_t len) |
int | XlComparePrefixI (const ucs2 *x, const ucs2 *y, size_t len) |
int | XlComparePrefix (const ucs4 *x, const ucs4 *y, size_t len) |
int | XlComparePrefixI (const ucs4 *x, const ucs4 *y, size_t len) |
uint32 | XlHashString (const char *x) |
uint32 | XlHashString (const ucs4 *x) |
int | XlCompareString (const char *x, const char *y) |
int | XlCompareStringI (const char *x, const char *y) |
int | XlCompareString (const ucs4 *x, const ucs4 *y) |
int | XlCompareStringI (const ucs4 *x, const ucs4 *y) |
const char * | XlFindChar (const char *s, const char ch) |
char * | XlFindChar (char *s, const char ch) |
const char * | XlFindAnyChar (const char s[], const char delims[]) |
const char * | XlFindNot (const char s[], const char delims[]) |
const char * | XlFindCharReverse (const char *s, char ch) |
const char * | XlFindString (const char *s, const char *x) |
char * | XlFindString (char *s, const char *x) |
const char * | XlFindStringI (const char *s, const char *x) |
const char * | XlFindStringSafe (const char *s, const char *x, size_t size) |
const ucs4 * | XlFindString (const ucs4 *s, const ucs4 *x) |
const ucs4 * | XlFindStringI (const ucs4 *s, const ucs4 *x) |
const ucs4 * | XlFindStringSafe (const ucs4 *s, const ucs4 *x, size_t len) |
template<class T > | |
size_t | tokenize_string (T *buf, size_t count, const T *delimiters, T **tokens, size_t numMaxToken) |
size_t | XlTokenizeString (char *buf, size_t count, const char *delimiters, char **tokens, size_t numMaxToken) |
size_t | XlTokenizeString (ucs2 *buf, size_t count, const ucs2 *delimiters, ucs2 **tokens, size_t numMaxToken) |
char * | XlStrTok (char *token, const char *delimit, char **context) |
int | XlExtractInt (const char *buf, int *arr, size_t length) |
bool | XlSafeAtoi (const char *str, int *n) |
bool | XlSafeAtoi64 (const char *str, int64 *n) |
const char * | XlReplaceString (char *dst, size_t size, const char *src, const char *strOld, const char *strNew) |
XL_UTILITY_API void | XlCompactString (char *dst, size_t count, const char *src) |
void | XlCompactString (ucs4 *dst, size_t count, const ucs4 *src) |
bool | XlIsValidAscii (const char *str) |
bool | XlIsValidUtf8 (const utf8 *str, size_t count) |
bool | XlHasUtf8Bom (const utf8 *str) |
size_t | XlGetOffset (const char *s, size_t index) |
ucs4 | XlGetChar (const char *str, size_t *size) |
void | XlGetChar (char *output, size_t count, const ucs4 *uniStr, size_t *size) |
const char * | XlLowerCase (char *str) |
const ucs4 * | XlLowerCase (ucs4 *str) |
const char * | XlUpperCase (char *str) |
const ucs4 * | XlUpperCase (ucs4 *str) |
size_t | XlDecodeUrl (char *dst, size_t count, const char *encoded) |
void | XlSwapMemory (void *a, void *b, size_t size) |
bool | XlIsAlnum (char c) |
bool | XlIsEngAlpha (char c) |
bool | XlIsAlNumSpace (char c) |
bool | XlIsDigit (char c) |
bool | XlIsDigit (utf8 c) |
bool | XlIsHex (char c) |
bool | XlIsLower (char c) |
bool | XlIsUpper (char c) |
bool | XlIsPrint (char c) |
bool | XlIsSpace (char c) |
char | XlToLower (char c) |
char | XlToUpper (char c) |
wchar_t | XlToLower (wchar_t c) |
wchar_t | XlToUpper (wchar_t c) |
ucs2 | XlToLower (ucs2 c) |
ucs2 | XlToUpper (ucs2 c) |
char * | XlTrimRight (char *str) |
char * | XlRemoveAllSpace (char *str) |
bool | XlIsDigit (ucs4 c) |
bool | XlIsAlpha (ucs4 c) |
bool | XlIsEngAlpha (ucs4 c) |
bool | XlIsUpper (ucs4 c) |
bool | XlIsLower (ucs4 c) |
bool | XlIsSpace (ucs4 c) |
ucs4 | XlToLower (ucs4 c) |
ucs4 | XlToUpper (ucs4 c) |
int | XlFromHex (char c) |
char | XlToHex (int n) |
bool | XlAtoBool (const char *str, const char **end_ptr) |
int | XlAtoI32 (const char *str, const char **end_ptr, int radix) |
int64 | XlAtoI64 (const char *str, const char **end_ptr, int radix) |
uint32 | XlAtoUI32 (const char *str, const char **end_ptr, int radix) |
uint64 | XlAtoUI64 (const char *str, const char **end_ptr, int radix) |
float | XlAtoF32 (const char *str, const char **end_ptr) |
double | XlAtoF64 (const char *str, const char **endptr) |
char * | XlI32toA (int32 value, char *buffer, size_t dim, int radix) |
char * | XlI64toA (int64 value, char *buffer, size_t dim, int radix) |
char * | XlUI32toA (uint32 value, char *buffer, size_t dim, int radix) |
char * | XlUI64toA (uint64 value, char *buffer, size_t dim, int radix) |
int | XlI32toA_s (int32 value, char *buffer, size_t dim, int radix) |
int | XlI64toA_s (int64 value, char *buffer, size_t dim, int radix) |
int | XlUI32toA_s (uint32 value, char *buffer, size_t dim, int radix) |
int | XlUI64toA_s (uint64 value, char *buffer, size_t dim, int radix) |
char * | XlI32toA_ns (int32 value, char *buffer, int radix) |
char * | XlI64toA_ns (int64 value, char *buffer, int radix) |
char * | XlUI32toA_ns (uint32 value, char *buffer, int radix) |
char * | XlUI64toA_ns (uint64 value, char *buffer, int radix) |
bool | XlMatchWildcard (const char *str, const char *pat, bool nocase) |
bool | XlToHexStr (const char *x, size_t xlen, char *y, size_t ylen) |
bool | XlHexStrToBin (const char *x, char *y) |
template<typename CharType > | |
const CharType * | XlStringEnd (const CharType nullTermStr[]) |
template<typename CharType > | |
CharType * | XlStringEnd (CharType nullTermStr[]) |
template<typename CharType > | |
StringSection< CharType > | MakeStringSection (const CharType *start, const CharType *end) |
template<typename CharType > | |
StringSection< CharType > | MakeStringSection (const std::basic_string< CharType > &str) |
XL_UTILITY_API int | XlExtractInt (const char *buf, int *arr, int length) |
XL_UTILITY_API bool | XlSafeAtoui64 (const char *str, uint64 *n) |
XL_UTILITY_API int | XlGetLocaleCodePage (Locale::Enum locale) |
int | XlCountUtfSequence (uint8 c) |
utf8 | XlToLower (utf8 c) |
utf8 | XlToUpper (utf8 c) |
template<int Count, typename CharType > | |
void | XlCopyString (CharType(&destination)[Count], const CharType source[]) |
template<int Count, typename CharType > | |
void | XlCopyNString (CharType(&destination)[Count], const CharType source[], size_t length) |
template<int Count, typename CharType > | |
void | XlCopyString (CharType(&destination)[Count], const StringSection< CharType > &source) |
template<typename CharType > | |
void | XlCatString (CharType destination[], size_t size, const StringSection< CharType > &source) |
template<int Count, typename CharType > | |
void | XlCatString (CharType(&destination)[Count], const CharType source[]) |
template<int Count, typename CharType > | |
void | XlCatString (CharType(&destination)[Count], const StringSection< CharType > &source) |
template<typename T > | |
bool | XlEqString (const T *a, const T *b) |
template<typename T > | |
bool | XlEqStringI (const T *a, const T *b) |
template<typename T > | |
bool | XlEqStringI (const std::basic_string< T > &a, const std::basic_string< T > &b) |
template<typename T > | |
bool | XlEqStringI (const std::basic_string< T > &a, const T *b) |
template<typename T > | |
bool | XlEqString (const std::basic_string< T > &a, const T *b) |
template<typename T > | |
bool | XlEqStringI (const StringSection< T > &a, const StringSection< T > &b) |
template<typename T > | |
bool | XlEqString (const StringSection< T > &a, const StringSection< T > &b) |
template<typename T > | |
bool | XlEqStringI (const StringSection< T > &a, const T *b) |
template<typename T > | |
bool | XlEqString (const StringSection< T > &a, const T *b) |
template<typename T > | |
bool | XlEqStringI (const StringSection< T > &a, const std::basic_string< T > &b) |
template<typename T > | |
bool | XlEqString (const StringSection< T > &a, const std::basic_string< T > &b) |
template<typename T > | |
int | XlCompareString (const StringSection< T > &a, const T *b) |
template<typename T > | |
int | XlCompareString (const T *a, const StringSection< T > &b) |
template<typename T > | |
int | XlCompareString (const StringSection< T > &a, const StringSection< T > &b) |
template<typename T > | |
int | XlCompareStringI (const StringSection< T > &a, const T *b) |
template<typename T > | |
int | XlCompareStringI (const T *a, const StringSection< T > &b) |
template<typename T > | |
int | XlCompareStringI (const StringSection< T > &a, const StringSection< T > &b) |
bool | XlGetCurrentDirectory (uint32 dim, char dst[]) |
bool | XlGetCurrentDirectory (uint32 dim, ucs2 dst[]) |
uint64 | XlGetCurrentFileTime () |
uint32 | XlSignalAndWait (XlHandle hSig, XlHandle hWait, uint32 waitTime) |
void | XlGetProcessPath (utf8 dst[], size_t bufferCount) |
void | XlGetProcessPath (ucs2 dst[], size_t bufferCount) |
void | XlChDir (const utf8 path[]) |
void | XlChDir (const ucs2 path[]) |
void | XlDeleteFile (const utf8 path[]) |
void | XlDeleteFile (const ucs2 path[]) |
void | XlMoveFile (const utf8 destination[], const utf8 source[]) |
void | XlOutputDebugString (const char *format) |
void | XlMessageBox (const char *content, const char *title) |
const char * | XlGetCommandLine () |
ModuleId | GetCurrentModuleId () |
XlHandle | XlCreateEvent (bool manualReset) |
bool | XlResetEvent (XlHandle event) |
bool | XlSetEvent (XlHandle event) |
bool | XlCloseSyncObject (XlHandle object) |
uint32 | XlWaitForSyncObject (XlHandle object, uint32 waitTime) |
uint32 | XlWaitForMultipleSyncObjects (uint32 waitCount, XlHandle waitObjects[], bool waitAll, uint32 waitTime, bool alterable) |
Millisecond | Millisecond_Now () |
Microsecond | Microsecond_Now () |
uint64 | GetPerformanceCounter () |
uint64 | GetPerformanceCounterFrequency () |
int | utf8_seqlen (const utf8 *s) |
int | utf8_step (const char *utf8_str) |
bool | IsValid (const utf8 *s, const utf8 *se) |
int | utf8_2_ucs4 (const utf8 *src, size_t sl, ucs4 *dst, size_t dl) |
int | ucs2_2_utf8 (const ucs2 *src, size_t sl, utf8 *dst, size_t dl) |
int | ucs4_2_utf8 (const ucs4 *src, size_t sl, utf8 *dst, size_t dl) |
int | utf8_2_ucs2 (const utf8 *src, size_t sl, ucs2 *dst, size_t dl) |
int | ucs4_2_ucs2 (const ucs4 *src, size_t sl, ucs2 *dst, size_t dl) |
int | ucs2_2_ucs4 (const ucs2 *src, size_t sl, ucs4 *dst, size_t dl) |
int | ucs2_2_utf8 (ucs2 ch, utf8 *dst) |
int | ucs4_2_utf8 (ucs4 ch, utf8 *dst) |
size_t | utf8_nth_offset (const utf8 *s, size_t N) |
size_t | utf8_offset_ord (const utf8 *s, size_t offset) |
ucs4 | utf8_nextchar (const utf8 *s, size_t *i) |
size_t | utf8_strlen (const utf8 *s) |
void | utf8_inc (const utf8 *s, size_t *i) |
void | utf8_dec (const utf8 *s, size_t *i) |
int | utf8_read_escape_sequence (char *str, uint32 *dst) |
size_t | utf8_unescape (utf8 *buf, size_t dim, char *src) |
size_t | utf8_escape_wchar (utf8 *buf, size_t dim, uint32 ch) |
size_t | utf8_escape (utf8 *buf, size_t dim, char *src, int escape_quotes) |
const utf8 * | utf8_strchr (const utf8 *s, ucs4 ch, int &ord) |
const utf8 * | utf8_memchr (const utf8 *s, ucs4 ch, size_t n, int &ord) |
int | utf8_is_locale_utf8 (char *locale) |
size_t | utf8_vprintf (const char *fmt, va_list ap) |
size_t | utf8_printf (const char *fmt,...) |
XL_UTILITY_API int | utf8_ord_offset (const utf8 *s, int N) |
XL_UTILITY_API int | utf8_offset_ord (const utf8 *s, int offset) |
XL_UTILITY_API ucs4 | utf8_nextchar (const utf8 *s, int *i) |
XL_UTILITY_API void | utf8_inc (const utf8 *s, int *i) |
XL_UTILITY_API void | utf8_dec (const utf8 *s, int *i) |
const utf8 * | u (const char input[]) |
void | XlGetLocalTime (uint64 time, struct tm *local) |
uint64 | XlMakeFileTime (struct tm *local) |
double | XlDiffTime (uint64 endTime, uint64 beginTime) |
bool | XlIsCriticalSectionLocked (void *cs) |
void | XlGetNumCPUs (int *physical, int *logical, int *avail) |
uint32 | XlGetCurrentProcessId () |
bool | XlReleaseMutex (XlHandle h) |
XlHandle | XlCreateSemaphore (int maxCount) |
bool | XlReleaseSemaphore (XlHandle h, int releaseCount, int *previousCount) |
bool | XlPulseEvent (XlHandle h) |
Variables | |
template | SpanningHeap< uint16 > |
template | SpanningHeap< uint32 > |
FilenameRules | s_defaultFilenameRules ('/', false) |
IMAGE_DOS_HEADER | __ImageBase |
Utilities and reusable classes.
This namespace provides many classes and functions used by higher level code. As this code is at the very bottom of the layer diagram, it is designed to be as flexible and reusable as possible.
See below for some of the most commonly used classes and functions.
Cross-platform interfaces for primitive threading operations (such as mutexes and atomic operations.
Some part of this threading library were implemented before C++11 standard library implementations were available. As a result, some parts of this have been superceeded by the standard library.
Class | Description |
---|---|
CompletionThreadPool | basic thread pool with windows completion ports |
Utility::Interlocked namespace | layer over atomic CPU instructions |
IO functionality and streams abstraction
Includes serialization and deserialisation utilities as well file access and path processing utilities.
Class | Description |
---|---|
BasicFile | simple file IO layer, used frequently |
InputStreamFormatter | high performance parser of structured text files |
OutputStreamFormatter | output equivalent to InputStreamFormatter |
XmlInputStreamFormatter | load structured data from xml files |
Document | exposes a "DOM" like interface for data from InputStreamFormatter or XmlInputStreamFormatter |
SplitPath | utility for processing and merging paths |
OutputStream | primitive text-oriented stream interface (similar to std::ostream) |
AttachFileSystemMonitor() | monitor a file for future changes |
Currently only includes HierarchicalCPUProfiler, which provides a convenient interface for every-day first-step profiling tasks.
Metaprogramming utility classes.
Class | Description |
---|---|
ClassAccessors | register C# property-like get and set accessors for C++ classes |
AccessorSerialize() and AccessorDeserialize() | Automatic serialization with native classes via ClassAccessors |
CreateFromParameters() | Automatically build a native class from a parameter box |
VariantFunctions | Stores a list of arbitrary functor objects associated by string name |
Memory management utilities and heap implementations
Class | Description |
---|---|
LRUCache | Records a finite subset of the most recently used items of a larger set |
MiniHeap | Moderate performance (but highly flexible) heap implementation. Used for small and special case heap implementations |
SpanningHeap | Heap management utility for arbitrarily sized blocks |
BitHeap | Records allocated/deallocated status for a fixed set of equal heap blocks |
See also many other reuseable components:
Class | Description |
---|---|
ParameterBox | Stores a set of variant types, indexed by string hash |
ConstHash64 | generates a compile time hash of a string, without special compiler support |
utf8, ucs2, ucs4 | unicode character type library |
StringMeld | allows ostream::operator<< syntax on a fixed size character buffer |
Hash32(), Hash64(), HashCombine() | general purpose hashing function |
Standard library extension functions:
Class | Description |
---|---|
Conversion::Convert() | Generic syntax for writing conversion functions |
Equivalent() | Checks for equivalency within a threshold of error |
checked_cast() | static_cast in release, but with an rtti-based assertion in debug |
Default() | returns a default value for a given type |
PrintFormat() | printf-style formatted output to a OutputStream |
The utility library also provides a layer over many standard library functions (eg, XlCopyMemory), as well as layers over common OS functions (like XlGetCommandLine and FindFiles).
void Utility::AccessorDeserialize | ( | Formatter & | formatter, |
Type & | obj | ||
) |
Deserializes a type with attached ClassAccessors
Class accesses must be registed for the given type (by implementing GetAccessors<>). The system will deserialize all properties with a set accessor, and a create children in child lists, where necessary.
Type parsing and conversion is handled automatically. Properties that don't exist in the input stream will not be touched at all.
The deserialization is slower than a hand written deserialization function. This is intended for text serialization of relatively small types. Very complex types (or types that are deserialized frequently) may benefit from a custom hand written replacement function.
void Utility::AccessorSerialize | ( | OutputStreamFormatter & | formatter, |
const Type & | obj | ||
) |
Serializes a type with attached ClassAccessors
Class accesses must be registed for the given type (by implementing GetAccessors<>). The system will serialize all properties with a get accessor, and all objects in child lists.
Type conversions are handled automatically.
The serialization is slower than a hand written serialization function. This is intended for text serialization of relatively small types.
Type* Utility::ArrayEnd | ( | Type(&) | input[Count] | ) |
Finds the end of a fixed length array
This just finds the end of an array. It's similar to using dimof as in the following example:
void Utility::AttachFileSystemMonitor | ( | StringSection< char > | directoryName, |
StringSection< char > | filename, | ||
std::shared_ptr< OnChangeCallback > | callback | ||
) |
Monitor a file for changes
Attaches a callback function to a file on disk. The callback will then be executed whenever the file changes. This is typically used to reload source assets after they receive changes form an external source.
DestinationType Utility::checked_cast | ( | SourceType | source | ) |
Equivalent to static_cast, but with extra debugging in Debug builds
In debug builds, if rtti is enabled, performs a dynamic_cast. Otherwise, performs a static_cast. This is useful when doing an up-cast with static_cast, because it provides some extra validation. But note that is rtti is disabled in debug, dynamic_cast can't be performed. So the system will just drop back to static_cast.
Type Utility::Default | ( | ) |
Returns a default value for a given type
Returns a reasonable default for the templated type. The meaning of "default" can change from type to type. Generally this is used by other template functions, where any assignment is required, but no value is forthcoming (for example, if deserialization failed, or an expected value is somehow missing). This is intended to be similar to the "default" keyword in C#.
void Utility::FakeFileChange | ( | StringSection< char > | directoryName, |
StringSection< char > | filename | ||
) |
Executed all on-change callbacks associated with file
This will create a fake change event for a file, and execute any attached callbacks.
templ MovePTRHelper<T> Utility::moveptr | ( | T * | p | ) |
Utility for initialising an intrusive_ptr with move semantics
Sometimes we want to "move" a raw pointer into an intrusive pointer. For example, imagine we have a raw pointer to an object, and that object already has a reference count related to that raw pointer. We might want to construct an intrusive_ptr without taking a new reference. We can use moveptr to do that.
This happens sometimes when using 3rd party code. For example, using D3D, we often construct an object using a device method. The object is returned in raw pointer with an initial reference count already allocated. We want to "move" that raw pointer into an intrusive_ptr, without any extra AddRef/Release calls.
Override intrusive_ptr_add_ref and intrusive_ptr_release to change the method of reference management for specific classes. By default, they will attempt to use the COM style method names of "AddRef" and "Release".
Note – there is no implicit conversion from instrusive_ptr<T> -> T* this is following the pattern of std::shared_ptr, etc use the get() method
void Utility::TerminateFileSystemMonitoring | ( | ) |
Shut down all file system monitoring
Intended to be called on application shutdown, this frees all resources used by file system monitoring.