Namespaces
Enumerations
enum WhiteSpaceHandling
| Name | Value |
|---|---|
| kKeepWhitespace | 0 |
| kTrimWhitespace | 1 |
Defined at line 16 of file ../../src/lib/fxl/strings/split_string.h
enum Base
| Name | Value |
|---|---|
| k10 | 0 |
| k16 | 1 |
Supported base values used for converting a string to a number. Currently
only bases 10 and 16 are supported.
Defined at line 20 of file ../../src/lib/fxl/strings/string_number_conversions.h
enum SplitResult
| Name | Value |
|---|---|
| kSplitWantAll | 0 |
| kSplitWantNonEmpty | 1 |
Defined at line 21 of file ../../src/lib/fxl/strings/split_string.h
enum CharType
| Name | Value |
|---|---|
| kPositionalId | 0 |
| kMissingId | 1 |
| kRegularChar | 2 |
| kDollar | 3 |
Defined at line 91 of file ../../src/lib/fxl/strings/substitute.cc
Records
Functions
-
bool WriteFileDescriptor (int fd, const char * data, ssize_t size)Defined at line 11 of file ../../src/lib/files/file_descriptor.cc
-
template <typename T>bool ParseLogSettingsInternal (const fxl::CommandLine & command_line, T * out_settings)Defined at line 18 of file ../../src/lib/fxl/log_settings_command_line.cc
-
template <typename StringContainer>std::string JoinStrings (const StringContainer & strings, const std::string & separator)Join a container of strings with a separator. This is expected to work with
std::vector
<std
::string> and std::array
<std
::string> but will work with any
container class that supports iterators and basic capacity access (ie:
size()) as defined in the Containers library (see:
http://en.cppreference.com/w/cpp/container).
Defined at line 19 of file ../../src/lib/fxl/strings/join_strings.h
-
ssize_t ReadFileDescriptor (int fd, char * data, ssize_t max_size)Defined at line 21 of file ../../src/lib/files/file_descriptor.cc
-
std::string Concatenate (std::initializer_list<std::string_view> string_views)Concatenates a fixed list of strings.
Defined at line 9 of file ../../src/lib/fxl/strings/concatenate.cc
-
std::string_view TrimString (std::string_view str, std::string_view chars_to_trim)Returns a std::string_view over str, where chars_to_trim are removed from the
beginning and end of the std::string_view.
Defined at line 9 of file ../../src/lib/fxl/strings/trim.cc
-
bool SetTestSettings (const CommandLine & command_line, async_dispatcher_t * dispatcher)Defined at line 13 of file ../../src/lib/fxl/test/test_settings.cc
-
bool IsAsciiWhitespace (char c)Defined at line 15 of file ../../src/lib/fxl/strings/ascii.h
-
char ToLowerASCII (char c)Defined at line 17 of file ../../src/lib/fxl/strings/ascii.h
-
char ToUpperASCII (char c)Defined at line 19 of file ../../src/lib/fxl/strings/ascii.h
-
bool SetTestSettings (int argc, const char *const * argv, async_dispatcher_t * dispatcher)Defined at line 21 of file ../../src/lib/fxl/test/test_settings.cc
-
bool EqualsCaseInsensitiveASCII (std::string_view v1, std::string_view v2)Defined at line 9 of file ../../src/lib/fxl/strings/ascii.cc
-
bool IsValidCodepoint (uint32_t code_point)Defined at line 18 of file ../../src/lib/fxl/strings/utf_codecs.h
-
template <typename F, typename Tuple>decltype(auto) Apply (F && f, Tuple && t)Invoke the callable object |f| with |t| as arguments.
Defined at line 24 of file ../../src/lib/fxl/functional/apply.h
-
bool IsValidCharacter (uint32_t code_point)Defined at line 25 of file ../../src/lib/fxl/strings/utf_codecs.h
-
template <typename T>RefPtr<T> AdoptRef (T * ptr)Adopts a newly-created |T|. Typically used in a static factory method, like:
// static
RefPtr
<Foo
> Foo::Create() {
return AdoptRef(new Foo());
}
Defined at line 222 of file ../../src/lib/fxl/memory/ref_ptr.h
-
std::string StringPrintf (const char * format)Formats |printf()|-like input and returns it as an |std::string|.
Defined at line 62 of file ../../src/lib/fxl/strings/string_printf.cc
-
bool SetTestSettings (const CommandLine & command_line)Defined at line 25 of file ../../src/lib/fxl/test/test_settings.cc
-
std::string StringVPrintf (const char * format, va_list ap)Formats |vprintf()|-like input and returns it as an |std::string|.
Defined at line 71 of file ../../src/lib/fxl/strings/string_printf.cc
-
bool SetTestSettings (int argc, const char *const * argv)Defined at line 33 of file ../../src/lib/fxl/test/test_settings.cc
-
void StringAppendf (std::string * dest, const char * format)Formats |printf()|-like input and appends it to |*dest|.
Defined at line 77 of file ../../src/lib/fxl/strings/string_printf.cc
-
std::string Substitute (std::string_view format, std::string_view arg0)Perform string substitutions using a positional notation.
The format string uses positional identifiers consisting of a $ sign followed
by a single digit: $0-$9. Each positional identifier refers to the
corresponding string in the argument list: $0 for the first argument, etc.
Unlike fxl::StringPrintf, callers do not have to specify the type, and
it is possible to reuse the same positional identifier multiple times.
If Substitute encounters an error (for example, not enough arguments), it
crashes in debug mode, and returns an empty string in non-debug mode.
This function is inspired by Abseil's strings/substitute.h.
Defined at line 25 of file ../../src/lib/fxl/strings/substitute.cc
-
std::string Substitute (std::string_view format, std::string_view arg0, std::string_view arg1)Defined at line 30 of file ../../src/lib/fxl/strings/substitute.cc
-
void StringVAppendf (std::string * dest, const char * format, va_list ap)Formats |vprintf()|-like input and appends it to |*dest|.
Defined at line 84 of file ../../src/lib/fxl/strings/string_printf.cc
-
std::string Substitute (std::string_view format, std::string_view arg0, std::string_view arg1, std::string_view arg2)Defined at line 35 of file ../../src/lib/fxl/strings/substitute.cc
-
template <typename NumberType>NumberType StringToNumber (std::string_view string, Base base)Converts |string| containing a locale-independent representation of a
number to a numeric representation of that number. (On error, this returns
zero.) This is available for all |NumberType|s (u)intN_t (from
<stdint
.h>)
and also (unsigned) int. (See |StringToNumberWithError()| for more details.)
Defined at line 44 of file ../../src/lib/fxl/strings/string_number_conversions.h
-
template <typename NumberType>std::string NumberToString (NumberType number, Base base)Converts |number| to a string with a locale-independent decimal
representation of it. This is available for all |NumberType|s (u)intN_t (from
<stdint
.h>) and also (unsigned) int.
Defined at line 101 of file ../../src/lib/fxl/strings/string_number_conversions.cc
-
std::vector<std::string> SplitStringCopy (std::string_view input, std::string_view separators, WhiteSpaceHandling whitespace, SplitResult result_type)Split the given string on ANY of the given separators, returning copies of
the result
Defined at line 61 of file ../../src/lib/fxl/strings/split_string.cc
-
std::string Substitute (std::string_view format, std::string_view arg0, std::string_view arg1, std::string_view arg2, std::string_view arg3)Defined at line 41 of file ../../src/lib/fxl/strings/substitute.cc
-
bool IsStringUTF8 (std::string_view str)Defined at line 11 of file ../../src/lib/fxl/strings/utf_codecs.cc
-
std::string Substitute (std::string_view format, std::string_view arg0, std::string_view arg1, std::string_view arg2, std::string_view arg3, std::string_view arg4)Defined at line 47 of file ../../src/lib/fxl/strings/substitute.cc
-
std::string Substitute (std::string_view format, std::string_view arg0, std::string_view arg1, std::string_view arg2, std::string_view arg3, std::string_view arg4, std::string_view arg5)Defined at line 53 of file ../../src/lib/fxl/strings/substitute.cc
-
std::vector<std::string_view> SplitString (std::string_view input, std::string_view separators, WhiteSpaceHandling whitespace, SplitResult result_type)Like SplitStringCopy above except it returns a vector of std::string_views which
reference the original buffer without copying.
Defined at line 70 of file ../../src/lib/fxl/strings/split_string.cc
-
template <typename NumberType>bool StringToNumberWithError (std::string_view string, NumberType * number, Base base)Converts |string| containing a locale-independent representation of a
number to a numeric representation of that number. (On error, this returns
false and leaves |*number| alone.) This is available for all |NumberType|s
(u)intN_t (from
<stdint
.h>) and also (unsigned) int.
Notes: Unary '+' is not allowed. Leading zeros are allowed (and ignored). For
unsigned types, unary '-' is not allowed. For signed types, "-0", "-00", etc.
are also allowed.
Defined at line 137 of file ../../src/lib/fxl/strings/string_number_conversions.cc
-
std::string Substitute (std::string_view format, std::string_view arg0, std::string_view arg1, std::string_view arg2, std::string_view arg3, std::string_view arg4, std::string_view arg5, std::string_view arg6)Defined at line 60 of file ../../src/lib/fxl/strings/substitute.cc
-
std::string Substitute (std::string_view format, std::string_view arg0, std::string_view arg1, std::string_view arg2, std::string_view arg3, std::string_view arg4, std::string_view arg5, std::string_view arg6, std::string_view arg7)Defined at line 67 of file ../../src/lib/fxl/strings/substitute.cc
-
bool ReadUnicodeCharacter (const char * src, size_t src_len, size_t * char_index, uint32_t * code_point_out)ReadUnicodeCharacter --------------------------------------------------------
Defined at line 27 of file ../../src/lib/fxl/strings/utf_codecs.cc
-
std::string Substitute (std::string_view format, std::string_view arg0, std::string_view arg1, std::string_view arg2, std::string_view arg3, std::string_view arg4, std::string_view arg5, std::string_view arg6, std::string_view arg7, std::string_view arg8)Defined at line 74 of file ../../src/lib/fxl/strings/substitute.cc
-
std::string Substitute (std::string_view format, std::string_view arg0, std::string_view arg1, std::string_view arg2, std::string_view arg3, std::string_view arg4, std::string_view arg5, std::string_view arg6, std::string_view arg7, std::string_view arg8, std::string_view arg9)Defined at line 82 of file ../../src/lib/fxl/strings/substitute.cc
-
size_t WriteUnicodeCharacter (uint32_t code_point, std::string * output)Appends a UTF-8 character to the given 8-bit string. Returns the number of
bytes written.
Defined at line 46 of file ../../src/lib/fxl/strings/utf_codecs.cc
-
bool ParseLogSettings (const fxl::CommandLine & command_line, fxl::LogSettings * out_settings)Parses log settings from standard command-line options.
Recognizes the following options:
--severity=
<TRACE
|DEBUG|INFO|WARNING|ERROR|FATAL> : sets |min_log_level| to indicated severity
--verbose : sets |min_log_level| to (LOG_INFO - 1)
--verbose=
<level
> : sets |min_log_level| incrementally lower than INFO
--quiet : sets |min_log_level| to LOG_WARNING
--quiet=
<level
> : sets |min_log_level| incrementally higher than INFO
--log-file=
<file
> : sets |log_file| to file, uses default output if empty
Quiet supersedes verbose if both are specified.
Returns false and leaves |out_settings| unchanged if there was an
error parsing the options. Otherwise updates |out_settings| with any
values which were overridden by the command-line.
Defined at line 84 of file ../../src/lib/fxl/log_settings_command_line.cc
-
bool SetLogSettingsFromCommandLine (const fxl::CommandLine & command_line, async_dispatcher_t * dispatcher)Defined at line 88 of file ../../src/lib/fxl/log_settings_command_line.cc
-
bool SetLogSettingsFromCommandLine (const fxl::CommandLine & command_line, const std::initializer_list<std::string> & tags, async_dispatcher_t * dispatcher)Similar to the method above but uses the given list of tags instead of
the default which is the process name. On host |tags| is ignored.
Defined at line 119 of file ../../src/lib/fxl/log_settings_command_line.cc
-
bool SetLogSettingsFromCommandLine (const fxl::CommandLine & command_line)Defined at line 91 of file ../../src/lib/fxl/log_settings_command_line.cc
-
bool SetLogSettingsFromCommandLine (const fxl::CommandLine & command_line, const std::initializer_list<std::string> & tags)Defined at line 123 of file ../../src/lib/fxl/log_settings_command_line.cc
-
std::vector<std::string> LogSettingsToArgv (const fxl::LogSettings & settings)Do the opposite of |ParseLogSettings()|: Convert |settings| to the
command line arguments to pass to a program. The result is empty if
|settings| is the default.
Defined at line 151 of file ../../src/lib/fxl/log_settings_command_line.cc
-
RefPtr<T> AdoptRef (T * ) -
std::vector<std::string> CommandLineToArgv (const CommandLine & command_line)This is the "opposite" of the above factory functions, transforming a
|CommandLine| into a vector of argument strings according to the rules
outlined at the top of this file.
Defined at line 127 of file ../../src/lib/fxl/command_line.cc
-
template <typename InputIterator>CommandLine CommandLineFromIteratorsFindFirstPositionalArg (InputIterator first, InputIterator last, InputIterator * first_positional_arg)Like |CommandLineFromIterators()| (see below), but sets
|*first_positional_arg| to point to the first positional argument seen (or
|last| if none are seen). This is useful for processing "subcommands".
Defined at line 179 of file ../../src/lib/fxl/command_line.h
-
template <typename InputIterator>CommandLine CommandLineFromIterators (InputIterator first, InputIterator last)Builds a |CommandLine| from first/last iterators (where |last| is really
one-past-the-last, as usual) to |std::string|s or things that implicitly
convert to |std::string|.
Defined at line 197 of file ../../src/lib/fxl/command_line.h
-
template <typename InputIterator>CommandLine CommandLineFromIteratorsWithArgv0 (const std::string & argv0, InputIterator first, InputIterator last)Builds a |CommandLine| from first/last iterators (where |last| is really
one-past-the-last, as usual) to |std::string|s or things that implicitly
convert to |std::string|, where argv[0] is provided separately.
Defined at line 205 of file ../../src/lib/fxl/command_line.h
-
CommandLine CommandLineFromArgcArgv (int argc, const char *const * argv)Builds a |CommandLine| from the usual argc/argv.
Defined at line 215 of file ../../src/lib/fxl/command_line.h
-
template <typename StringType>CommandLine CommandLineFromInitializerList (std::initializer_list<StringType> argv)Builds a |CommandLine| from an initializer list of |std::string|s or things
that implicitly convert to |std::string|.
Defined at line 222 of file ../../src/lib/fxl/command_line.h
-
template <typename T>RefPtr<T> Ref (T * ptr)Constructs a |RefPtr
<T
>| from a plain pointer (to an object that must
have already been adopted). Avoids having to spell out the full type name.
Foo* foo = ...;
auto foo_ref = Ref(foo);
(|foo_ref| will be of type |RefPtr
<Foo
>|.)
Defined at line 237 of file ../../src/lib/fxl/memory/ref_ptr.h
-
template <typename Ttypename... Args>RefPtr<T> MakeRefCounted (Args &&... args)Creates an intrusively reference counted |T|, producing a |RefPtr
<T
>| (and
performing the required adoption). Use like:
auto my_foo = MakeRefCounted
<Foo
>(ctor_arg1, ctor_arg2);
(|my_foo| will be of type |RefPtr
<Foo
>|.)
Defined at line 248 of file ../../src/lib/fxl/memory/ref_ptr.h