scsl 0.2.4
Shimmering Clarity Standard Library
|
scsl is the top-level namespace containing all the code in this library. More...
Namespaces | |
namespace | TLV |
namespace | U |
namespace U contains utilities. | |
Classes | |
class | Arena |
class | AssertionFailed |
AssertionFailed indicates that some invariant didn't hold. More... | |
class | Buffer |
class | Commander |
class | Dictionary |
struct | Flag |
Flag describes an individual command-line flag. More... | |
class | Flags |
union | FlagValue |
FlagValue holds the value of a command line flag. More... | |
class | NotImplemented |
class | Subcommand |
Typedefs | |
using | CommanderFunc = std::function< bool(int, char **)> |
Enumerations | |
enum class | ArenaType : uint8_t { Uninit , Static , Alloc , MemoryMapped } |
enum class | FlagType : uint8_t { Unknown = 0 , Boolean = 1 , Integer = 2 , UnsignedInteger = 3 , SizeT = 4 , String = 5 } |
Functions | |
std::ostream & | operator<< (std::ostream &os, Arena &arena) |
std::ostream & | operator<< (std::ostream &os, const Buffer &buf) |
The << operator is overloaded to write out the contents of the Buffer. More... | |
bool | operator!= (const Buffer &lhs, const Buffer &rhs) |
Flag * | NewFlag (std::string fName, FlagType fType, std::string fDescription) |
void | TestAssert (bool condition) |
void | TestAssert (bool condition, std::string message) |
bool | operator== (const Buffer &lhs, const Buffer &rhs) |
std::ostream & | operator<< (std::ostream &os, const Dictionary &dictionary) |
Variables | |
constexpr size_t | defaultCapacity = 32 |
constexpr size_t | maxReasonableLine = 8192 |
scsl is the top-level namespace containing all the code in this library.
using scsl::CommanderFunc = typedef std::function<bool (int, char **)> |
CommanderFunc describes a function that can be run in Commander.
It expects an argument count and a list of arguments.
|
strong |
|
strong |
NewFlag is a helper function for constructing a new flag.
fName | The name of the flag. |
fType | The type of the flag. |
fDescription | A description of the flag. |
Two Buffers are not equal if their lengths differ or if their contents differ.
std::ostream & scsl::operator<< | ( | std::ostream & | os, |
Arena & | arena | ||
) |
Write an Arena out to the output stream.
The resulting output looks something like
os | |
arena |
std::ostream & scsl::operator<< | ( | std::ostream & | os, |
const Buffer & | buf | ||
) |
The << operator is overloaded to write out the contents of the Buffer.
std::ostream & scsl::operator<< | ( | std::ostream & | os, |
const Dictionary & | dictionary | ||
) |
operator<< writes the key pairs phonto the output stream.
os | The output stream to write to. |
dictionary | The dictionary to write out. |
Two buffers are equal if their lengths are the same and their contents are the same. Equality is irrespective of their capacities.
void scsl::TestAssert | ( | bool | condition | ) |
TestAssert is a variant on the assert macro. This variant is intended to be a drop-in replacement for the cassert macro: even in release mode, the tests should still run.
If NDEBUG is set, TestAssert will throw an exception if condition is false. Otherwise, it calls assert after printing the message.
condition | If true, TestAssert throws an exception. |
void scsl::TestAssert | ( | bool | condition, |
std::string | message | ||
) |
TestAssert is a variant on the assert macro.
If NDEBUG is set, TestAssert will throw an exception if condition is false. Otherwise, it calls assert after printing the message.
In addition to NDEBUG, SCSL_NOEXCEPT will suppress assertions.
AssertionFailed |
condition | The condition to assert. |
message | The message that should be displayed if condition is false. |
|
constexpr |
The defaultCapacity for a new Buffer is a reasonably arbitrary starting point.
|
constexpr |
maxReasonableLine is the longest a reasonable line could be. It assumes something like a long, unprettified JSON strong or the like.