Tkrzw
Classes | Typedefs | Functions | Variables
tkrzw Namespace Reference

Common namespace of Tkrzw. More...

Classes

class  Compressor
 Interfrace of data compression and decompression. More...
 
class  DummyCompressor
 Dummy compressor implemetation. More...
 
class  ZLibCompressor
 Compressor implemeted with ZLib. More...
 
class  ZStdCompressor
 Compressor implemeted with ZStd. More...
 
class  LZ4Compressor
 Compressor implemeted with LZ4. More...
 
class  LZMACompressor
 Compressor implemeted with LZMA. More...
 
class  RC4Compressor
 Compressor implemeted with RC4 encryption. More...
 
class  AESCompressor
 Compressor implemeted with AES encryption. More...
 
class  LinkedHashMap
 Doubly-linked hash map. More...
 
class  LRUCache
 LRU cache. More...
 
class  DoubleLRUCache
 Double-layered LRU cache. More...
 
class  AtomicSet
 Thread-safe wrapper of std::set. More...
 
class  DBM
 Interface of database manager. More...
 
class  AsyncDBM
 Asynchronous database manager adapter. More...
 
class  StatusFuture
 Wrapper of std::future containing a status object and extra data. More...
 
class  BabyDBM
 On-memory database manager implementation based on B+ tree. More...
 
class  CacheDBM
 On-memory database manager implementation with LRU deletion. More...
 
class  HashDBM
 File database manager implementation based on hash table. More...
 
class  HashRecord
 Key and value record structure in the file hash database. More...
 
class  OffsetReader
 Reader of a sequence of offsets. More...
 
struct  FreeBlock
 Free block structure. More...
 
class  FreeBlockPool
 Registry of free blocks. More...
 
class  ParamDBM
 Parametric database manager interface. More...
 
class  PolyDBM
 Polymorphic database manager adapter. More...
 
class  ShardDBM
 Sharding database manager adapter. More...
 
class  SkipDBM
 File database manager implementation based on skip list. More...
 
class  SkipRecord
 Key and value record structure in the file skip database. More...
 
class  SkipRecordCache
 Cache of skip records. More...
 
class  RecordSorter
 Sorter for a large amound of records based on merge sort on files. More...
 
class  StdHashDBM
 On-memory database manager implemented with std::unordered_map. More...
 
class  StdTreeDBM
 On-memory database manager implemented with std::map. More...
 
class  TinyDBM
 On-memory database manager implementation based on hash table. More...
 
class  TreeDBM
 File database manager implementation based on B+ tree. More...
 
struct  TreeRecord
 Key and value record structure in the file tree database. More...
 
struct  TreeRecordOnStack
 Holder of TreeRecord on stack for search. More...
 
struct  TreeRecordComparator
 Comparator for TreeRecord objects. More...
 
struct  TreeLink
 Link to a child node. More...
 
struct  TreeLinkOnStack
 Holder of TreeLink on stack for search. More...
 
struct  TreeLinkComparator
 Comparator for TreeLink objects. More...
 
class  DBMUpdateLoggerStrDeque
 DBM update logger to store logs into a string deque. More...
 
class  DBMUpdateLoggerDBM
 DBM update logger to replicate updates in another DBM. More...
 
class  DBMUpdateLoggerSecondShard
 Update logger adapter for the second shard and later. More...
 
class  DBMUpdateLoggerMQ
 DBM update logger with a message queue. More...
 
class  File
 Interface of file operations. More...
 
class  MemoryMapFile
 Interface for memory mapping file implementations. More...
 
class  MemoryMapParallelFile
 File implementation by memory mapping and locking for parallel operations. More...
 
class  MemoryMapAtomicFile
 File implementation by memory mapping and locking for atomic operations. More...
 
class  PolyFile
 Polymorphic file adapter. More...
 
class  PositionalFile
 Interface for positional access file implementations. More...
 
class  PositionalParallelFile
 File implementation by positional access and locking for parallel operations. More...
 
class  PositionalAtomicFile
 File implementation with positional access and locking for atomic operations. More...
 
class  StdFile
 File implementation with the std::fstream. More...
 
struct  FileStatus
 Status information of a file. More...
 
class  TemporaryDirectory
 Temporary directory whose life duration is bound with the object. More...
 
class  PageCache
 Page cache for buffering I/O operations. More...
 
class  FileReader
 File reader. More...
 
class  FlatRecord
 Flat record structure in the file. More...
 
class  FlatRecordReader
 Reader of flat records. More...
 
class  FileIndex
 File secondary index implementation with TreeDBM. More...
 
class  MemIndex
 On-memory secondary index implementation with BabyDBM. More...
 
class  StdIndex
 On-memory secondary index implementation with std::map for generic types. More...
 
class  StdIndexStr
 On-memory secondary index implementation with std::map for strings. More...
 
class  Status
 Status of operations. More...
 
class  StatusException
 Exception to convey the status of operations. More...
 
class  Logger
 Interface for logging operations. More...
 
class  BaseLogger
 Base implementation for logging operations. More...
 
class  StreamLogger
 Stream implementation for logging operations. More...
 
class  MessageQueue
 Message queue on the file stream. More...
 
class  ScopedStringView
 Wrapper of string_view of allocated memory. More...
 
class  SpinMutex
 Spin lock mutex. More...
 
class  SpinSharedMutex
 Spin lock shared mutex. More...
 
class  SpinWPSharedMutex
 Spin lock shared mutex, with write-preferring policy. More...
 
class  SlottedMutex
 Slotted shared mutex. More...
 
class  ScopedSlottedLock
 Scoped lock with a slotted shared mutex. More...
 
class  HashMutex
 Mutex for a hash table. More...
 
class  ScopedHashLock
 Scoped lock with a mutex for a hash table. More...
 
class  ScopedHashLockMulti
 Scoped lock with multiple mutexes for a hash table. More...
 
class  TaskQueue
 Task queue with a thread pool. More...
 
class  WaitCounter
 Wait counter for monitoring other threads. More...
 
class  SignalBroker
 Broker to send a signal to another thread. More...
 
class  KeySignalBroker
 Broker to send a signal associated with a key to another thread. More...
 
class  SlottedKeySignalBroker
 Slotted broker to send a signal associated with a key to another thread. More...
 
class  ScopedCounter
 Scoped counter for auto increment and decrement. More...
 

Typedefs

typedef int32_t(* KeyComparator) (std::string_view, std::string_view)
 Interfrace of comparator of record keys. More...
 

Functions

void Print ()
 Prints an empty string to the stdout and flush the buffer. More...
 
template<typename FIRST , typename... REST>
void Print (const FIRST &first, const REST &... rest)
 Prints strings to the stdout and flush the buffer. More...
 
void PrintL ()
 Prints an empty string and a line feed to the stdout and flush the buffer. More...
 
template<typename FIRST , typename... REST>
void PrintL (const FIRST &first, const REST &... rest)
 Prints strings and a line feed to the stdout and flush the buffer. More...
 
void PrintF (const char *format,...)
 Prints a formatted string to the stdout and flush the buffer. More...
 
void PutChar (char c)
 Prints a character to the stdout and flush the buffer. More...
 
void EPrint ()
 Prints an empty string to the stderr and flush the buffer. More...
 
template<typename FIRST , typename... REST>
void EPrint (const FIRST &first, const REST &... rest)
 Prints strings to the stderr and flush the buffer. More...
 
void EPrintL ()
 Prints an empty string and a line feed to the stderr and flush the buffer. More...
 
template<typename FIRST , typename... REST>
void EPrintL (const FIRST &first, const REST &... rest)
 Prints strings and a line feed to the stderr and flush the buffer. More...
 
void EPrintF (const char *format,...)
 Prints a formatted string to the stderr and flush the buffer. More...
 
void EPutChar (char c)
 Prints a character to the stderr and flush the buffer. More...
 
bool ParseCommandArguments (int32_t argc, const char **argv, const std::map< std::string, int32_t > &configs, std::map< std::string, std::vector< std::string >> *result, std::string *error_message)
 Parses command line arguments. More...
 
std::string GetStringArgument (const std::map< std::string, std::vector< std::string >> &args, const std::string &name, int32_t index, const std::string &default_value)
 Gets a string argument of parsed command arguments. More...
 
int64_t GetIntegerArgument (const std::map< std::string, std::vector< std::string >> &args, const std::string &name, int32_t index, int64_t default_value)
 Gets an integer argument of parsed command arguments. More...
 
double GetDoubleArgument (const std::map< std::string, std::vector< std::string >> &args, const std::string &name, int32_t index, double default_value)
 Gets a real number argument of parsed command arguments. More...
 
void Die (const std::string &message)
 Throws an exception of StatusException to terminates the process with a message. More...
 
template<typename FIRST , typename... REST>
void Die (const FIRST &first, const REST &... rest)
 Throws an exception of StatusException to terminates the process with a message. More...
 
std::unique_ptr< FileMakeFileOrDie (const std::string &impl_name, int64_t alloc_init_size, double alloc_inc_factor)
 Makes a file object or die. More...
 
void SetAccessStrategyOrDie (File *file, int64_t block_size, bool is_direct_io, bool is_sync_io, bool is_padding, bool is_pagecache)
 Sets access strategy of the positional access file. More...
 
void SetHeadBufferOfFileOrDie (File *file, int64_t size)
 Sets the head buffer of the positional access file. More...
 
void PrintDBMRecordsInTSV (DBM *dbm)
 Prints all records of a DBM in TSV format. More...
 
std::string MakeCyclishText (size_t size, int32_t seed)
 Makes a text whose characters appear in a cyclic pattern. More...
 
std::string MakeNaturalishText (size_t size, int32_t seed)
 Makes a text whose character distribution is sililar to natural Englsh. More...
 
template<typename C , typename T >
void HeapByCostAdd (const C &cost, const T &payload, size_t capacity, std::vector< std::pair< C, T >> *heap)
 Adds a pair of a cont and a payload to a heap vector. More...
 
template<typename C , typename T >
void HeapByCostFinish (std::vector< std::pair< C, T >> *heap)
 Finishes a heap vector to be in sorted order. More...
 
uint64_t PrimaryHash (std::string_view data, uint64_t num_buckets)
 Primary hash function for the hash database. More...
 
uint64_t SecondaryHash (std::string_view data, uint64_t num_shards)
 Secondary hash function for sharding. More...
 
uint64_t IsPrimeNumber (uint64_t num)
 Returns true if an integer is a prime number. More...
 
int64_t GetHashBucketSize (int64_t min_size)
 Gets a proper bucket size for hashing. More...
 
Status SearchDBM (DBM *dbm, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0, bool(*matcher)(std::string_view, std::string_view)=StrContains)
 Searches a database and get keys which match a pattern. More...
 
Status SearchDBMLambda (DBM *dbm, std::function< bool(std::string_view)> matcher, std::vector< std::string > *matched, size_t capacity=0)
 Searches a database and get keys which match a lambda function. More...
 
Status SearchDBMOrder (DBM *dbm, std::string_view pattern, bool upper, bool inclusive, std::vector< std::string > *matched, size_t capacity=0)
 Searches an ordered database and get keys which match a boundary condition. More...
 
Status SearchDBMForwardMatch (DBM *dbm, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a database and get keys which begin with a pattern. More...
 
Status SearchDBMRegex (DBM *dbm, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a database and get keys which match a regular expression. More...
 
Status SearchDBMEditDistance (DBM *dbm, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a database and get keys whose edit distance with a UTF-8 pattern is the least. More...
 
Status SearchDBMEditDistanceBinary (DBM *dbm, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a database and get keys whose edit distance with a binary pattern is the least. More...
 
Status SearchDBMModal (DBM *dbm, std::string_view mode, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a database and get keys which match a pattern, according to a mode expression. More...
 
Status ExportDBMToFlatRecords (DBM *dbm, File *dest_file)
 Exports all records of a database to a flat record file. More...
 
Status ImportDBMFromFlatRecords (DBM *dbm, File *src_file)
 Imports records to a database from a flat record file. More...
 
Status ExportDBMKeysToFlatRecords (DBM *dbm, File *dest_file)
 Exports the keys of all records of a database to a flat record file. More...
 
Status ExportDBMToTSV (DBM *dbm, File *dest_file, bool escape=false)
 Exports all records of a database to a TSV file. More...
 
Status ImportDBMFromTSV (DBM *dbm, File *dest_file, bool unescape=false)
 Imports records to a database from a TSV file. More...
 
Status ExportDBMKeysAsLines (DBM *dbm, File *dest_file)
 Exports the keys of all records of a database as lines to a text file. More...
 
Status SearchTextFile (File *file, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0, bool(*matcher)(std::string_view, std::string_view)=StrContains)
 Searches a text file and get lines which match a pattern. More...
 
Status SearchTextFileLambda (File *file, std::function< bool(std::string_view)> matcher, std::vector< std::string > *matched, size_t capacity=0)
 Searches a text file and get lines which match a lambda function. More...
 
Status SearchTextFileRegex (File *file, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a text file and get lines which match a regular expression. More...
 
Status SearchTextFileEditDistance (File *file, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a text file and get lines whose edit distance with a UTF-8 pattern is the least. More...
 
Status SearchTextFileEditDistanceBinary (File *file, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a text file and get lines whose edit distance with a binary pattern is the least. More...
 
Status SearchTextFileModal (File *file, std::string_view mode, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a text file and get lines which match a pattern, according to a mode expression. More...
 
uint32_t MagicChecksum (const char *key_buf, size_t key_size, const char *value_buf, size_t value_size)
 Calculates the checksum of the record data to store in the record magic data. More...
 
std::string_view CallRecordProcessFull (DBM::RecordProcessor *proc, std::string_view key, std::string_view old_value, std::string_view *new_value_orig, Compressor *compressor, ScopedStringView *comp_data_placeholder)
 Calls the ProcessFull method of a record processor with compression and decompression. More...
 
std::string_view CallRecordProcessEmpty (DBM::RecordProcessor *proc, std::string_view key, std::string_view *new_value_orig, Compressor *compressor, ScopedStringView *comp_data_placeholder)
 Calls the ProcessEmpty method of a record processor with compression. More...
 
TreeRecordCreateTreeRecord (std::string_view key, std::string_view value)
 Creates a tree record. More...
 
TreeRecordModifyTreeRecord (TreeRecord *record, std::string_view new_value)
 Modifies the value of a tree record. More...
 
void FreeTreeRecord (TreeRecord *record)
 Frees the region of a tree record. More...
 
void FreeTreeRecords (std::vector< TreeRecord * > *records)
 Frees the regions of tree records. More...
 
TreeLinkCreateTreeLink (std::string_view key, int64_t child)
 Creates a tree link. More...
 
void FreeTreeLink (TreeLink *link)
 Frees the region of a tree link. More...
 
void FreeTreeLinks (std::vector< TreeLink * > *links)
 Frees the regions of tree links. More...
 
std::string MakeTemporaryName ()
 Makes a unique name for a temporary file. More...
 
std::string JoinPath (const std::string &base_path, const std::string &child_name)
 Joins a base path and a child name. More...
 
std::string NormalizePath (const std::string &path)
 Normalizes a file path. More...
 
std::string PathToBaseName (const std::string &path)
 Gets the base name part of a path. More...
 
std::string PathToDirectoryName (const std::string &path)
 Gets the directory name part of a path. More...
 
std::string PathToExtension (const std::string &path)
 Gets the extention part of a path. More...
 
Status GetRealPath (const std::string &path, std::string *real_path)
 Gets the normalized and canonical form of a path. More...
 
Status ReadFileStatus (const std::string &path, FileStatus *fstats)
 Reads status information of a file. More...
 
bool PathIsFile (const std::string &path)
 Checks if a path indicates a regular file. More...
 
int64_t GetFileSize (const std::string &path)
 Gets the size of a file. More...
 
bool PathIsDirectory (const std::string &path)
 Checks if a path indicates a directory. More...
 
std::string GetPathToTemporaryDirectory ()
 Gets the path to a directory for temporary files. More...
 
Status WriteFile (const std::string &path, std::string_view content)
 Writes a file with a content. More...
 
Status WriteFileAtomic (const std::string &path, std::string_view content, const std::string &tmp_path="")
 Writes a file with a content, in an atomic manner by file renaming. More...
 
Status ReadFile (const std::string &path, std::string *content, int64_t max_size=INT32MAX)
 Reads the content from a file. More...
 
std::string ReadFileSimple (const std::string &path, std::string_view default_value="", int64_t max_size=INT32MAX)
 Reads the content from a file, in a simple way. More...
 
Status TruncateFile (const std::string &path, int64_t size)
 Truncates a file. More...
 
Status RemoveFile (const std::string &path)
 Removes a file. More...
 
Status RenameFile (const std::string &src_path, const std::string &dest_path)
 Renames a file. More...
 
Status CopyFileData (const std::string &src_path, const std::string &dest_path)
 Copies the data of a file. More...
 
Status ReadDirectory (const std::string &path, std::vector< std::string > *children)
 Reads a directory. More...
 
Status MakeDirectory (const std::string &path, bool recursive=false)
 Makes a directory. More...
 
Status RemoveDirectory (const std::string &path, bool recursive=false)
 Removes a directory. More...
 
Status SynchronizeFile (const std::string &path)
 Synchronizes a file or a directory. More...
 
uint64_t HashMurmur (const void *buf, size_t size, uint64_t seed)
 Gets the hash value by Murmur hashing. More...
 
uint64_t HashMurmur (std::string_view str, uint64_t seed)
 Gets the hash value by Murmur hashing. More...
 
uint64_t HashFNV (const void *buf, size_t size)
 Gets the hash value by FNV hashing. More...
 
uint64_t HashFNV (std::string_view str)
 Gets the hash value by FNV hashing. More...
 
uint32_t HashChecksum6Continuous (const void *buf, size_t size, bool finish, uint32_t seed=0)
 Gets the hash value by Checksum-6, in a continuous way. More...
 
uint32_t HashChecksum6 (const void *buf, size_t size)
 Gets the hash value by Checksum-6. More...
 
uint32_t HashChecksum6 (std::string_view str)
 Gets the hash value by Checksum-6. More...
 
uint32_t HashChecksum6Pair (const void *first_buf, size_t first_size, const void *second_buf, size_t second_size, uint32_t seed=0)
 Gets the hash value by Checksum-6. More...
 
uint32_t HashChecksum8Continuous (const void *buf, size_t size, bool finish, uint32_t seed=0)
 Gets the hash value by checksum-8, in a continuous way. More...
 
uint32_t HashChecksum8 (const void *buf, size_t size)
 Gets the hash value by checksum-8. More...
 
uint32_t HashChecksum8 (std::string_view str)
 Gets the hash value by checksum-8. More...
 
uint32_t HashChecksum8Pair (const void *first_buf, size_t first_size, const void *second_buf, size_t second_size, uint32_t seed=0)
 Gets the hash value by Checksum-8. More...
 
uint32_t HashAdler6Continuous (const void *buf, size_t size, bool finish, uint32_t seed=1)
 Gets the hash value by Adler-6, in a continuous way. More...
 
uint32_t HashAdler6 (const void *buf, size_t size)
 Gets the hash value by Adler-6. More...
 
uint32_t HashAdler6 (std::string_view str)
 Gets the hash value by Adler-6. More...
 
uint32_t HashAdler8Continuous (const void *buf, size_t size, bool finish, uint32_t seed=1)
 Gets the hash value by adler-8, in a continuous way. More...
 
uint32_t HashAdler8 (const void *buf, size_t size)
 Gets the hash value by adler-8. More...
 
uint32_t HashAdler8 (std::string_view str)
 Gets the hash value by adler-8. More...
 
uint32_t HashAdler16Continuous (const void *buf, size_t size, bool finish, uint32_t seed=1)
 Gets the hash value by Adler-16, in a continuous way. More...
 
uint32_t HashAdler16 (const void *buf, size_t size)
 Gets the hash value by Adler-16. More...
 
uint32_t HashAdler16 (std::string_view str)
 Gets the hash value by Adler-16. More...
 
uint32_t HashAdler32Continuous (const void *buf, size_t size, bool finish, uint32_t seed=1)
 Gets the hash value by Adler-32, in a continuous way. More...
 
uint32_t HashAdler32 (const void *buf, size_t size)
 Gets the hash value by Adler-32. More...
 
uint32_t HashAdler32 (std::string_view str)
 Gets the hash value by Adler-32. More...
 
uint32_t HashCRC4Continuous (const void *buf, size_t size, bool finish, uint32_t seed=0)
 Gets the hash value by CRC-4, in a continuous way. More...
 
uint32_t HashCRC4 (const void *buf, size_t size)
 Gets the hash value by CRC-4. More...
 
uint32_t HashCRC4 (std::string_view str)
 Gets the hash value by CRC-4. More...
 
uint32_t HashCRC8Continuous (const void *buf, size_t size, bool finish, uint32_t seed=0)
 Gets the hash value by CRC-8, in a continuous way. More...
 
uint32_t HashCRC8 (const void *buf, size_t size)
 Gets the hash value by CRC-8. More...
 
uint32_t HashCRC8 (std::string_view str)
 Gets the hash value by CRC-8. More...
 
uint32_t HashCRC16Continuous (const void *buf, size_t size, bool finish, uint32_t seed=0)
 Gets the hash value by CRC-16, in a continuous way. More...
 
uint32_t HashCRC16 (const void *buf, size_t size)
 Gets the hash value by CRC-16. More...
 
uint32_t HashCRC16 (std::string_view str)
 Gets the hash value by CRC-16. More...
 
uint32_t HashCRC32Continuous (const void *buf, size_t size, bool finish, uint32_t seed=0xFFFFFFFF)
 Gets the hash value by CRC-32, in a continuous way. More...
 
uint32_t HashCRC32 (const void *buf, size_t size)
 Gets the hash value by CRC-32. More...
 
uint32_t HashCRC32 (std::string_view str)
 Gets the hash value by CRC-32. More...
 
int32_t LexicalKeyComparator (std::string_view a, std::string_view b)
 Key comparator in the lexical order. More...
 
int32_t LexicalCaseKeyComparator (std::string_view a, std::string_view b)
 Key comparator in the lexical order ignoring case. More...
 
int32_t DecimalKeyComparator (std::string_view a, std::string_view b)
 Key comparator in the order of the decimal integer numeric expressions. More...
 
int32_t HexadecimalKeyComparator (std::string_view a, std::string_view b)
 Key comparator in the order of the hexadecimal integer numeric expressions. More...
 
int32_t RealNumberKeyComparator (std::string_view a, std::string_view b)
 Key comparator in the order of the decimal real number expressions. More...
 
int32_t PairLexicalKeyComparator (std::string_view a, std::string_view b)
 Key comparator for serialized pair strings in the lexical order. More...
 
int32_t PairLexicalCaseKeyComparator (std::string_view a, std::string_view b)
 Key comparator for serialized pair strings in the lexical order ignoring case. More...
 
int32_t PairDecimalKeyComparator (std::string_view a, std::string_view b)
 Key comparator for serialized pair strings in the decimal integer order. More...
 
int32_t PairHexadecimalKeyComparator (std::string_view a, std::string_view b)
 Key comparator for serialized pair strings in the hexadecimal integer order. More...
 
int32_t PairRealNumberKeyComparator (std::string_view a, std::string_view b)
 Key comparator for serialized pair strings in the decimal real number order. More...
 
void * xmalloc (size_t size)
 Allocates a region on memory. More...
 
void * xcalloc (size_t nmemb, size_t size)
 Allocates a nullified region on memory. More...
 
void * xrealloc (void *ptr, size_t size)
 Re-allocates a region on memory. More...
 
void * xreallocappend (void *ptr, size_t size)
 Re-allocates a region on memory for appending operations. More...
 
void xfree (void *ptr)
 Frees a region on memory. More...
 
void * xmallocaligned (size_t alignment, size_t size)
 Allocates an aligned region on memory. More...
 
void xfreealigned (void *ptr)
 Frees an aligned region on memory. More...
 
template<typename SET >
bool CheckSet (SET set, const typename SET::key_type &elem)
 Checks whether a set has an element. More...
 
template<typename MAP >
bool CheckMap (MAP map, const typename MAP::key_type &key)
 Checks whether a map has a key. More...
 
template<typename MAP >
MAP::value_type::second_type SearchMap (MAP map, const typename MAP::key_type &key, const typename MAP::value_type::second_type &default_value)
 Searches a map and get the value of a record. More...
 
int64_t GetProcessID ()
 Gets the current processs ID. More...
 
std::map< std::string, std::string > GetSystemInfo ()
 Gets system information of the environment. More...
 
int64_t GetMemoryCapacity ()
 Gets the memory capacity of the platform. More...
 
int64_t GetMemoryUsage ()
 Gets the current memory usage of the process. More...
 
bool operator== (const Status::Code &lhs, const Status &rhs)
 Checks whether a status code is equal to another status object. More...
 
bool operator!= (const Status::Code &lhs, const Status &rhs)
 Checks whether a status code is not equal to another status object. More...
 
std::string ToString (const Status &status)
 Converts a status into a string. More...
 
std::ostream & operator<< (std::ostream &os, const Status &status)
 Outputs a status string into an output stream. More...
 
Status GetErrnoStatus (const char *call_name, int32_t sys_err_num)
 Gets a status according to a system error number of a system call. More...
 
int64_t StrToInt (std::string_view str, int64_t defval=0)
 Converts a decimal string to an integer. More...
 
int64_t StrToIntMetric (std::string_view str, int64_t defval=0)
 Converts a decimal string with a metric prefix to an integer. More...
 
uint64_t StrToIntOct (std::string_view str, uint64_t defval=0)
 Converts a octal string to an integer. More...
 
uint64_t StrToIntHex (std::string_view str, uint64_t defval=0)
 Converts a hexadecimal string to an integer. More...
 
uint64_t StrToIntBigEndian (std::string_view str)
 Converts a big-endian binary string to an integer. More...
 
double StrToDouble (std::string_view str, double defval=0.0)
 Converts a decimal string to a real number. More...
 
bool StrToBool (std::string_view str, bool defval=false)
 Converts a boolean string to a boolean value. More...
 
int64_t StrToIntOrBool (std::string_view str, int64_t defval=0)
 Converts a decimal or boolean string to an integer or boolean value. More...
 
void VSPrintF (std::string *dest, const char *format, va_list ap)
 Appends a formatted string at the end of a string. More...
 
void SPrintF (std::string *dest, const char *format,...)
 Appends a formatted string at the end of a string. More...
 
std::string SPrintF (const char *format,...)
 Generates a formatted string. More...
 
template<typename T >
std::string ToString (T data)
 Converts an integer to a decimal string. More...
 
std::string ToString (double data)
 Converts a real number to a decimal string. More...
 
std::string ToString (float data)
 Converts a real number to a decimal string. More...
 
std::string ToString (long double data)
 Converts a real number to a decimal string. More...
 
std::string ToString (bool data)
 Converts a boolean value to a decimal string. More...
 
std::string ToString (char data)
 Converts a character into a string. More...
 
std::string ToString (const char *data)
 Converts a C-style string into a string. More...
 
std::string ToString (std::string_view data)
 Converts a string view into a string. More...
 
std::string ToString (const std::string &data)
 Copies a string. More...
 
std::string IntToStrBigEndian (uint64_t data, size_t size=sizeof(uint64_t))
 Converts an integer into a big-endian binary string. More...
 
template<typename T >
std::string StrJoin (const T &elems, const std::string_view &delim)
 Converts each record of a container into strings and join them. More...
 
std::string StrCat ()
 Returns an empty string. More...
 
template<typename FIRST , typename... REST>
std::string StrCat (const FIRST &first, const REST &... rest)
 Concatenates data of arbitrary parameters into a string. More...
 
std::vector< std::string > StrSplit (std::string_view str, char delim, bool skip_empty=false)
 Splits a string with a delimiter character. More...
 
std::vector< std::string > StrSplit (std::string_view str, std::string_view delim, bool skip_empty=false)
 Splits a string with a delimiter string. More...
 
std::vector< std::string > StrSplitAny (std::string_view str, std::string_view delims, bool skip_empty=false)
 Splits a string with delimiter characters. More...
 
std::map< std::string, std::string > StrSplitIntoMap (std::string_view str, std::string_view delim_records, std::string_view delim_kv)
 Splits a string into a key-value map. More...
 
std::string StrUpperCase (std::string_view str)
 Converts letters of a string into upper case. More...
 
void StrUpperCase (std::string *str)
 Converts letters of a string into upper case in-place. More...
 
std::string StrLowerCase (std::string_view str)
 Converts letters of a string into lower case. More...
 
void StrLowerCase (std::string *str)
 Converts letters of a string into lower case in-place. More...
 
std::string StrReplace (std::string_view str, std::string_view before, std::string_view after)
 Converts a string by replacing substrings to diffent substrings. More...
 
void StrReplaceCharacters (std::string *str, std::string_view before, std::string_view after)
 Modifies a string by replacing characters to diffent characters in-place. More...
 
bool StrContains (std::string_view text, std::string_view pattern)
 Checks whether a text contains a pattern. More...
 
bool StrCaseContains (std::string_view text, std::string_view pattern)
 Checks whether a text contains a pattern in a case-insensitive manner. More...
 
bool StrWordContains (std::string_view text, std::string_view pattern)
 Checks whether a text contains a word surrounded by non-alphanumeric word boundaries. More...
 
bool StrCaseWordContains (std::string_view text, std::string_view pattern)
 Checks whether a text contains a word in a case-sensitive manner. More...
 
bool StrContainsBatch (std::string_view text, const std::vector< std::string > &patterns)
 Checks a text contains at least one of patterns. More...
 
bool StrCaseContainsBatch (std::string_view text, const std::vector< std::string > &patterns)
 Checks a text contains at least one of patterns in a case-sensitive manner. More...
 
bool StrWordContainsBatch (std::string_view text, const std::vector< std::string > &patterns)
 Checks a text contains at least one of words surrounded by non-alphanumeric word boundaries. More...
 
bool StrCaseWordContainsBatch (std::string_view text, const std::vector< std::string > &patterns)
 Checks a text contains at least one of words in a case-sensitive manner. More...
 
bool StrCaseWordContainsBatchLower (std::string_view text, const std::vector< std::string > &patterns)
 Checks a text contains at least one of lowercase words in a case-sensitive manner. More...
 
bool StrBeginsWith (std::string_view text, std::string_view pattern)
 Checks whether a text begins with a pattern. More...
 
bool StrEndsWith (std::string_view text, std::string_view pattern)
 Checks whether a text ends with a pattern. More...
 
int32_t StrCaseCompare (std::string_view a, std::string_view b)
 Compares two strings ignoring case. More...
 
int32_t StrSearch (std::string_view text, std::string_view pattern)
 Searches a text for a pattern, with string::find. More...
 
int32_t StrSearchDoubleLoop (std::string_view text, std::string_view pattern)
 Searches a text for a pattern, by naive double loop. More...
 
int32_t StrSearchMemchr (std::string_view text, std::string_view pattern)
 Searches a text for a pattern, with memchr. More...
 
int32_t StrSearchMemmem (std::string_view text, std::string_view pattern)
 Searches a text for a pattern, with memmem. More...
 
int32_t StrSearchKMP (std::string_view text, std::string_view pattern)
 Searches a text for a pattern, by Knuth-Morris-Pratt algorithm. More...
 
int32_t StrSearchBM (std::string_view text, std::string_view pattern)
 Searches a text for a pattern, by Boyer-Moore algorithm. More...
 
int32_t StrSearchRK (std::string_view text, std::string_view pattern)
 Searches a text for a pattern, by Rabin-Karp algorithm. More...
 
int32_t StrSearchZ (std::string_view text, std::string_view pattern)
 Searches a text for a pattern, by Z algorithm. More...
 
std::vector< int32_t > StrSearchWhole (std::string_view text, std::string_view pattern, size_t max_results=0)
 Searches a text for a pattern and get indices of all occurrences, with string::find. More...
 
std::vector< int32_t > StrSearchWholeKMP (std::string_view text, std::string_view pattern, size_t max_results=0)
 Searches a text for a pattern and get indices of all occurrences, by KMP algorithm. More...
 
std::vector< int32_t > StrSearchWholeBM (std::string_view text, std::string_view pattern, size_t max_results=0)
 Searches a text for a pattern and get indices of all occurrences, by BM algorithm. More...
 
std::vector< int32_t > StrSearchWholeRK (std::string_view text, std::string_view pattern, size_t max_results=0)
 Searches a text for a pattern and get indices of all occurrences, by RK algorithm. More...
 
std::vector< std::vector< int32_t > > StrSearchBatch (std::string_view text, const std::vector< std::string > &patterns, size_t max_results=0)
 Searches a text for patterns and get indices of all occurrences, by string::find. More...
 
std::vector< std::vector< int32_t > > StrSearchBatchKMP (std::string_view text, const std::vector< std::string > &patterns, size_t max_results=0)
 Searches a text for patterns and get indices of all occurrences, by KMP algorithm. More...
 
std::vector< std::vector< int32_t > > StrSearchBatchBM (std::string_view text, const std::vector< std::string > &patterns, size_t max_results=0)
 Searches a text for patterns and get indices of all occurrences, by BM algorithm. More...
 
std::vector< std::vector< int32_t > > StrSearchBatchRK (std::string_view text, const std::vector< std::string > &patterns, size_t max_results=0)
 Searches a text for patterns and get indices of all occurrences, by RK algorithm. More...
 
int32_t StrCaseSearch (std::string_view text, std::string_view pattern)
 Searches a text for a pattern in a case-insensitive manner. More...
 
int32_t StrWordSearch (std::string_view text, std::string_view pattern)
 Searches a text for a word surrounded by non-alphanumeric word boundaries. More...
 
int32_t StrCaseWordSearch (std::string_view text, std::string_view pattern)
 Searches a text for a word surrounded in a case-insensitive manner. More...
 
std::string StrStripSpace (std::string_view str)
 Removes space characters at the head or the tail of a string. More...
 
std::string StrStripLine (std::string_view str)
 Removes linefeed characters from the end of a string. More...
 
void StrStripLine (std::string *str)
 Remove linefeed characters from the end of a string in-place. More...
 
std::string StrSqueezeAndStripSpace (std::string_view str)
 Squeezes space characters in a string and removes spaces at both ends. More...
 
std::string StrTrimForTSV (std::string_view str, bool keep_tab=false)
 Trims a string for TSV by normalizing space and control characters. More...
 
std::string StrEscapeC (std::string_view str, bool esc_nonasc=false)
 Escapes C-style meta characters in a string. More...
 
std::string StrUnescapeC (std::string_view str)
 Unescapes C-style escape sequences in a string. More...
 
std::string StrEncodeBase64 (std::string_view str)
 Encodes a string into a Base64 string. More...
 
std::string StrDecodeBase64 (std::string_view str)
 Decodes a Base64 string into a string. More...
 
std::string StrEncodeURL (std::string_view str)
 Encodes a string into a URL part string. More...
 
std::string StrDecodeURL (std::string_view str)
 Decodes a URL part string into a string. More...
 
int32_t StrSearchRegex (std::string_view text, std::string_view pattern)
 Searches a string for a pattern matching a regular expression. More...
 
std::string StrReplaceRegex (std::string_view text, std::string_view pattern, std::string_view replace)
 Replaces substrings matching a pattern of regular expression. More...
 
std::vector< uint32_t > ConvertUTF8ToUCS4 (std::string_view utf)
 Converts a UTF-8 string into a UCS-4 vector. More...
 
std::string ConvertUCS4ToUTF8 (const std::vector< uint32_t > &ucs)
 Converts a UCS-4 vector into a UTF-8 string. More...
 
std::wstring ConvertUTF8ToWide (std::string_view utf)
 Converts a UTF-8 string into a wide string. More...
 
std::string ConvertWideToUTF8 (const std::wstring &wstr)
 Converts a wide string into a UTF-8 string. More...
 
std::string SerializeStrPair (std::string_view first, std::string_view second)
 Serializes a pair of strings into a string. More...
 
void DeserializeStrPair (std::string_view serialized, std::string_view *first, std::string_view *second)
 Deserializes a serialized string into a pair of strings. More...
 
std::string_view GetFirstFromSerializedStrPair (std::string_view serialized)
 Get the first part from a serialized string pair. More...
 
std::string SerializeStrVector (const std::vector< std::string > &values)
 Serializes a vector of strings into a string. More...
 
std::vector< std::string > DeserializeStrVector (std::string_view serialized)
 Deserializes a serialized string into a string vector. More...
 
std::vector< std::string > MakeStrVectorFromViews (const std::vector< std::string_view > &views)
 Makes a string vector from a string view vector. More...
 
std::vector< std::string_view > MakeStrViewVectorFromValues (const std::vector< std::string > &values)
 Makes a string view vector from a string vector. More...
 
std::string SerializeStrMap (const std::map< std::string, std::string > &records)
 Serializes a map of strings into a string. More...
 
std::map< std::string, std::string > DeserializeStrMap (std::string_view serialized)
 Deserializes a serialized string into a string map. More...
 
std::map< std::string, std::string > MakeStrMapFromViews (const std::map< std::string_view, std::string_view > &views)
 Makes a string map from a string view map. More...
 
std::map< std::string_view, std::string_view > MakeStrViewMapFromRecords (const std::map< std::string, std::string > &records)
 Makes a string view map from a string map. More...
 
void SleepThread (double sec)
 Sleeps the current thread. More...
 
double GetWallTime ()
 Gets the number of seconds since the UNIX epoch. More...
 
void GetLocalCalendar (int64_t wtime, struct std::tm *cal)
 Gets the local calendar of a time. More...
 
void GetUniversalCalendar (int64_t wtime, struct std::tm *cal)
 Gets the universal calendar of a time. More...
 
int64_t MakeUniversalTime (struct std::tm &cal)
 Makes the UNIX time from a universal calendar. More...
 
int32_t GetLocalTimeDifference (bool use_cache=false)
 Gets the time difference of the local time zone. More...
 
int32_t GetDayOfWeek (int32_t year, int32_t mon, int32_t day)
 Gets the day of week of a date. More...
 
size_t FormatDateSimple (char *result, int64_t wtime=INT64MIN, int32_t td=INT32MIN)
 Formats a date as a simple string in "YYYY/MM/DD hh:mm:ss" format. More...
 
size_t FormatDateSimpleWithFrac (char *result, double wtime=-1, int32_t td=INT32MIN, int32_t frac_cols=6)
 Formats a date as a simple string in "YYYY/MM/DD hh:mm:ss" format. More...
 
size_t FormatDateW3CDTF (char *result, int64_t wtime=INT64MIN, int32_t td=INT32MIN)
 Formats a date as a string in W3CDTF. More...
 
size_t FormatDateW3CDTFWithFrac (char *result, double wtime=-1, int32_t td=INT32MIN, int32_t frac_cols=6)
 Formats a date as a string in W3CDTF. More...
 
size_t FormatDateRFC1123 (char *result, int64_t wtime=INT64MIN, int32_t td=INT32MIN)
 Formats a date as a string in RFC 1123 format. More...
 
double ParseDateStr (std::string_view str)
 Parses a date string to get the time value since the UNIX epoch. More...
 
double ParseDateStrYYYYMMDD (std::string_view str, int32_t td=INT32MIN)
 Parses a date string in "YYYYMMDD" to get the time value since the UNIX epoch. More...
 
std::string MakeRelativeTimeExpr (double diff)
 Makes a human-readable relative time expression of a time difference. More...
 

Variables

const char DIR_SEP_CHR
 Directory separator character. More...
 
const char *const DIR_SEP_STR
 Directory separator string. More...
 
const char EXT_SEP_CHR
 Extension separator character. More...
 
const char *const EXT_SEP_STR
 Extension separator string. More...
 
const char *const CURRENT_DIR_NAME
 Current directory name. More...
 
const char *const PARENT_DIR_NAME
 Parent directory name. More...
 
constexpr int8_t INT8MIN = std::numeric_limits<int8_t>::min()
 Disable macros to avoid possible name confliction. More...
 
constexpr int8_t INT8MAX = std::numeric_limits<int8_t>::max()
 The maximum value of int8_t. More...
 
constexpr uint8_t UINT8MAX = std::numeric_limits<uint8_t>::max()
 The maximum value of uint8_t. More...
 
constexpr int16_t INT16MIN = std::numeric_limits<int16_t>::min()
 The minimum value of int16_t. More...
 
constexpr int16_t INT16MAX = std::numeric_limits<int16_t>::max()
 The maximum value of int16_t. More...
 
constexpr uint16_t UINT16MAX = std::numeric_limits<uint16_t>::max()
 The maximum value of uint16_t. More...
 
constexpr int32_t INT32MIN = std::numeric_limits<int32_t>::min()
 The minimum value of int32_t. More...
 
constexpr int32_t INT32MAX = std::numeric_limits<int32_t>::max()
 The maximum value of int32_t. More...
 
constexpr uint32_t UINT32MAX = std::numeric_limits<uint32_t>::max()
 The maximum value of uint32_t. More...
 
constexpr int64_t INT64MIN = std::numeric_limits<int64_t>::min()
 The minimum value of int64_t. More...
 
constexpr int64_t INT64MAX = std::numeric_limits<int64_t>::max()
 The maximum value of int64_t. More...
 
constexpr uint64_t UINT64MAX = std::numeric_limits<uint64_t>::max()
 The maximum value of uint64_t. More...
 
constexpr size_t SIZEMAX = std::numeric_limits<size_t>::max()
 The maximum value of size_t. More...
 
constexpr float FLOATMIN = std::numeric_limits<float>::min()
 The minimum value of float. More...
 
constexpr float FLOATMAX = std::numeric_limits<float>::max()
 The maximum value of float. More...
 
constexpr double DOUBLEMIN = std::numeric_limits<double>::min()
 The minimum value of double. More...
 
constexpr double DOUBLEMAX = std::numeric_limits<double>::max()
 The maximum value of double. More...
 
constexpr double DOUBLENAN = std::numeric_limits<double>::quiet_NaN()
 The quiet Not-a-Number value of double. More...
 
constexpr double DOUBLEINF = std::numeric_limits<double>::infinity()
 The positive infinity value of double. More...
 
constexpr int32_t NUM_BUFFER_SIZE = 32
 The buffer size for a numeric string expression. More...
 
constexpr int64_t MAX_MEMORY_SIZE = (1LL << 40)
 The maximum memory size. More...
 
const int32_t PAGE_SIZE
 The size of a memory page on the OS. More...
 
const char *const PACKAGE_VERSION
 The string expression of the package version. More...
 
const char *const LIBRARY_VERSION
 The string expression of the library version. More...
 
const char *const OS_NAME
 The recognized OS name. More...
 
const bool IS_POSIX
 True if the OS is conforming to POSIX. More...
 
const bool IS_BIG_ENDIAN
 True if the byte order is big endian. More...
 

Detailed Description

Common namespace of Tkrzw.

Typedef Documentation

◆ KeyComparator

typedef int32_t(* tkrzw::KeyComparator) (std::string_view, std::string_view)

Interfrace of comparator of record keys.

The fucntion returns -1 if the first parameter is less, 1 if the first parameter is greater, and 0 if both are equivalent.

Function Documentation

◆ Print() [1/2]

void tkrzw::Print ( )

Prints an empty string to the stdout and flush the buffer.

◆ Print() [2/2]

template<typename FIRST , typename... REST>
void tkrzw::Print ( const FIRST &  first,
const REST &...  rest 
)

Prints strings to the stdout and flush the buffer.

Parameters
firstThe first string.
restThe rest strings.

◆ PrintL() [1/2]

void tkrzw::PrintL ( )

Prints an empty string and a line feed to the stdout and flush the buffer.

◆ PrintL() [2/2]

template<typename FIRST , typename... REST>
void tkrzw::PrintL ( const FIRST &  first,
const REST &...  rest 
)

Prints strings and a line feed to the stdout and flush the buffer.

Parameters
firstThe first string.
restThe rest strings.

◆ PrintF()

void tkrzw::PrintF ( const char *  format,
  ... 
)

Prints a formatted string to the stdout and flush the buffer.

Parameters
formatThe format string.
...The other arguments.

◆ PutChar()

void tkrzw::PutChar ( char  c)

Prints a character to the stdout and flush the buffer.

Parameters
cThe character to print.

◆ EPrint() [1/2]

void tkrzw::EPrint ( )

Prints an empty string to the stderr and flush the buffer.

◆ EPrint() [2/2]

template<typename FIRST , typename... REST>
void tkrzw::EPrint ( const FIRST &  first,
const REST &...  rest 
)

Prints strings to the stderr and flush the buffer.

Parameters
firstThe first string.
restThe rest strings.

◆ EPrintL() [1/2]

void tkrzw::EPrintL ( )

Prints an empty string and a line feed to the stderr and flush the buffer.

◆ EPrintL() [2/2]

template<typename FIRST , typename... REST>
void tkrzw::EPrintL ( const FIRST &  first,
const REST &...  rest 
)

Prints strings and a line feed to the stderr and flush the buffer.

Parameters
firstThe first string.
restThe rest strings.

◆ EPrintF()

void tkrzw::EPrintF ( const char *  format,
  ... 
)

Prints a formatted string to the stderr and flush the buffer.

Parameters
formatThe format string.
...The other arguments.

◆ EPutChar()

void tkrzw::EPutChar ( char  c)

Prints a character to the stderr and flush the buffer.

Parameters
cThe character to print.

◆ ParseCommandArguments()

bool tkrzw::ParseCommandArguments ( int32_t  argc,
const char **  argv,
const std::map< std::string, int32_t > &  configs,
std::map< std::string, std::vector< std::string >> *  result,
std::string *  error_message 
)

Parses command line arguments.

Parameters
argcThe number of input arguments.
argvThe input arguments.
configsA map of option names and numbers of the required arguments. If an empty string represents positional arguments.
resultThe pointer to a map object to contain option names and their arguments.
error_messageThe pointer to a string object to contain the error message.
Returns
True on success or false on failure.

◆ GetStringArgument()

std::string tkrzw::GetStringArgument ( const std::map< std::string, std::vector< std::string >> &  args,
const std::string &  name,
int32_t  index,
const std::string &  default_value 
)

Gets a string argument of parsed command arguments.

Parameters
argsThe parsed command arguments.
nameThe name of the argument.
indexThe index of the value.
default_valueThe value to be returned on failure.
Returns
The value of the matching argument on success, or the default value on failure.

◆ GetIntegerArgument()

int64_t tkrzw::GetIntegerArgument ( const std::map< std::string, std::vector< std::string >> &  args,
const std::string &  name,
int32_t  index,
int64_t  default_value 
)

Gets an integer argument of parsed command arguments.

Parameters
argsThe parsed command arguments.
nameThe name of the argument.
indexThe index of the value.
default_valueThe value to be returned on failure.
Returns
The value of the matching argument on success, or the default value on failure.

◆ GetDoubleArgument()

double tkrzw::GetDoubleArgument ( const std::map< std::string, std::vector< std::string >> &  args,
const std::string &  name,
int32_t  index,
double  default_value 
)

Gets a real number argument of parsed command arguments.

Parameters
argsThe parsed command arguments.
nameThe name of the argument.
indexThe index of the value.
default_valueThe value to be returned on failure.
Returns
The value of the matching argument on success, or the default value on failure.

◆ Die() [1/2]

void tkrzw::Die ( const std::string &  message)

Throws an exception of StatusException to terminates the process with a message.

Parameters
messageThe message to print.

◆ Die() [2/2]

template<typename FIRST , typename... REST>
void tkrzw::Die ( const FIRST &  first,
const REST &...  rest 
)

Throws an exception of StatusException to terminates the process with a message.

Parameters
firstThe first parameter.
restThe rest parameters.

◆ MakeFileOrDie()

std::unique_ptr<File> tkrzw::MakeFileOrDie ( const std::string &  impl_name,
int64_t  alloc_init_size,
double  alloc_inc_factor 
)

Makes a file object or die.

Parameters
impl_nameThe name of a File implementation: "mmap-para" for MemoryMapParallelFile, "mmap-atom" for MemoryMapAtomicFile, "pos-para" for PositionalParallelFile. "pos-atom" fo PositionalAtomicFile,
alloc_init_sizeAn initial size of allocation.
alloc_inc_factorA factor to increase the size of allocation.
Returns
The created object.

◆ SetAccessStrategyOrDie()

void tkrzw::SetAccessStrategyOrDie ( File file,
int64_t  block_size,
bool  is_direct_io,
bool  is_sync_io,
bool  is_padding,
bool  is_pagecache 
)

Sets access strategy of the positional access file.

Parameters
fileThe file object.
block_sizeThe block size to which all records should be aligned.
is_direct_ioIf true, the direct I/O access option is set.
is_sync_ioIf true, the synchronous I/O access option is set.
is_paddingIf true, the padding access option is set.
is_pagecacheIf true, the mini page cache option is set.

◆ SetHeadBufferOfFileOrDie()

void tkrzw::SetHeadBufferOfFileOrDie ( File file,
int64_t  size 
)

Sets the head buffer of the positional access file.

Parameters
fileThe file object.
sizeThe size of the head buffer.

◆ PrintDBMRecordsInTSV()

void tkrzw::PrintDBMRecordsInTSV ( DBM dbm)

Prints all records of a DBM in TSV format.

Parameters
dbmThe DBM object.

◆ MakeCyclishText()

std::string tkrzw::MakeCyclishText ( size_t  size,
int32_t  seed 
)

Makes a text whose characters appear in a cyclic pattern.

Parameters
sizeThe size of the output text.
seedThe random seed.
Returns
The result text.

◆ MakeNaturalishText()

std::string tkrzw::MakeNaturalishText ( size_t  size,
int32_t  seed 
)

Makes a text whose character distribution is sililar to natural Englsh.

Parameters
sizeThe size of the output text.
seedThe random seed.
Returns
The result text.

◆ HeapByCostAdd()

template<typename C , typename T >
void tkrzw::HeapByCostAdd ( const C &  cost,
const T &  payload,
size_t  capacity,
std::vector< std::pair< C, T >> *  heap 
)

Adds a pair of a cont and a payload to a heap vector.

Parameters
costThe cost.
payloadThe payload.
capacityThe capacity of the heap vector.
heapThe pointer to the heap vector.

◆ HeapByCostFinish()

template<typename C , typename T >
void tkrzw::HeapByCostFinish ( std::vector< std::pair< C, T >> *  heap)

Finishes a heap vector to be in sorted order.

Parameters
heapThe heap vector.

◆ PrimaryHash()

uint64_t tkrzw::PrimaryHash ( std::string_view  data,
uint64_t  num_buckets 
)

Primary hash function for the hash database.

Parameters
dataThe data to calculate the hash value for.
num_bucketsThe number of buckets of the hash table.
Returns
The hash value.

◆ SecondaryHash()

uint64_t tkrzw::SecondaryHash ( std::string_view  data,
uint64_t  num_shards 
)

Secondary hash function for sharding.

Parameters
dataThe data to calculate the hash value for.
num_shardsThe number of shards.
Returns
The hash value.

◆ IsPrimeNumber()

uint64_t tkrzw::IsPrimeNumber ( uint64_t  num)

Returns true if an integer is a prime number.

Parameters
numThe integer.
Returns
True if the integer is a prime number.

◆ GetHashBucketSize()

int64_t tkrzw::GetHashBucketSize ( int64_t  min_size)

Gets a proper bucket size for hashing.

Parameters
min_sizeThe minimum size.
Returns
The calculated bucket size.

◆ SearchDBM()

Status tkrzw::SearchDBM ( DBM dbm,
std::string_view  pattern,
std::vector< std::string > *  matched,
size_t  capacity = 0,
bool(*)(std::string_view, std::string_view)  matcher = StrContains 
)

Searches a database and get keys which match a pattern.

Parameters
dbmThe DBM object of the database.
patternThe pattern for matching.
matchedA vector to contain the result.
capacityThe maximum records to obtain. 0 means unlimited.
matcherA matching function which takes the pattern and a candidate.
Returns
The result status.

This scans the whole database so it can take long time.

◆ SearchDBMLambda()

Status tkrzw::SearchDBMLambda ( DBM dbm,
std::function< bool(std::string_view)>  matcher,
std::vector< std::string > *  matched,
size_t  capacity = 0 
)

Searches a database and get keys which match a lambda function.

Parameters
dbmThe DBM object of the database.
matcherA matching function which takes a candidate.
matchedA vector to contain the result.
capacityThe maximum records to obtain. 0 means unlimited.
Returns
The result status.

This scans the whole database so it can take long time.

◆ SearchDBMOrder()

Status tkrzw::SearchDBMOrder ( DBM dbm,
std::string_view  pattern,
bool  upper,
bool  inclusive,
std::vector< std::string > *  matched,
size_t  capacity = 0 
)

Searches an ordered database and get keys which match a boundary condition.

Parameters
dbmThe DBM object of the database.
patternThe boundary pattern of the origin.
upperIf true, keys whose positions are upper than the boundary pattern are picked up. If false, keys whose positions are lower than the boundary pattern are picked up.
inclusiveIf true, keys whose position are the same as the boundary pattern are included.
matchedA vector to contain the result.
capacityThe maximum records to obtain. 0 means unlimited.
Returns
The result status.

Even if there's no matching record, the operation doesn't fail. This method is suppoerted only for ordered databases.

◆ SearchDBMForwardMatch()

Status tkrzw::SearchDBMForwardMatch ( DBM dbm,
std::string_view  pattern,
std::vector< std::string > *  matched,
size_t  capacity = 0 
)

Searches a database and get keys which begin with a pattern.

Parameters
dbmThe DBM object of the database.
patternThe pattern for forward matching.
matchedA vector to contain the result.
capacityThe maximum records to obtain. 0 means unlimited.
Returns
The result status.

If the database is ordered, an efficient way is used. However, if the key comparator is not LexicalKeyComparator, all matching keys are not extracted. If the database is unordered, this scans the whole database so it can take long time.

◆ SearchDBMRegex()

Status tkrzw::SearchDBMRegex ( DBM dbm,
std::string_view  pattern,
std::vector< std::string > *  matched,
size_t  capacity = 0 
)

Searches a database and get keys which match a regular expression.

Parameters
dbmThe DBM object of the database.
patternThe regular expression pattern to search for. Leading "(?i)" makes the pattern case-insensitive. Other options "a" (AWK regex), "b" (basic POSIX regex), "e" (extended POSIX regex), and "l" (egrep) are available in addition to "i". The default regex format is ECMAScript.
matchedA vector to contain the result.
capacityThe maximum records to obtain. 0 means unlimited.
Returns
The result status.

This scans the whole database so it can take long time.

◆ SearchDBMEditDistance()

Status tkrzw::SearchDBMEditDistance ( DBM dbm,
std::string_view  pattern,
std::vector< std::string > *  matched,
size_t  capacity = 0 
)

Searches a database and get keys whose edit distance with a UTF-8 pattern is the least.

Parameters
dbmThe DBM object of the database.
patternThe pattern for matching.
matchedA vector to contain the result.
capacityThe maximum records to obtain. 0 means unlimited.

This scans the whole database so it can take long time.

◆ SearchDBMEditDistanceBinary()

Status tkrzw::SearchDBMEditDistanceBinary ( DBM dbm,
std::string_view  pattern,
std::vector< std::string > *  matched,
size_t  capacity = 0 
)

Searches a database and get keys whose edit distance with a binary pattern is the least.

Parameters
dbmThe DBM object of the database.
patternThe pattern for matching.
matchedA vector to contain the result.
capacityThe maximum records to obtain. 0 means unlimited.

This scans the whole database so it can take long time.

◆ SearchDBMModal()

Status tkrzw::SearchDBMModal ( DBM dbm,
std::string_view  mode,
std::string_view  pattern,
std::vector< std::string > *  matched,
size_t  capacity = 0 
)

Searches a database and get keys which match a pattern, according to a mode expression.

Parameters
dbmThe DBM object of the database.
modeThe search mode. "contain" extracts keys containing the pattern. "begin" extracts keys beginning with the pattern. "end" extracts keys ending with the pattern. "regex" extracts keys partially matches the pattern of a regular expression. "edit" extracts keys whose edit distance to the UTF-8 pattern is the least. "editbin" extracts keys whose edit distance to the binary pattern is the least. "containcase", "containword", and "containcaseword" extract keys considering case and word boundary. "contain*", "containcase*", "containword*", and "containcaseword*" take a null-code-separatable pattern and do batch operations for each element. Ordered databases support "upper" and "lower" which extract keys whose positions are upper/lower than the pattern. "upperinc" and "lowerinc" are their inclusive versions.
patternThe pattern for matching.
matchedA vector to contain the result.
capacityThe maximum records to obtain. 0 means unlimited.
Returns
The result status.

◆ ExportDBMToFlatRecords()

Status tkrzw::ExportDBMToFlatRecords ( DBM dbm,
File dest_file 
)

Exports all records of a database to a flat record file.

Parameters
dbmThe DBM object of the database.
dest_fileThe file object to write records in.
Returns
The result status.

A flat record file contains a sequence of binary records without any high level structure so it is useful as a intermediate file for data migration.

◆ ImportDBMFromFlatRecords()

Status tkrzw::ImportDBMFromFlatRecords ( DBM dbm,
File src_file 
)

Imports records to a database from a flat record file.

Parameters
dbmThe DBM object of the database.
src_fileThe file object to read records from.
Returns
The result status.

◆ ExportDBMKeysToFlatRecords()

Status tkrzw::ExportDBMKeysToFlatRecords ( DBM dbm,
File dest_file 
)

Exports the keys of all records of a database to a flat record file.

Parameters
dbmThe DBM object of the database.
dest_fileThe file object to write keys in.
Returns
The result status.

◆ ExportDBMToTSV()

Status tkrzw::ExportDBMToTSV ( DBM dbm,
File dest_file,
bool  escape = false 
)

Exports all records of a database to a TSV file.

Parameters
dbmThe DBM object of the database.
dest_fileThe file object to write records in.
escapeIf true, C-style escaping is applied to the output.
Returns
The result status.

◆ ImportDBMFromTSV()

Status tkrzw::ImportDBMFromTSV ( DBM dbm,
File dest_file,
bool  unescape = false 
)

Imports records to a database from a TSV file.

Parameters
dbmThe DBM object of the database.
dest_fileThe file object to read records from.
unescapeIf true, C-style unescaping is applied to the input.
Returns
The result status.

◆ ExportDBMKeysAsLines()

Status tkrzw::ExportDBMKeysAsLines ( DBM dbm,
File dest_file 
)

Exports the keys of all records of a database as lines to a text file.

Parameters
dbmThe DBM object of the database.
dest_fileThe file object to write keys in.
Returns
The result status.

◆ SearchTextFile()

Status tkrzw::SearchTextFile ( File file,
std::string_view  pattern,
std::vector< std::string > *  matched,
size_t  capacity = 0,
bool(*)(std::string_view, std::string_view)  matcher = StrContains 
)

Searches a text file and get lines which match a pattern.

Parameters
fileThe file to search.
patternThe pattern for matching.
matchedA vector to contain the result.
capacityThe maximum records to obtain. 0 means unlimited.
matcherA matching function which takes the pattern and a candidate.
Returns
The result status.

◆ SearchTextFileLambda()

Status tkrzw::SearchTextFileLambda ( File file,
std::function< bool(std::string_view)>  matcher,
std::vector< std::string > *  matched,
size_t  capacity = 0 
)

Searches a text file and get lines which match a lambda function.

Parameters
fileThe file to search.
matcherA matching function which takes a candidate.
matchedA vector to contain the result.
capacityThe maximum records to obtain. 0 means unlimited.
Returns
The result status.

◆ SearchTextFileRegex()

Status tkrzw::SearchTextFileRegex ( File file,
std::string_view  pattern,
std::vector< std::string > *  matched,
size_t  capacity = 0 
)

Searches a text file and get lines which match a regular expression.

Parameters
fileThe file to search.
patternThe regular expression pattern to search for. Leading "(?i)" makes the pattern case-insensitive. Other options "a" (AWK regex), "b" (basic POSIX regex), "e" (extended POSIX regex), and "l" (egrep) are available in addition to "i". The default regex format is ECMAScript.
matchedA vector to contain the result.
capacityThe maximum records to obtain. 0 means unlimited.
Returns
The result status.

◆ SearchTextFileEditDistance()

Status tkrzw::SearchTextFileEditDistance ( File file,
std::string_view  pattern,
std::vector< std::string > *  matched,
size_t  capacity = 0 
)

Searches a text file and get lines whose edit distance with a UTF-8 pattern is the least.

Parameters
fileThe file to search.
patternThe pattern for matching.
matchedA vector to contain the result.
capacityThe maximum records to obtain. 0 means unlimited.
Returns
The result status.

◆ SearchTextFileEditDistanceBinary()

Status tkrzw::SearchTextFileEditDistanceBinary ( File file,
std::string_view  pattern,
std::vector< std::string > *  matched,
size_t  capacity = 0 
)

Searches a text file and get lines whose edit distance with a binary pattern is the least.

Parameters
fileThe file to search.
patternThe pattern for matching.
matchedA vector to contain the result.
capacityThe maximum records to obtain. 0 means unlimited.
Returns
The result status.

◆ SearchTextFileModal()

Status tkrzw::SearchTextFileModal ( File file,
std::string_view  mode,
std::string_view  pattern,
std::vector< std::string > *  matched,
size_t  capacity = 0 
)

Searches a text file and get lines which match a pattern, according to a mode expression.

Parameters
fileThe file to search.
modeThe search mode. "contain" extracts keys containing the pattern. "begin" extracts keys beginning with the pattern. "end" extracts keys ending with the pattern. "regex" extracts keys partially matches the pattern of a regular expression. "edit" extracts keys whose edit distance to the UTF-8 pattern is the least. "editbin" extracts keys whose edit distance to the binary pattern is the least. "containcase", "containword", and "containcaseword" extract keys considering case and word boundary. "contain*", "containcase*", "containword*", and "containcaseword*" take a line-separatable pattern and do batch operations for each elements.
patternThe pattern for matching.
matchedA vector to contain the result.
capacityThe maximum records to obtain. 0 means unlimited.
Returns
The result status.

◆ MagicChecksum()

uint32_t tkrzw::MagicChecksum ( const char *  key_buf,
size_t  key_size,
const char *  value_buf,
size_t  value_size 
)

Calculates the checksum of the record data to store in the record magic data.

Parameters
key_bufThe key buffer.
key_sizeThe key size.
value_bufThe value buffer.
value_sizeThe value size.
Returns
The checksum which uses the lower 6 bits only.

◆ CallRecordProcessFull()

std::string_view tkrzw::CallRecordProcessFull ( DBM::RecordProcessor proc,
std::string_view  key,
std::string_view  old_value,
std::string_view *  new_value_orig,
Compressor compressor,
ScopedStringView comp_data_placeholder 
)

Calls the ProcessFull method of a record processor with compression and decompression.

Parameters
procThe record processor, which takes a decompressed value.
keyThe key of a record.
old_valueThe old value of the record.
new_value_origThe pointer to store the original new value before compression.
compressorThe compressor object for compression and decompression. nullptr is OK.
comp_data_placeholderThe praceholder to manage the compression data.
Returns
The value returned from the record processor. If it is a normal value, compression is done implicitly.

◆ CallRecordProcessEmpty()

std::string_view tkrzw::CallRecordProcessEmpty ( DBM::RecordProcessor proc,
std::string_view  key,
std::string_view *  new_value_orig,
Compressor compressor,
ScopedStringView comp_data_placeholder 
)

Calls the ProcessEmpty method of a record processor with compression.

Parameters
procThe record processor.
keyThe key of a record.
new_value_origThe pointer to store the original new value before compression.
compressorThe compressor object for compression and decompression. nullptr is OK.
comp_data_placeholderThe praceholder to manage the compression data.
Returns
The value returned from the record processor. If it is a normal value, compression is done implicitly.

◆ CreateTreeRecord()

TreeRecord* tkrzw::CreateTreeRecord ( std::string_view  key,
std::string_view  value 
)

Creates a tree record.

Parameters
keyThe key data.
valueThe value data.
Returns
A new record object.

◆ ModifyTreeRecord()

TreeRecord* tkrzw::ModifyTreeRecord ( TreeRecord record,
std::string_view  new_value 
)

Modifies the value of a tree record.

Parameters
recordThe record to modify.
new_valueThe new value data.
Returns
A modified record object, which might be reallocated.

◆ FreeTreeRecord()

void tkrzw::FreeTreeRecord ( TreeRecord record)

Frees the region of a tree record.

Parameters
recordThe record to free.

◆ FreeTreeRecords()

void tkrzw::FreeTreeRecords ( std::vector< TreeRecord * > *  records)

Frees the regions of tree records.

Parameters
recordsA vector of the records to free.

◆ CreateTreeLink()

TreeLink* tkrzw::CreateTreeLink ( std::string_view  key,
int64_t  child 
)

Creates a tree link.

Parameters
keyThe key data.
childThe page ID of the child node.
Returns
A new link object.

◆ FreeTreeLink()

void tkrzw::FreeTreeLink ( TreeLink link)

Frees the region of a tree link.

Parameters
linkThe link to free.

◆ FreeTreeLinks()

void tkrzw::FreeTreeLinks ( std::vector< TreeLink * > *  links)

Frees the regions of tree links.

Parameters
linksA vector of the links to free.

◆ MakeTemporaryName()

std::string tkrzw::MakeTemporaryName ( )

Makes a unique name for a temporary file.

Returns
The unique name.

◆ JoinPath()

std::string tkrzw::JoinPath ( const std::string &  base_path,
const std::string &  child_name 
)

Joins a base path and a child name.

Parameters
base_pathThe base path.
child_nameThe child name.
Returns
The joined path.

◆ NormalizePath()

std::string tkrzw::NormalizePath ( const std::string &  path)

Normalizes a file path.

Parameters
pathThe path to normalize.
Returns
The normalized path.

◆ PathToBaseName()

std::string tkrzw::PathToBaseName ( const std::string &  path)

Gets the base name part of a path.

Parameters
pathThe path.
Returns
The base name part

◆ PathToDirectoryName()

std::string tkrzw::PathToDirectoryName ( const std::string &  path)

Gets the directory name part of a path.

Parameters
pathThe path.
Returns
The directory name part.

◆ PathToExtension()

std::string tkrzw::PathToExtension ( const std::string &  path)

Gets the extention part of a path.

Parameters
pathThe path.
Returns
The extension part or an empty string on failure.

◆ GetRealPath()

Status tkrzw::GetRealPath ( const std::string &  path,
std::string *  real_path 
)

Gets the normalized and canonical form of a path.

Parameters
pathThe path to check.
real_pathThe pointer to a string object to store the content.
Returns
The result status.

◆ ReadFileStatus()

Status tkrzw::ReadFileStatus ( const std::string &  path,
FileStatus fstats 
)

Reads status information of a file.

Parameters
pathThe path to the file.
fstatsThe pointer to a file status object.
Returns
The result status.

◆ PathIsFile()

bool tkrzw::PathIsFile ( const std::string &  path)

Checks if a path indicates a regular file.

Parameters
pathThe path to check.
Returns
True if the path indicates a regular file.

◆ GetFileSize()

int64_t tkrzw::GetFileSize ( const std::string &  path)

Gets the size of a file.

Parameters
pathThe path to the file.
Returns
The file size on success or -1 on failure.

◆ PathIsDirectory()

bool tkrzw::PathIsDirectory ( const std::string &  path)

Checks if a path indicates a directory.

Parameters
pathThe path to check.
Returns
True if the path indicates a directory.

◆ GetPathToTemporaryDirectory()

std::string tkrzw::GetPathToTemporaryDirectory ( )

Gets the path to a directory for temporary files.

Returns
The path of the directory for temporary files.

◆ WriteFile()

Status tkrzw::WriteFile ( const std::string &  path,
std::string_view  content 
)

Writes a file with a content.

Parameters
pathThe path of the file to write.
contentThe content.
Returns
The result status.

◆ WriteFileAtomic()

Status tkrzw::WriteFileAtomic ( const std::string &  path,
std::string_view  content,
const std::string &  tmp_path = "" 
)

Writes a file with a content, in an atomic manner by file renaming.

Parameters
pathThe path of the file to write.
contentThe content.
tmp_pathThe path of the temporary file which is renamed to the above path. If it is empty, a string made of the original path and the extension ".tmp" is used.
Returns
The result status.

◆ ReadFile()

Status tkrzw::ReadFile ( const std::string &  path,
std::string *  content,
int64_t  max_size = INT32MAX 
)

Reads the content from a file.

Parameters
pathThe path of the file to make.
contentThe pointer to a string object to contain the content.
max_sizeThe maximum size in bytes to read.
Returns
The result status.

◆ ReadFileSimple()

std::string tkrzw::ReadFileSimple ( const std::string &  path,
std::string_view  default_value = "",
int64_t  max_size = INT32MAX 
)

Reads the content from a file, in a simple way.

Parameters
pathThe path of the file to make.
default_valueThe value to be returned on failure.
max_sizeThe maximum size in bytes to read.
Returns
The content of the file on success, or the default value on failure.

◆ TruncateFile()

Status tkrzw::TruncateFile ( const std::string &  path,
int64_t  size 
)

Truncates a file.

Parameters
pathThe path of the file to truncate.
sizeThe new size of the file.
Returns
The result status.

◆ RemoveFile()

Status tkrzw::RemoveFile ( const std::string &  path)

Removes a file.

Parameters
pathThe path of the file.
Returns
The result status.

◆ RenameFile()

Status tkrzw::RenameFile ( const std::string &  src_path,
const std::string &  dest_path 
)

Renames a file.

Parameters
src_pathThe source path of the file.
dest_pathThe destination path of the file.
Returns
The result status.

If there is a file at the destination path, the file is overwritten. This function can rename directories too.

◆ CopyFileData()

Status tkrzw::CopyFileData ( const std::string &  src_path,
const std::string &  dest_path 
)

Copies the data of a file.

Parameters
src_pathThe source path of the file.
dest_pathThe destination path of the file.
Returns
The result status.

Copying is done in the fastest way available on the platform.

◆ ReadDirectory()

Status tkrzw::ReadDirectory ( const std::string &  path,
std::vector< std::string > *  children 
)

Reads a directory.

Parameters
pathThe path of the directory.
childrenA vector object to contain the names of all children.
Returns
The result status.

◆ MakeDirectory()

Status tkrzw::MakeDirectory ( const std::string &  path,
bool  recursive = false 
)

Makes a directory.

Parameters
pathThe path of the directory.
recursiveIf true, parent directories are made recursively.
Returns
The result status.

◆ RemoveDirectory()

Status tkrzw::RemoveDirectory ( const std::string &  path,
bool  recursive = false 
)

Removes a directory.

Parameters
pathThe path of the directory.
recursiveIf true, contents of children are removed recursively.
Returns
The result status.

◆ SynchronizeFile()

Status tkrzw::SynchronizeFile ( const std::string &  path)

Synchronizes a file or a directory.

Parameters
pathThe path of the file or the directory.
Returns
The result status.

◆ HashMurmur() [1/2]

uint64_t tkrzw::HashMurmur ( const void *  buf,
size_t  size,
uint64_t  seed 
)

Gets the hash value by Murmur hashing.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
seedThe seed value.
Returns
The hash value.

◆ HashMurmur() [2/2]

uint64_t tkrzw::HashMurmur ( std::string_view  str,
uint64_t  seed 
)

Gets the hash value by Murmur hashing.

See also
HashMurmur

◆ HashFNV() [1/2]

uint64_t tkrzw::HashFNV ( const void *  buf,
size_t  size 
)

Gets the hash value by FNV hashing.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
Returns
The hash value.

◆ HashFNV() [2/2]

uint64_t tkrzw::HashFNV ( std::string_view  str)

Gets the hash value by FNV hashing.

See also
HashFNV

◆ HashChecksum6Continuous()

uint32_t tkrzw::HashChecksum6Continuous ( const void *  buf,
size_t  size,
bool  finish,
uint32_t  seed = 0 
)

Gets the hash value by Checksum-6, in a continuous way.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
finishTrue if the cycle is to be finished.
seedA seed value. This should be 0 for the frist call of the cycle.
Returns
The hash value.

◆ HashChecksum6() [1/2]

uint32_t tkrzw::HashChecksum6 ( const void *  buf,
size_t  size 
)

Gets the hash value by Checksum-6.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
Returns
The hash value.

◆ HashChecksum6() [2/2]

uint32_t tkrzw::HashChecksum6 ( std::string_view  str)

Gets the hash value by Checksum-6.

See also
HashChecksum6

◆ HashChecksum6Pair()

uint32_t tkrzw::HashChecksum6Pair ( const void *  first_buf,
size_t  first_size,
const void *  second_buf,
size_t  second_size,
uint32_t  seed = 0 
)

Gets the hash value by Checksum-6.

See also
HashChecksum6

◆ HashChecksum8Continuous()

uint32_t tkrzw::HashChecksum8Continuous ( const void *  buf,
size_t  size,
bool  finish,
uint32_t  seed = 0 
)

Gets the hash value by checksum-8, in a continuous way.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
finishTrue if the cycle is to be finished.
seedA seed value. This should be 0 for the frist call of the cycle.
Returns
The hash value.

◆ HashChecksum8() [1/2]

uint32_t tkrzw::HashChecksum8 ( const void *  buf,
size_t  size 
)

Gets the hash value by checksum-8.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
Returns
The hash value.

◆ HashChecksum8() [2/2]

uint32_t tkrzw::HashChecksum8 ( std::string_view  str)

Gets the hash value by checksum-8.

See also
HashChecksum8

◆ HashChecksum8Pair()

uint32_t tkrzw::HashChecksum8Pair ( const void *  first_buf,
size_t  first_size,
const void *  second_buf,
size_t  second_size,
uint32_t  seed = 0 
)

Gets the hash value by Checksum-8.

See also
HashChecksum8

◆ HashAdler6Continuous()

uint32_t tkrzw::HashAdler6Continuous ( const void *  buf,
size_t  size,
bool  finish,
uint32_t  seed = 1 
)

Gets the hash value by Adler-6, in a continuous way.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
finishTrue if the cycle is to be finished.
seedA seed value. This should be 1 for the frist call of the cycle.
Returns
The hash value.

◆ HashAdler6() [1/2]

uint32_t tkrzw::HashAdler6 ( const void *  buf,
size_t  size 
)

Gets the hash value by Adler-6.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
Returns
The hash value.

◆ HashAdler6() [2/2]

uint32_t tkrzw::HashAdler6 ( std::string_view  str)

Gets the hash value by Adler-6.

See also
HashAdler6

◆ HashAdler8Continuous()

uint32_t tkrzw::HashAdler8Continuous ( const void *  buf,
size_t  size,
bool  finish,
uint32_t  seed = 1 
)

Gets the hash value by adler-8, in a continuous way.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
finishTrue if the cycle is to be finished.
seedA seed value. This should be 1 for the frist call of the cycle.
Returns
The hash value.

◆ HashAdler8() [1/2]

uint32_t tkrzw::HashAdler8 ( const void *  buf,
size_t  size 
)

Gets the hash value by adler-8.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
Returns
The hash value.

◆ HashAdler8() [2/2]

uint32_t tkrzw::HashAdler8 ( std::string_view  str)

Gets the hash value by adler-8.

See also
HashAdler8

◆ HashAdler16Continuous()

uint32_t tkrzw::HashAdler16Continuous ( const void *  buf,
size_t  size,
bool  finish,
uint32_t  seed = 1 
)

Gets the hash value by Adler-16, in a continuous way.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
finishTrue if the cycle is to be finished.
seedA seed value. This should be 1 for the frist call of the cycle.
Returns
The hash value.

◆ HashAdler16() [1/2]

uint32_t tkrzw::HashAdler16 ( const void *  buf,
size_t  size 
)

Gets the hash value by Adler-16.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
Returns
The hash value.

◆ HashAdler16() [2/2]

uint32_t tkrzw::HashAdler16 ( std::string_view  str)

Gets the hash value by Adler-16.

See also
HashAdler16

◆ HashAdler32Continuous()

uint32_t tkrzw::HashAdler32Continuous ( const void *  buf,
size_t  size,
bool  finish,
uint32_t  seed = 1 
)

Gets the hash value by Adler-32, in a continuous way.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
finishTrue if the cycle is to be finished.
seedA seed value. This should be 1 for the frist call of the cycle.
Returns
The hash value.

◆ HashAdler32() [1/2]

uint32_t tkrzw::HashAdler32 ( const void *  buf,
size_t  size 
)

Gets the hash value by Adler-32.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
Returns
The hash value.

◆ HashAdler32() [2/2]

uint32_t tkrzw::HashAdler32 ( std::string_view  str)

Gets the hash value by Adler-32.

See also
HashAdler32

◆ HashCRC4Continuous()

uint32_t tkrzw::HashCRC4Continuous ( const void *  buf,
size_t  size,
bool  finish,
uint32_t  seed = 0 
)

Gets the hash value by CRC-4, in a continuous way.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
finishTrue if the cycle is to be finished.
seedA seed value. This should be 0 for the frist call of the cycle.
Returns
The hash value.

◆ HashCRC4() [1/2]

uint32_t tkrzw::HashCRC4 ( const void *  buf,
size_t  size 
)

Gets the hash value by CRC-4.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
Returns
The hash value.

◆ HashCRC4() [2/2]

uint32_t tkrzw::HashCRC4 ( std::string_view  str)

Gets the hash value by CRC-4.

See also
HashCRC4

◆ HashCRC8Continuous()

uint32_t tkrzw::HashCRC8Continuous ( const void *  buf,
size_t  size,
bool  finish,
uint32_t  seed = 0 
)

Gets the hash value by CRC-8, in a continuous way.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
finishTrue if the cycle is to be finished.
seedA seed value. This should be 0 for the frist call of the cycle.
Returns
The hash value.

◆ HashCRC8() [1/2]

uint32_t tkrzw::HashCRC8 ( const void *  buf,
size_t  size 
)

Gets the hash value by CRC-8.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
Returns
The hash value.

◆ HashCRC8() [2/2]

uint32_t tkrzw::HashCRC8 ( std::string_view  str)

Gets the hash value by CRC-8.

See also
HashCRC8

◆ HashCRC16Continuous()

uint32_t tkrzw::HashCRC16Continuous ( const void *  buf,
size_t  size,
bool  finish,
uint32_t  seed = 0 
)

Gets the hash value by CRC-16, in a continuous way.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
finishTrue if the cycle is to be finished.
seedA seed value. This should be 0 for the frist call of the cycle.
Returns
The hash value.

◆ HashCRC16() [1/2]

uint32_t tkrzw::HashCRC16 ( const void *  buf,
size_t  size 
)

Gets the hash value by CRC-16.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
Returns
The hash value.

◆ HashCRC16() [2/2]

uint32_t tkrzw::HashCRC16 ( std::string_view  str)

Gets the hash value by CRC-16.

See also
HashCRC8

◆ HashCRC32Continuous()

uint32_t tkrzw::HashCRC32Continuous ( const void *  buf,
size_t  size,
bool  finish,
uint32_t  seed = 0xFFFFFFFF 
)

Gets the hash value by CRC-32, in a continuous way.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
finishTrue if the cycle is to be finished.
seedA seed value. This should be 0xFFFFFFFF for the frist call of the cycle.
Returns
The hash value.

◆ HashCRC32() [1/2]

uint32_t tkrzw::HashCRC32 ( const void *  buf,
size_t  size 
)

Gets the hash value by CRC-32.

Parameters
bufThe source buffer.
sizeThe size of the source buffer.
Returns
The hash value.

◆ HashCRC32() [2/2]

uint32_t tkrzw::HashCRC32 ( std::string_view  str)

Gets the hash value by CRC-32.

See also
HashCRC32

◆ LexicalKeyComparator()

int32_t tkrzw::LexicalKeyComparator ( std::string_view  a,
std::string_view  b 
)

Key comparator in the lexical order.

Parameters
aOne key.
bThe other key.
Returns
-1 if "a" is less, 1 if "a" is greater, and 0 if both are equivalent.

◆ LexicalCaseKeyComparator()

int32_t tkrzw::LexicalCaseKeyComparator ( std::string_view  a,
std::string_view  b 
)

Key comparator in the lexical order ignoring case.

Parameters
aOne key.
bThe other key.
Returns
-1 if "a" is less, 1 if "a" is greater, and 0 if both are equivalent.

◆ DecimalKeyComparator()

int32_t tkrzw::DecimalKeyComparator ( std::string_view  a,
std::string_view  b 
)

Key comparator in the order of the decimal integer numeric expressions.

Parameters
aOne key.
bThe other key.
Returns
-1 if "a" is less, 1 if "a" is greater, and 0 if both are equivalent.

◆ HexadecimalKeyComparator()

int32_t tkrzw::HexadecimalKeyComparator ( std::string_view  a,
std::string_view  b 
)

Key comparator in the order of the hexadecimal integer numeric expressions.

Parameters
aOne key.
bThe other key.
Returns
-1 if "a" is less, 1 if "a" is greater, and 0 if both are equivalent.

◆ RealNumberKeyComparator()

int32_t tkrzw::RealNumberKeyComparator ( std::string_view  a,
std::string_view  b 
)

Key comparator in the order of the decimal real number expressions.

Parameters
aOne key.
bThe other key.
Returns
-1 if "a" is less, 1 if "a" is greater, and 0 if both are equivalent.

◆ PairLexicalKeyComparator()

int32_t tkrzw::PairLexicalKeyComparator ( std::string_view  a,
std::string_view  b 
)

Key comparator for serialized pair strings in the lexical order.

Parameters
aOne key.
bThe other key.
Returns
-1 if "a" is less, 1 if "a" is greater, and 0 if both are equivalent.

◆ PairLexicalCaseKeyComparator()

int32_t tkrzw::PairLexicalCaseKeyComparator ( std::string_view  a,
std::string_view  b 
)

Key comparator for serialized pair strings in the lexical order ignoring case.

Parameters
aOne key.
bThe other key.
Returns
-1 if "a" is less, 1 if "a" is greater, and 0 if both are equivalent.

◆ PairDecimalKeyComparator()

int32_t tkrzw::PairDecimalKeyComparator ( std::string_view  a,
std::string_view  b 
)

Key comparator for serialized pair strings in the decimal integer order.

Parameters
aOne key.
bThe other key.
Returns
-1 if "a" is less, 1 if "a" is greater, and 0 if both are equivalent.

◆ PairHexadecimalKeyComparator()

int32_t tkrzw::PairHexadecimalKeyComparator ( std::string_view  a,
std::string_view  b 
)

Key comparator for serialized pair strings in the hexadecimal integer order.

Parameters
aOne key.
bThe other key.
Returns
-1 if "a" is less, 1 if "a" is greater, and 0 if both are equivalent.

◆ PairRealNumberKeyComparator()

int32_t tkrzw::PairRealNumberKeyComparator ( std::string_view  a,
std::string_view  b 
)

Key comparator for serialized pair strings in the decimal real number order.

Parameters
aOne key.
bThe other key.
Returns
-1 if "a" is less, 1 if "a" is greater, and 0 if both are equivalent.

◆ xmalloc()

void* tkrzw::xmalloc ( size_t  size)

Allocates a region on memory.

Parameters
sizeThe size of the region.
Returns
The pointer to the allocated region.

◆ xcalloc()

void* tkrzw::xcalloc ( size_t  nmemb,
size_t  size 
)

Allocates a nullified region on memory.

Parameters
nmembThe number of elements.
sizeThe size of each element.
Returns
The pointer to the allocated region.

◆ xrealloc()

void* tkrzw::xrealloc ( void *  ptr,
size_t  size 
)

Re-allocates a region on memory.

Parameters
ptrThe pointer to the region.
sizeThe size of the region.
Returns
The pointer to the re-allocated region.

◆ xreallocappend()

void* tkrzw::xreallocappend ( void *  ptr,
size_t  size 
)

Re-allocates a region on memory for appending operations.

Parameters
ptrThe pointer to the region.
sizeThe size of the region.
Returns
The pointer to the re-allocated region.

◆ xfree()

void tkrzw::xfree ( void *  ptr)

Frees a region on memory.

Parameters
ptrThe pointer to the region.

◆ xmallocaligned()

void* tkrzw::xmallocaligned ( size_t  alignment,
size_t  size 
)

Allocates an aligned region on memory.

Parameters
alignmentThe alignment of the address. It must be a power of two and more than sizeof(void*).
sizeThe size of the region. It is ceiled implicitly to a multiple of the alignment.
Returns
The pointer to the allocated region.

◆ xfreealigned()

void tkrzw::xfreealigned ( void *  ptr)

Frees an aligned region on memory.

Parameters
ptrThe pointer to the region.

◆ CheckSet()

template<typename SET >
bool tkrzw::CheckSet ( SET  set,
const typename SET::key_type &  elem 
)

Checks whether a set has an element.

Parameters
setThe set to search.
elemThe element to search for.
Returns
True if the set has the element.

◆ CheckMap()

template<typename MAP >
bool tkrzw::CheckMap ( MAP  map,
const typename MAP::key_type &  key 
)

Checks whether a map has a key.

Parameters
mapThe map to search.
keyThe key to search for.
Returns
True if the map has the key.

◆ SearchMap()

template<typename MAP >
MAP::value_type::second_type tkrzw::SearchMap ( MAP  map,
const typename MAP::key_type &  key,
const typename MAP::value_type::second_type &  default_value 
)

Searches a map and get the value of a record.

Parameters
mapThe map to search.
keyThe key to search for.
default_valueThe value to be returned on failure.
Returns
The value of the matching record on success, or the default value on failure.

◆ GetProcessID()

int64_t tkrzw::GetProcessID ( )

Gets the current processs ID.

Returns
The current processs ID.

◆ GetSystemInfo()

std::map<std::string, std::string> tkrzw::GetSystemInfo ( )

Gets system information of the environment.

Returns
A map of labels and their values.

◆ GetMemoryCapacity()

int64_t tkrzw::GetMemoryCapacity ( )

Gets the memory capacity of the platform.

Returns
The memory capacity of the platform in bytes, or -1 on failure.

◆ GetMemoryUsage()

int64_t tkrzw::GetMemoryUsage ( )

Gets the current memory usage of the process.

Returns
The current memory usage of the process in bytes, or -1 on failure.

◆ operator==()

bool tkrzw::operator== ( const Status::Code lhs,
const Status rhs 
)

Checks whether a status code is equal to another status object.

Parameters
lhsThe status code to compare.
rhsThe status object to compare.
Returns
True if The status code is equal to the status object.

◆ operator!=()

bool tkrzw::operator!= ( const Status::Code lhs,
const Status rhs 
)

Checks whether a status code is not equal to another status object.

Parameters
lhsThe status code to compare.
rhsThe status object to compare.
Returns
True if The status code is equal to the status object.

◆ ToString() [1/10]

std::string tkrzw::ToString ( const Status status)

Converts a status into a string.

Parameters
statusThe status object.
Returns
The converted string.

◆ operator<<()

std::ostream& tkrzw::operator<< ( std::ostream &  os,
const Status status 
)

Outputs a status string into an output stream.

Parameters
osThe output stream.
statusThe status.
Returns
The output stream.

◆ GetErrnoStatus()

Status tkrzw::GetErrnoStatus ( const char *  call_name,
int32_t  sys_err_num 
)

Gets a status according to a system error number of a system call.

Parameters
call_nameThe name of the system call.
sys_err_numThe value of "errno".
Returns
The status object.

◆ StrToInt()

int64_t tkrzw::StrToInt ( std::string_view  str,
int64_t  defval = 0 
)

Converts a decimal string to an integer.

Parameters
strThe decimal string.
defvalThe default value to be returned on failure.
Returns
The converted integer.

◆ StrToIntMetric()

int64_t tkrzw::StrToIntMetric ( std::string_view  str,
int64_t  defval = 0 
)

Converts a decimal string with a metric prefix to an integer.

Parameters
strThe decimal string, which can be trailed by a binary metric prefix. "K", "M", "G", "T", "P", and "E" are supported. They are case-insensitive.
defvalThe default value to be returned on failure.
Returns
The converted integer. If the integer overflows the domain, INT64MAX or INT64MIN is returned according to the sign.

◆ StrToIntOct()

uint64_t tkrzw::StrToIntOct ( std::string_view  str,
uint64_t  defval = 0 
)

Converts a octal string to an integer.

Parameters
strThe octal string.
defvalThe default value to be returned on failure.
Returns
The converted integer.

◆ StrToIntHex()

uint64_t tkrzw::StrToIntHex ( std::string_view  str,
uint64_t  defval = 0 
)

Converts a hexadecimal string to an integer.

Parameters
strThe hexadecimal string.
defvalThe default value to be returned on failure.
Returns
The converted integer.

◆ StrToIntBigEndian()

uint64_t tkrzw::StrToIntBigEndian ( std::string_view  str)

Converts a big-endian binary string to an integer.

Parameters
strThe big endian binary string.
Returns
The converted integer.

◆ StrToDouble()

double tkrzw::StrToDouble ( std::string_view  str,
double  defval = 0.0 
)

Converts a decimal string to a real number.

Parameters
strThe decimal string.
defvalThe default value to be returned on failure.
Returns
The converted real number.

◆ StrToBool()

bool tkrzw::StrToBool ( std::string_view  str,
bool  defval = false 
)

Converts a boolean string to a boolean value.

Parameters
strThe decimal string.
defvalThe default value to be returned on failure.
Returns
The converted boolean value.

◆ StrToIntOrBool()

int64_t tkrzw::StrToIntOrBool ( std::string_view  str,
int64_t  defval = 0 
)

Converts a decimal or boolean string to an integer or boolean value.

Parameters
strThe decimal string.
defvalThe default value to be returned on failure.
Returns
The converted integer.

◆ VSPrintF()

void tkrzw::VSPrintF ( std::string *  dest,
const char *  format,
va_list  ap 
)

Appends a formatted string at the end of a string.

Parameters
destThe destination string.
formatThe printf-like format string. The conversion character ‘%’ can be used with such flag characters as ‘s’, ‘d’, ‘o’, ‘u’, ‘x’, ‘X’, ‘c’, ‘e’, ‘E’, ‘f’, ‘g’, ‘G’, and ‘%’.
apArguments used according to the format string.

◆ SPrintF() [1/2]

void tkrzw::SPrintF ( std::string *  dest,
const char *  format,
  ... 
)

Appends a formatted string at the end of a string.

Parameters
destThe destination string.
formatThe printf-like format string. The conversion character ‘%’ can be used with such flag characters as ‘s’, ‘d’, ‘o’, ‘u’, ‘x’, ‘X’, ‘c’, ‘e’, ‘E’, ‘f’, ‘g’, ‘G’, and ‘%’.
...Arguments used according to the format string.

◆ SPrintF() [2/2]

std::string tkrzw::SPrintF ( const char *  format,
  ... 
)

Generates a formatted string.

Parameters
formatThe printf-like format string. The conversion character ‘%’ can be used with such flag characters as ‘s’, ‘d’, ‘o’, ‘u’, ‘x’, ‘X’, ‘c’, ‘e’, ‘E’, ‘f’, ‘g’, ‘G’, and ‘%’.
...Arguments used according to the format string.
Returns
The result string.

◆ ToString() [2/10]

template<typename T >
std::string tkrzw::ToString ( data)

Converts an integer to a decimal string.

Parameters
dataThe integer to convert.
Returns
The converted string.

◆ ToString() [3/10]

std::string tkrzw::ToString ( double  data)

Converts a real number to a decimal string.

Parameters
dataThe real number to convert.
Returns
The converted string.

◆ ToString() [4/10]

std::string tkrzw::ToString ( float  data)

Converts a real number to a decimal string.

Parameters
dataThe real number to convert.
Returns
The converted string.

◆ ToString() [5/10]

std::string tkrzw::ToString ( long double  data)

Converts a real number to a decimal string.

Parameters
dataThe real number to convert.
Returns
The converted string.

◆ ToString() [6/10]

std::string tkrzw::ToString ( bool  data)

Converts a boolean value to a decimal string.

Parameters
dataThe integer to convert.
Returns
The converted string.

◆ ToString() [7/10]

std::string tkrzw::ToString ( char  data)

Converts a character into a string.

Parameters
dataThe character.
Returns
The converted string.

◆ ToString() [8/10]

std::string tkrzw::ToString ( const char *  data)

Converts a C-style string into a string.

Parameters
dataThe C-style string to convert.
Returns
The converted string.

◆ ToString() [9/10]

std::string tkrzw::ToString ( std::string_view  data)

Converts a string view into a string.

Parameters
dataThe string view.
Returns
The converted string.

◆ ToString() [10/10]

std::string tkrzw::ToString ( const std::string &  data)

Copies a string.

Parameters
dataThe string.
Returns
The copied string.

◆ IntToStrBigEndian()

std::string tkrzw::IntToStrBigEndian ( uint64_t  data,
size_t  size = sizeof(uint64_t) 
)

Converts an integer into a big-endian binary string.

Parameters
dataThe integer to convert.
sizeThe size of the converted string.
Returns
The converted string.

◆ StrJoin()

template<typename T >
std::string tkrzw::StrJoin ( const T &  elems,
const std::string_view &  delim 
)

Converts each record of a container into strings and join them.

Parameters
elemsAn iterable container.
delimA string to delimit elements.
Returns
The joined string.

◆ StrCat() [1/2]

std::string tkrzw::StrCat ( )

Returns an empty string.

Returns
The empty string.

◆ StrCat() [2/2]

template<typename FIRST , typename... REST>
std::string tkrzw::StrCat ( const FIRST &  first,
const REST &...  rest 
)

Concatenates data of arbitrary parameters into a string.

Parameters
firstThe first parameter.
restThe rest parameters.
Returns
The concatenated string.

◆ StrSplit() [1/2]

std::vector<std::string> tkrzw::StrSplit ( std::string_view  str,
char  delim,
bool  skip_empty = false 
)

Splits a string with a delimiter character.

Parameters
strThe string.
delimThe delimiter character.
skip_emptyIf true, fields with empty values are skipped.
Returns
A vector object into which the result segments are pushed.

◆ StrSplit() [2/2]

std::vector<std::string> tkrzw::StrSplit ( std::string_view  str,
std::string_view  delim,
bool  skip_empty = false 
)

Splits a string with a delimiter string.

Parameters
strThe string.
delimThe delimiter string. If it is empty, each character is separated.
skip_emptyIf true, fields with empty values are skipped.
Returns
A vector object into which the result segments are pushed.

◆ StrSplitAny()

std::vector<std::string> tkrzw::StrSplitAny ( std::string_view  str,
std::string_view  delims,
bool  skip_empty = false 
)

Splits a string with delimiter characters.

Parameters
strThe string to split.
delimsA string containing a set of the delimiters.
skip_emptyIf true, fields with empty values are skipped.
Returns
A vector object into which the result segments are pushed.

◆ StrSplitIntoMap()

std::map<std::string, std::string> tkrzw::StrSplitIntoMap ( std::string_view  str,
std::string_view  delim_records,
std::string_view  delim_kv 
)

Splits a string into a key-value map.

Parameters
strThe string to split.
delim_recordsThe delimiter string between records.
delim_kvThe delimiter string between the key and the value.
Returns
A map object containing key-value pairs.

◆ StrUpperCase() [1/2]

std::string tkrzw::StrUpperCase ( std::string_view  str)

Converts letters of a string into upper case.

Parameters
strThe string to convert.
Returns
The converted string.

◆ StrUpperCase() [2/2]

void tkrzw::StrUpperCase ( std::string *  str)

Converts letters of a string into upper case in-place.

Parameters
strThe pointer to the string to modify.

◆ StrLowerCase() [1/2]

std::string tkrzw::StrLowerCase ( std::string_view  str)

Converts letters of a string into lower case.

Parameters
strThe string to convert.
Returns
The converted string.

◆ StrLowerCase() [2/2]

void tkrzw::StrLowerCase ( std::string *  str)

Converts letters of a string into lower case in-place.

Parameters
strThe pointer to the string to modify.

◆ StrReplace()

std::string tkrzw::StrReplace ( std::string_view  str,
std::string_view  before,
std::string_view  after 
)

Converts a string by replacing substrings to diffent substrings.

Parameters
strThe string to convert.
beforeThe substring before replacement.
afterThe substring after replacement.
Returns
The converted string.

◆ StrReplaceCharacters()

void tkrzw::StrReplaceCharacters ( std::string *  str,
std::string_view  before,
std::string_view  after 
)

Modifies a string by replacing characters to diffent characters in-place.

Parameters
strThe pointer to the string to modify.
beforeThe characters to remove.
afterThe characters to insert. The character at the same index as the index of the before character is used. If there's no counterpart, no character is inserted.

◆ StrContains()

bool tkrzw::StrContains ( std::string_view  text,
std::string_view  pattern 
)

Checks whether a text contains a pattern.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
True if the text contains the pattern.

◆ StrCaseContains()

bool tkrzw::StrCaseContains ( std::string_view  text,
std::string_view  pattern 
)

Checks whether a text contains a pattern in a case-insensitive manner.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
True if the text contains the pattern.

◆ StrWordContains()

bool tkrzw::StrWordContains ( std::string_view  text,
std::string_view  pattern 
)

Checks whether a text contains a word surrounded by non-alphanumeric word boundaries.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
True if the text contains the pattern.

◆ StrCaseWordContains()

bool tkrzw::StrCaseWordContains ( std::string_view  text,
std::string_view  pattern 
)

Checks whether a text contains a word in a case-sensitive manner.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
True if the text contains the pattern.

◆ StrContainsBatch()

bool tkrzw::StrContainsBatch ( std::string_view  text,
const std::vector< std::string > &  patterns 
)

Checks a text contains at least one of patterns.

Parameters
textThe text to search.
patternsThe patterns to search for.
Returns
True if the text contains at least one of patterns.

◆ StrCaseContainsBatch()

bool tkrzw::StrCaseContainsBatch ( std::string_view  text,
const std::vector< std::string > &  patterns 
)

Checks a text contains at least one of patterns in a case-sensitive manner.

Parameters
textThe text to search.
patternsThe patterns to search for.
Returns
True if the text contains at least one of patterns.

◆ StrWordContainsBatch()

bool tkrzw::StrWordContainsBatch ( std::string_view  text,
const std::vector< std::string > &  patterns 
)

Checks a text contains at least one of words surrounded by non-alphanumeric word boundaries.

Parameters
textThe text to search.
patternsThe patterns to search for.
Returns
True if the text contains at least one of patterns.

◆ StrCaseWordContainsBatch()

bool tkrzw::StrCaseWordContainsBatch ( std::string_view  text,
const std::vector< std::string > &  patterns 
)

Checks a text contains at least one of words in a case-sensitive manner.

Parameters
textThe text to search.
patternsThe patterns to search for.
Returns
True if the text contains at least one of patterns.

◆ StrCaseWordContainsBatchLower()

bool tkrzw::StrCaseWordContainsBatchLower ( std::string_view  text,
const std::vector< std::string > &  patterns 
)

Checks a text contains at least one of lowercase words in a case-sensitive manner.

Parameters
textThe text to search.
patternsThe patterns to search for. Each must be lowercased.
Returns
True if the text contains at least one of patterns.

◆ StrBeginsWith()

bool tkrzw::StrBeginsWith ( std::string_view  text,
std::string_view  pattern 
)

Checks whether a text begins with a pattern.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
True if the text begins with the pattern.

◆ StrEndsWith()

bool tkrzw::StrEndsWith ( std::string_view  text,
std::string_view  pattern 
)

Checks whether a text ends with a pattern.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
True if the text ends with the pattern.

◆ StrCaseCompare()

int32_t tkrzw::StrCaseCompare ( std::string_view  a,
std::string_view  b 
)

Compares two strings ignoring case.

Parameters
aA string.
bThe other string.
Returns
Negative if the former is less, 0 if both are equivalent, positive if latter is less.

◆ StrSearch()

int32_t tkrzw::StrSearch ( std::string_view  text,
std::string_view  pattern 
)

Searches a text for a pattern, with string::find.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
The index of the first matched position, or -1 if there's no matches.

◆ StrSearchDoubleLoop()

int32_t tkrzw::StrSearchDoubleLoop ( std::string_view  text,
std::string_view  pattern 
)

Searches a text for a pattern, by naive double loop.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
The index of the first matched position, or -1 if there's no matches.

◆ StrSearchMemchr()

int32_t tkrzw::StrSearchMemchr ( std::string_view  text,
std::string_view  pattern 
)

Searches a text for a pattern, with memchr.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
The index of the first matched position, or -1 if there's no matches.

◆ StrSearchMemmem()

int32_t tkrzw::StrSearchMemmem ( std::string_view  text,
std::string_view  pattern 
)

Searches a text for a pattern, with memmem.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
The index of the first matched position, or -1 if there's no matches.

◆ StrSearchKMP()

int32_t tkrzw::StrSearchKMP ( std::string_view  text,
std::string_view  pattern 
)

Searches a text for a pattern, by Knuth-Morris-Pratt algorithm.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
The index of the first matched position, or -1 if there's no matches.

◆ StrSearchBM()

int32_t tkrzw::StrSearchBM ( std::string_view  text,
std::string_view  pattern 
)

Searches a text for a pattern, by Boyer-Moore algorithm.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
The index of the first matched position, or -1 if there's no matches.

◆ StrSearchRK()

int32_t tkrzw::StrSearchRK ( std::string_view  text,
std::string_view  pattern 
)

Searches a text for a pattern, by Rabin-Karp algorithm.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
The index of the first matched position, or -1 if there's no matches.

◆ StrSearchZ()

int32_t tkrzw::StrSearchZ ( std::string_view  text,
std::string_view  pattern 
)

Searches a text for a pattern, by Z algorithm.

'

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
The index of the first matched position, or -1 if there's no matches.

◆ StrSearchWhole()

std::vector<int32_t> tkrzw::StrSearchWhole ( std::string_view  text,
std::string_view  pattern,
size_t  max_results = 0 
)

Searches a text for a pattern and get indices of all occurrences, with string::find.

Parameters
textThe text to search.
patternThe pattern to search for.
max_resultsThe maximum number of results to store. 0 means unlimited.
Returns
A vector of indeces of all ocurrences of the pattern.

◆ StrSearchWholeKMP()

std::vector<int32_t> tkrzw::StrSearchWholeKMP ( std::string_view  text,
std::string_view  pattern,
size_t  max_results = 0 
)

Searches a text for a pattern and get indices of all occurrences, by KMP algorithm.

Parameters
textThe text to search.
patternThe pattern to search for.
max_resultsThe maximum number of results to store. 0 means unlimited.
Returns
A vector of indeces of all ocurrences of the pattern.

◆ StrSearchWholeBM()

std::vector<int32_t> tkrzw::StrSearchWholeBM ( std::string_view  text,
std::string_view  pattern,
size_t  max_results = 0 
)

Searches a text for a pattern and get indices of all occurrences, by BM algorithm.

Parameters
textThe text to search.
patternThe pattern to search for.
max_resultsThe maximum number of results to store. 0 means unlimited.
Returns
A vector of indeces of all ocurrences of the pattern.

◆ StrSearchWholeRK()

std::vector<int32_t> tkrzw::StrSearchWholeRK ( std::string_view  text,
std::string_view  pattern,
size_t  max_results = 0 
)

Searches a text for a pattern and get indices of all occurrences, by RK algorithm.

Parameters
textThe text to search.
patternThe pattern to search for.
max_resultsThe maximum number of results to store. 0 means unlimited.
Returns
A vector of indeces of all ocurrences of the pattern.

◆ StrSearchBatch()

std::vector<std::vector<int32_t> > tkrzw::StrSearchBatch ( std::string_view  text,
const std::vector< std::string > &  patterns,
size_t  max_results = 0 
)

Searches a text for patterns and get indices of all occurrences, by string::find.

Parameters
textThe text to search.
patternsThe patterns to search for.
max_resultsThe maximum number of results to store for each pattern. 0 means unlimited.
Returns
A vector of the result for each pattern. Each element is a vector of indices of all occurrences of the pattern.

◆ StrSearchBatchKMP()

std::vector<std::vector<int32_t> > tkrzw::StrSearchBatchKMP ( std::string_view  text,
const std::vector< std::string > &  patterns,
size_t  max_results = 0 
)

Searches a text for patterns and get indices of all occurrences, by KMP algorithm.

Parameters
textThe text to search.
patternsThe patterns to search for.
max_resultsThe maximum number of results to store for each pattern. 0 means unlimited.
Returns
A vector of the result for each pattern. Each element is a vector of indices of all occurrences of the pattern.

◆ StrSearchBatchBM()

std::vector<std::vector<int32_t> > tkrzw::StrSearchBatchBM ( std::string_view  text,
const std::vector< std::string > &  patterns,
size_t  max_results = 0 
)

Searches a text for patterns and get indices of all occurrences, by BM algorithm.

Parameters
textThe text to search.
patternsThe patterns to search for.
max_resultsThe maximum number of results to store for each pattern. 0 means unlimited.
Returns
A vector of the result for each pattern. Each element is a vector of indices of all occurrences of the pattern.

◆ StrSearchBatchRK()

std::vector<std::vector<int32_t> > tkrzw::StrSearchBatchRK ( std::string_view  text,
const std::vector< std::string > &  patterns,
size_t  max_results = 0 
)

Searches a text for patterns and get indices of all occurrences, by RK algorithm.

Parameters
textThe text to search.
patternsThe patterns to search for.
max_resultsThe maximum number of results to store for each pattern. 0 means unlimited.
Returns
A vector of the result for each pattern. Each element is a vector of indices of all occurrences of the pattern.

◆ StrCaseSearch()

int32_t tkrzw::StrCaseSearch ( std::string_view  text,
std::string_view  pattern 
)

Searches a text for a pattern in a case-insensitive manner.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
The index of the first matched position, or -1 if there's no matches.

◆ StrWordSearch()

int32_t tkrzw::StrWordSearch ( std::string_view  text,
std::string_view  pattern 
)

Searches a text for a word surrounded by non-alphanumeric word boundaries.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
The index of the first matched position, or -1 if there's no matches.

◆ StrCaseWordSearch()

int32_t tkrzw::StrCaseWordSearch ( std::string_view  text,
std::string_view  pattern 
)

Searches a text for a word surrounded in a case-insensitive manner.

Parameters
textThe text to search.
patternThe pattern to search for.
Returns
The index of the first matched position, or -1 if there's no matches.

◆ StrStripSpace()

std::string tkrzw::StrStripSpace ( std::string_view  str)

Removes space characters at the head or the tail of a string.

Parameters
strThe string to convert.
Returns
The converted string.

◆ StrStripLine() [1/2]

std::string tkrzw::StrStripLine ( std::string_view  str)

Removes linefeed characters from the end of a string.

Parameters
strThe string to convert.
Returns
The converted string.

◆ StrStripLine() [2/2]

void tkrzw::StrStripLine ( std::string *  str)

Remove linefeed characters from the end of a string in-place.

Parameters
strThe pointer to the string to modify.

◆ StrSqueezeAndStripSpace()

std::string tkrzw::StrSqueezeAndStripSpace ( std::string_view  str)

Squeezes space characters in a string and removes spaces at both ends.

Parameters
strThe string to convert.
Returns
The converted string.

◆ StrTrimForTSV()

std::string tkrzw::StrTrimForTSV ( std::string_view  str,
bool  keep_tab = false 
)

Trims a string for TSV by normalizing space and control characters.

Parameters
strThe string to convert.
keep_tabIf true, tab is kept and not escaped.
Returns
The converted string.

◆ StrEscapeC()

std::string tkrzw::StrEscapeC ( std::string_view  str,
bool  esc_nonasc = false 
)

Escapes C-style meta characters in a string.

Parameters
strThe string to convert.
esc_nonascIf true, non-ASCII characters are excaped.
Returns
The converted string.

◆ StrUnescapeC()

std::string tkrzw::StrUnescapeC ( std::string_view  str)

Unescapes C-style escape sequences in a string.

Parameters
strThe string to convert.
Returns
The converted string.

◆ StrEncodeBase64()

std::string tkrzw::StrEncodeBase64 ( std::string_view  str)

Encodes a string into a Base64 string.

Parameters
strThe string to encode.
Returns
The encoded string.

◆ StrDecodeBase64()

std::string tkrzw::StrDecodeBase64 ( std::string_view  str)

Decodes a Base64 string into a string.

Parameters
strThe Base64 string to decode.
Returns
The decoded string.

◆ StrEncodeURL()

std::string tkrzw::StrEncodeURL ( std::string_view  str)

Encodes a string into a URL part string.

Parameters
strThe string to encode.
Returns
The encoded string.

◆ StrDecodeURL()

std::string tkrzw::StrDecodeURL ( std::string_view  str)

Decodes a URL part string into a string.

Parameters
strThe URL part string to decode.
Returns
The decoded string.

◆ StrSearchRegex()

int32_t tkrzw::StrSearchRegex ( std::string_view  text,
std::string_view  pattern 
)

Searches a string for a pattern matching a regular expression.

Parameters
textThe text to search.
patternThe regular expression pattern to search for. Leading "(?i)" makes the pattern case-insensitive. Other options "a" (AWK regex), "b" (basic POSIX regex), "e" (extended POSIX regex), and "l" (egrep) are available in addition to "i". The default regex format is ECMAScript.
Returns
The position of the first matching pattern. If there's no matching pattern. -1 is returned. If the regular expression is invalid, -2 is returned.

◆ StrReplaceRegex()

std::string tkrzw::StrReplaceRegex ( std::string_view  text,
std::string_view  pattern,
std::string_view  replace 
)

Replaces substrings matching a pattern of regular expression.

Parameters
textThe text to process.
patternThe regular expression pattern to search for. Leading "(?i)" makes the pattern case-insensitive. Other options "a" (AWK regex), "b" (basic POSIX regex), "e" (extended POSIX regex), and "l" (egrep) are available in addition to "i". The default regex format is ECMAScript.
replaceThe replacing expression. "$&" means the entire matched pattern. "$1", "$2", and etc represent n-th bracketed patterns.
Returns
The result string. If the regular expression is invalid, an empty string is returned.

◆ ConvertUTF8ToUCS4()

std::vector<uint32_t> tkrzw::ConvertUTF8ToUCS4 ( std::string_view  utf)

Converts a UTF-8 string into a UCS-4 vector.

Parameters
utfThe UTF-8 string.
Returns
The UCS-4 vector.

◆ ConvertUCS4ToUTF8()

std::string tkrzw::ConvertUCS4ToUTF8 ( const std::vector< uint32_t > &  ucs)

Converts a UCS-4 vector into a UTF-8 string.

Parameters
ucsThe UCS-4 vector.
Returns
The UTF-8 string.

◆ ConvertUTF8ToWide()

std::wstring tkrzw::ConvertUTF8ToWide ( std::string_view  utf)

Converts a UTF-8 string into a wide string.

Parameters
utfThe UTF-8 string.
Returns
The wide string.

◆ ConvertWideToUTF8()

std::string tkrzw::ConvertWideToUTF8 ( const std::wstring &  wstr)

Converts a wide string into a UTF-8 string.

Parameters
wstrThe wide string.
Returns
The UTF-8 string.

◆ SerializeStrPair()

std::string tkrzw::SerializeStrPair ( std::string_view  first,
std::string_view  second 
)

Serializes a pair of strings into a string.

Parameters
firstThe first string.
secondThe second string.
Returns
The serialized string.

The size of the first value and the size of the second value come in the byte delta encoding. The first data and the second data follow them.

◆ DeserializeStrPair()

void tkrzw::DeserializeStrPair ( std::string_view  serialized,
std::string_view *  first,
std::string_view *  second 
)

Deserializes a serialized string into a pair of strings.

Parameters
serializedThe serialized string.
firstThe pointer to a string view object to refer to the first string.
secondThe pointer to a string view object to refer to the second string.

◆ GetFirstFromSerializedStrPair()

std::string_view tkrzw::GetFirstFromSerializedStrPair ( std::string_view  serialized)

Get the first part from a serialized string pair.

Parameters
serializedThe serialized string.
Returns
The first part string.

◆ SerializeStrVector()

std::string tkrzw::SerializeStrVector ( const std::vector< std::string > &  values)

Serializes a vector of strings into a string.

Parameters
valuesThe string vector.
Returns
The serialized string.

The size of a value comes in the byte delta encoding and the data follows. The pairs for all values come consequitively.

◆ DeserializeStrVector()

std::vector<std::string> tkrzw::DeserializeStrVector ( std::string_view  serialized)

Deserializes a serialized string into a string vector.

Parameters
serializedThe serialized string.
Returns
The result string vector.

◆ MakeStrVectorFromViews()

std::vector<std::string> tkrzw::MakeStrVectorFromViews ( const std::vector< std::string_view > &  views)

Makes a string vector from a string view vector.

Parameters
viewsThe string view vector.
Returns
The result string vector.

◆ MakeStrViewVectorFromValues()

std::vector<std::string_view> tkrzw::MakeStrViewVectorFromValues ( const std::vector< std::string > &  values)

Makes a string view vector from a string vector.

Parameters
valuesThe string vector.
Returns
The result string view vector. Elements refer to the elements of the input vector.

◆ SerializeStrMap()

std::string tkrzw::SerializeStrMap ( const std::map< std::string, std::string > &  records)

Serializes a map of strings into a string.

Parameters
recordsThe string map.
Returns
The serialized string.

The size of a kay comes in the byte delta encoding and the data follows. The size of its value comes in the byte delta encoding and the data follows. The tuples for all records come consequitively.

◆ DeserializeStrMap()

std::map<std::string, std::string> tkrzw::DeserializeStrMap ( std::string_view  serialized)

Deserializes a serialized string into a string map.

Parameters
serializedThe serialized string.
Returns
The result string map.

◆ MakeStrMapFromViews()

std::map<std::string, std::string> tkrzw::MakeStrMapFromViews ( const std::map< std::string_view, std::string_view > &  views)

Makes a string map from a string view map.

Parameters
viewsThe string view map.
Returns
The result string map.

◆ MakeStrViewMapFromRecords()

std::map<std::string_view, std::string_view> tkrzw::MakeStrViewMapFromRecords ( const std::map< std::string, std::string > &  records)

Makes a string view map from a string map.

Parameters
recordsThe string map.
Returns
The result string view map. Elements refer to the elements of the input map.

◆ SleepThread()

void tkrzw::SleepThread ( double  sec)

Sleeps the current thread.

Parameters
secThe duration in seconds to sleep for.

◆ GetWallTime()

double tkrzw::GetWallTime ( )

Gets the number of seconds since the UNIX epoch.

Returns
The number of seconds since the UNIX epoch with microsecond precision.

◆ GetLocalCalendar()

void tkrzw::GetLocalCalendar ( int64_t  wtime,
struct std::tm *  cal 
)

Gets the local calendar of a time.

Parameters
wtimethe time since the UNIX epoch.
calthe pointer to a calendar object to store the result.

◆ GetUniversalCalendar()

void tkrzw::GetUniversalCalendar ( int64_t  wtime,
struct std::tm *  cal 
)

Gets the universal calendar of a time.

Parameters
wtimethe time since the UNIX epoch.
calthe pointer to a calendar object to store the result.

◆ MakeUniversalTime()

int64_t tkrzw::MakeUniversalTime ( struct std::tm &  cal)

Makes the UNIX time from a universal calendar.

Parameters
calthe time struct of the universal calendar.
Returns
The UNIX time of the universal calendar

◆ GetLocalTimeDifference()

int32_t tkrzw::GetLocalTimeDifference ( bool  use_cache = false)

Gets the time difference of the local time zone.

Parameters
use_cacheIf true, the result of the first call is cached and reused for later calls.
Returns
The time difference of the local time zone in seconds, which is positive in the east of the prime meridian and negative in the west.

◆ GetDayOfWeek()

int32_t tkrzw::GetDayOfWeek ( int32_t  year,
int32_t  mon,
int32_t  day 
)

Gets the day of week of a date.

Parameters
yearthe year of the date.
monthe month of the date.
daythe day of the date.
Returns
The day of week of the date. 0 means Sunday and 6 means Saturday.

◆ FormatDateSimple()

size_t tkrzw::FormatDateSimple ( char *  result,
int64_t  wtime = INT64MIN,
int32_t  td = INT32MIN 
)

Formats a date as a simple string in "YYYY/MM/DD hh:mm:ss" format.

Parameters
resultthe pointer to the region into which the result string is written. The size of the buffer should be equal to or more than 48 bytes.
wtimethe time since the UNIX epoch. If it is INT64MIN, the current time is specified.
tdthe time difference of the timze zone. If it is INT32MIN, the local time zone is specified.
Returns
The size of the result string excluding the sentinel null code.

◆ FormatDateSimpleWithFrac()

size_t tkrzw::FormatDateSimpleWithFrac ( char *  result,
double  wtime = -1,
int32_t  td = INT32MIN,
int32_t  frac_cols = 6 
)

Formats a date as a simple string in "YYYY/MM/DD hh:mm:ss" format.

Parameters
resultthe pointer to the region into which the result string is written. The size of the buffer should be equal to or more than 48 bytes.
wtimethe time since the UNIX epoch. If it is negative, the current time is specified.
tdthe time difference of the timze zone. If it is INT32MIN, the local time zone is specified.
frac_colsThe number of columns for the fraction part.
Returns
The size of the result string excluding the sentinel null code.

◆ FormatDateW3CDTF()

size_t tkrzw::FormatDateW3CDTF ( char *  result,
int64_t  wtime = INT64MIN,
int32_t  td = INT32MIN 
)

Formats a date as a string in W3CDTF.

Parameters
resultthe pointer to the region into which the result string is written. The size of the buffer should be equal to or more than 48 bytes.
wtimethe time since the UNIX epoch. If it is INT64MIN, the current time is specified.
tdthe time difference of the timze zone. If it is INT32MIN, the local time zone is specified.
Returns
The size of the result string excluding the sentinel null code.

◆ FormatDateW3CDTFWithFrac()

size_t tkrzw::FormatDateW3CDTFWithFrac ( char *  result,
double  wtime = -1,
int32_t  td = INT32MIN,
int32_t  frac_cols = 6 
)

Formats a date as a string in W3CDTF.

Parameters
resultthe pointer to the region into which the result string is written. The size of the buffer should be equal to or more than 48 bytes.
wtimethe time since the UNIX epoch. If it is negative, the current time is specified.
tdthe time difference of the timze zone. If it is INT32MIN, the local time zone is specified.
frac_colsThe number of columns for the fraction part.
Returns
The size of the result string excluding the sentinel null code.

◆ FormatDateRFC1123()

size_t tkrzw::FormatDateRFC1123 ( char *  result,
int64_t  wtime = INT64MIN,
int32_t  td = INT32MIN 
)

Formats a date as a string in RFC 1123 format.

Parameters
resultthe pointer to the region into which the result string is written. The size of the buffer should be equal to or more than 48 bytes.
wtimethe time since the UNIX epoch. If it is INT64MIN, the current time is specified.
tdthe time difference of the timze zone. If it is INT32MIN, the local time zone is specified.
Returns
The size of the result string excluding the sentinel null code.

◆ ParseDateStr()

double tkrzw::ParseDateStr ( std::string_view  str)

Parses a date string to get the time value since the UNIX epoch.

Parameters
strthe date string in decimal, hexadecimal, W3CDTF, or RFC 822 (1123). Decimal can be trailed by "s" for in seconds, "m" for in minutes, "h" for in hours, and "d" for in days.
Returns
The time value of the date or NaN if the format is invalid.

◆ ParseDateStrYYYYMMDD()

double tkrzw::ParseDateStrYYYYMMDD ( std::string_view  str,
int32_t  td = INT32MIN 
)

Parses a date string in "YYYYMMDD" to get the time value since the UNIX epoch.

Parameters
strthe date string in "YYYYMMDD" or "YYMMDDhhmmss". As characters except for numbers are ignored, "YYYY-MM-DD" etc are also supported.
tdthe time difference of the timze zone. If it is INT32MIN, the local time zone is specified.
Returns
The time value of the date or NaN if the format is invalid.

◆ MakeRelativeTimeExpr()

std::string tkrzw::MakeRelativeTimeExpr ( double  diff)

Makes a human-readable relative time expression of a time difference.

Parameters
diffThe time difference in seconds.
Returns
The result relative time expression, like "1.5 days" and "2.8 hours".

Variable Documentation

◆ DIR_SEP_CHR

const char tkrzw::DIR_SEP_CHR
extern

Directory separator character.

◆ DIR_SEP_STR

const char* const tkrzw::DIR_SEP_STR
extern

Directory separator string.

◆ EXT_SEP_CHR

const char tkrzw::EXT_SEP_CHR
extern

Extension separator character.

◆ EXT_SEP_STR

const char* const tkrzw::EXT_SEP_STR
extern

Extension separator string.

◆ CURRENT_DIR_NAME

const char* const tkrzw::CURRENT_DIR_NAME
extern

Current directory name.

◆ PARENT_DIR_NAME

const char* const tkrzw::PARENT_DIR_NAME
extern

Parent directory name.

◆ INT8MIN

constexpr int8_t tkrzw::INT8MIN = std::numeric_limits<int8_t>::min()
constexpr

Disable macros to avoid possible name confliction.

The minimum value of int8_t.

◆ INT8MAX

constexpr int8_t tkrzw::INT8MAX = std::numeric_limits<int8_t>::max()
constexpr

The maximum value of int8_t.

◆ UINT8MAX

constexpr uint8_t tkrzw::UINT8MAX = std::numeric_limits<uint8_t>::max()
constexpr

The maximum value of uint8_t.

◆ INT16MIN

constexpr int16_t tkrzw::INT16MIN = std::numeric_limits<int16_t>::min()
constexpr

The minimum value of int16_t.

◆ INT16MAX

constexpr int16_t tkrzw::INT16MAX = std::numeric_limits<int16_t>::max()
constexpr

The maximum value of int16_t.

◆ UINT16MAX

constexpr uint16_t tkrzw::UINT16MAX = std::numeric_limits<uint16_t>::max()
constexpr

The maximum value of uint16_t.

◆ INT32MIN

constexpr int32_t tkrzw::INT32MIN = std::numeric_limits<int32_t>::min()
constexpr

The minimum value of int32_t.

◆ INT32MAX

constexpr int32_t tkrzw::INT32MAX = std::numeric_limits<int32_t>::max()
constexpr

The maximum value of int32_t.

◆ UINT32MAX

constexpr uint32_t tkrzw::UINT32MAX = std::numeric_limits<uint32_t>::max()
constexpr

The maximum value of uint32_t.

◆ INT64MIN

constexpr int64_t tkrzw::INT64MIN = std::numeric_limits<int64_t>::min()
constexpr

The minimum value of int64_t.

◆ INT64MAX

constexpr int64_t tkrzw::INT64MAX = std::numeric_limits<int64_t>::max()
constexpr

The maximum value of int64_t.

◆ UINT64MAX

constexpr uint64_t tkrzw::UINT64MAX = std::numeric_limits<uint64_t>::max()
constexpr

The maximum value of uint64_t.

◆ SIZEMAX

constexpr size_t tkrzw::SIZEMAX = std::numeric_limits<size_t>::max()
constexpr

The maximum value of size_t.

◆ FLOATMIN

constexpr float tkrzw::FLOATMIN = std::numeric_limits<float>::min()
constexpr

The minimum value of float.

◆ FLOATMAX

constexpr float tkrzw::FLOATMAX = std::numeric_limits<float>::max()
constexpr

The maximum value of float.

◆ DOUBLEMIN

constexpr double tkrzw::DOUBLEMIN = std::numeric_limits<double>::min()
constexpr

The minimum value of double.

◆ DOUBLEMAX

constexpr double tkrzw::DOUBLEMAX = std::numeric_limits<double>::max()
constexpr

The maximum value of double.

◆ DOUBLENAN

constexpr double tkrzw::DOUBLENAN = std::numeric_limits<double>::quiet_NaN()
constexpr

The quiet Not-a-Number value of double.

◆ DOUBLEINF

constexpr double tkrzw::DOUBLEINF = std::numeric_limits<double>::infinity()
constexpr

The positive infinity value of double.

◆ NUM_BUFFER_SIZE

constexpr int32_t tkrzw::NUM_BUFFER_SIZE = 32
constexpr

The buffer size for a numeric string expression.

◆ MAX_MEMORY_SIZE

constexpr int64_t tkrzw::MAX_MEMORY_SIZE = (1LL << 40)
constexpr

The maximum memory size.

◆ PAGE_SIZE

const int32_t tkrzw::PAGE_SIZE
extern

The size of a memory page on the OS.

◆ PACKAGE_VERSION

const char* const tkrzw::PACKAGE_VERSION
extern

The string expression of the package version.

◆ LIBRARY_VERSION

const char* const tkrzw::LIBRARY_VERSION
extern

The string expression of the library version.

◆ OS_NAME

const char* const tkrzw::OS_NAME
extern

The recognized OS name.

◆ IS_POSIX

const bool tkrzw::IS_POSIX
extern

True if the OS is conforming to POSIX.

◆ IS_BIG_ENDIAN

const bool tkrzw::IS_BIG_ENDIAN
extern

True if the byte order is big endian.