Simple string set class for use in the dtSearch C++ Support classes and sample code.
class DStringSet;
dstring.h
Usually the text in a DStringSet is stored as UTF-8, although any single-byte character set can be used.
In the dtSearch Engine's C++ API, several API elements expect a set of strings, such as the folders to index in dtsIndexJob or the indexes to search in dtsSearchJob, formatted as a null-delimited string set Each string is separated by a single null character, with a double-null at the end, like this:
"First string\0 Second string\0 Third string \0\0"
DStringSet provides a class to construct this type of string set. To create a null-delimited string set from a set of strings, declare a DStringSet, call append() with each string, and then call getBuffer() to get the start of the buffer. Example:
DStringSet excludeFilters;
excludeFilters.append("*.exe");
excludeFilters.append("*.dll");
excludeFilters.append("*.fon");
dtsIndexJob indexJob;
indexJob.toAdd.excludeFilters = excludeFilters.getBuffer();|
Method |
Description |
|
This is the overview for the append method overload. | |
|
Append a field-value pair (appends the field name, then appends the value) | |
|
Append a string to this set only if it is not already present | |
|
Append a Unicode string to the set (converting to UTF8) | |
|
Clear all strings from the set | |
|
This is the overview for the copy method overload. | |
|
Copy a set from a buffer containing a null-delimited string set, terminated by a double null | |
|
Remove a string from the set | |
|
This is the overview for the DStringSet constructor overload. | |
|
Find a string in the set | |
|
Search for a field name. | |
|
Find a string starting with a prefix | |
|
Format the set as a delimited, quoted string, minimizing the use of quotation marks | |
|
Format the set as a delimited, quoted string (assumes values contain no quotes) | |
|
Format the set as field: value pairs | |
|
Returns the start of the buffer containing the strings in this set | |
|
Return the number of strings in the set | |
|
Retrieve a field value by name. | |
|
Return last string from the set | |
|
Return the size of the data in the buffer | |
|
Read lines of text from a file into a string set | |
|
Read lines of text from a file into a string set (UTF-8 filename) | |
|
Return one string from the set | |
|
Append a string to this set only if it is not already present, using a case-insensitive search | |
|
Find a string in the set (case-insensitive) | |
|
Find a string starting with a prefix (case-insensitive) | |
|
Append all strings in another set that are not already present, using a case-insensitive search | |
|
Parse lines of text from a text buffer into a string set | |
|
Insert a string as the first string in this set | |
|
Find a string starting with a prefix, searching in reverse order | |
|
Sort strings in the set in alphabetical order | |
|
This is the overview for the tokenize method overload. | |
|
Create a string set from a delimited string, allowing for quotation | |
|
Append all strings in another set that are not already present |
|
Operator |
|
Method |
|
Copyright (c) 1995-2012 dtSearch Corp. All rights reserved.
|