51#ifndef Foam_CStringList_H
52#define Foam_CStringList_H
97 static inline char* stringCopy(
char* dest,
const char* src);
102 static inline char* stringCopy(
char *dest, std::string_view src);
108 static inline char* stringCopy(
char *dest,
const std::string& src);
112 template<
class ListType>
113 int resetContent(
const ListType& input);
136 std::initializer_list<const char* const> input
141 template<
class StringType>
150 inline explicit CStringList(
const std::vector<std::string_view>& input);
165 static inline int count(
const char *
const argv[]);
177 inline std::string_view
view()
const;
193 const char*
get(
int i)
const {
return argv_[i]; }
202 inline char**
strings(
int start)
const;
212 int reset(std::initializer_list<const char* const> input);
216 template<
class StringType>
219 return resetContent(input);
226 return resetContent(input);
234 template<
class StringType = std::
string>
239 template<
class StringType = std::
string>
246 const char*
operator[](
int i)
const {
return argv_[i]; }
265# include "CStringList.txx"
An adapter for copying a list of C++ strings into a list of C-style strings for passing to C code tha...
~CStringList()
Destructor. Invokes clear() to free memory.
int size() const noexcept
Return the number of C-strings (ie, argc).
const char * operator[](int i) const
Return element at the given index. No bounds checking.
static List< StringType > asList(int argc, const char *const argv[])
Create a list from argc/argv parameters.
static List< StringType > asList(const char *const argv[])
Create a list from a nullptr-terminated list of argv parameters.
constexpr CStringList() noexcept
Default construct, adding content later (via reset).
const char * data() const noexcept
Same as cdata_bytes().
static int count(const char *const argv[])
Count the number of parameters until the first nullptr.
bool empty() const noexcept
True if the size (ie, argc) is zero.
char ** strings() const noexcept
Return the list of C-strings (ie, argv).
void operator=(const CStringList &)=delete
No copy assignment.
int reset(std::initializer_list< const char *const > input)
Copy the input list of C-strings.
CStringList(const CStringList &)=delete
No copy construct.
std::string_view view() const
The flattened character content, with interspersed nul-chars.
int reset(const UList< StringType > &input)
Copy the input list of strings.
size_t length() const noexcept
Same as size_bytes().
size_t size_bytes() const noexcept
Overall length of the flattened character (data) content including interspersed nul-chars but not the...
const char * cdata_bytes() const noexcept
The flattened character content, with interspersed nul-chars.
void clear()
Clear contents and free memory.
int reset(const SubStrings &input)
Copy the input list of strings.
const char * get(int i) const
Return string element at the given index. No bounds checking.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Sub-ranges of a string with a structure similar to std::match_results, but without the underlying reg...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
OBJstream os(runTime.globalPath()/outputName)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).