2#include <NDEVR/Buffer.h>
3#include <NDEVR/String.h>
5#include <NDEVR/Scanner.h>
6#include <NDEVR/INIFactory.h>
7#include <NDEVR/ApplicationResource.h>
8#include <NDEVR/Translator.h>
48 uint04 end_index = s.
indexOf(end_seq,
'\\',
false, start_index);
51 s = s.
substr(start_index, end_index);
57 if (s.size() > 0 && s.last() ==
'"')
63 end_index = s2.
indexOf(end_seq,
false, start_index);
64 s += s2.
substr(1, end_index);
67 lib_assert(
IsValid(end_index),
"Unexpected end of file found");
81 lib_assert(old_option == value,
"duplicate translation with differing definition");
118 parts[0].trimWhiteSpace();
119 parts[1].trimWhiteSpace();
120 if (parts.size() > 2)
122 while (!parts[0].contains(
'\"', 1))
124 parts[0] +=
"," + parts[1];
125 parts.removeIndex(1);
127 while (!parts[1].contains(
'\"', 1))
129 parts[1] +=
"," + parts[2];
130 parts.removeIndex(2);
133 parts[0].trimWhiteSpace();
134 parts[0].removeLast();
135 parts[1].trimWhiteSpace();
137 addOption(translator, parts[0], parts[1]);
145 uint04 end_index = s.
indexOf(
"\", nullptr",
false, start_index);
149 parts[0].trimWhiteSpace();
150 parts[1].trimWhiteSpace();
151 if (parts.size() > 2)
153 while (!parts[0].contains(
'\"', 1))
155 parts[0] +=
"," + parts[1];
156 parts.removeIndex(1);
158 while (parts[1].size() > 1 && !parts[1].contains(
'\"', 1) && parts.size() > 2)
160 parts[1] +=
"," + parts[2];
161 parts.removeIndex(2);
164 parts[0].trimWhiteSpace();
165 parts[0].removeLast();
166 parts[1].trimWhiteSpace();
168 parts[1].trimWhiteSpace();
169 parts[1].removeIndex(0);
170 if (!parts[1].isSameNoCase(
"Form"))
184 if (
file.isDirectory())
187 for (
const File& f : children)
205 if (
file.isDirectory())
207 if (
file.getFolderName() ==
"Resources" ||
file.getFolderName() ==
"Bin" ||
file.getFolderName() ==
"libraries" ||
file.getFolderName() ==
"ThirdParty")
211 for (
const File& f : children)
223 uint04 start = iter.value()->indexOf(
'[');
224 uint04 end = iter.value()->indexOf(
']') + 1;
228 iter.value()->replace(substring,
"{" +
String(substring.
hash()) +
"}");
229 start = iter.value()->
indexOf(
'[');
230 end = iter.value()->indexOf(
']') + 1;
241 for (
auto iter = dictionary.begin(); iter != dictionary.end(); iter++)
243 if (!reference.contains(iter.key()))
247 String other_val = reference.
get(iter.key());
256 iter.value()->
replace(replace_substring, search_string);
257 other_val.
replace(search_string, replace_substring);
258 o_start = other_val.
indexOf(
'[');
259 o_end = other_val.
indexOf(
']') + 1;
272 file.expandEnvironmentalVars();
277 for (
File dir : roots)
279 if (dir.endsWith(
"\\Headers\\"))
281 if (dir.endsWith(
"\\Source\\"))
283 if (dir.endsWith(
"\\Generated\\"))
290 for (
const File& f : files)
298 for (
uint04 i = 0; i < other_translations.size(); i++)
303 if (other_translations[i] != master && other_translations[i] != hash_master)
308 if (other_translations[i].endsWith(
".hash"))
311 if (other_translations[i].endsWith(
".hash"))
315 File f = other_translations[i];
static Resource< TranslatedString > application_name
The display name of the application.
The equivelent of std::vector but with a bit more control.
void add(t_type &&object)
Adds object to the end of the buffer.
A hash-based key-value store, useful for quick associative lookups.
const t_value & get(const t_key_type &key) const
Retrieves a const reference to the value associated with the given key.
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
@ e_file_extension
The file extension (e.g., ".txt").
bool exists() const
Checks whether this file or directory exists on disk.
void setPath(const StringView &path, uint01 part)
Sets a specific part of the file path.
Contains methods for easily reading and writing to an INI file including efficient casting,...
void writeToAsciiFile(File &file, bool include_end_comment=false)
Writes all registered options to an ASCII-formatted INI file.
void setPreserveOrder(bool preserve_order)
Sets whether to preserve the order in which options appear in the file.
void setUseHashLabels(bool use_hash_labels)
Enables or disables using hashed labels for option lookup.
void readAsciiFile(File &file)
Reads all options from an ASCII-formatted INI file.
Dictionary< String, String * > & extraOptionsRef()
Returns a mutable reference to the extra options dictionary.
bool hasOption(const StringView &option) const
Checks whether an option with the given label has been registered.
Dictionary< String, String > extraOptions() const
Returns a copy of all extra (unregistered) options as key-value pairs.
bool addManagedOption(const StringView &option_label, const StringView &option, bool replace=true)
Adds or updates a managed string option that is stored internally by the factory.
String getOption(const StringView &option, const StringView &default_value=StringView()) const
Retrieves the string value of a registered or extra option by label.
Contains methods for easily reading objects in an ascii stream using set deliminators and line logic.
const String & currentLine() const
Returns a const reference to the current line being parsed.
virtual bool nextLine()
Advances the scanner to the next line in the stream.
The core String View class for the NDEVR API.
StringView substr(uint04 start) const
Creates a substring from a given start position, to the end of the string.
static StringViewBuffer Convert(const StringBuffer &strings)
Converts a StringBuffer into a StringViewBuffer.
uint04 indexOf(const StringView &sub_string, bool ignore_case=false, uint04 start_index=0) const
Given a substring specified by the input, returns the first index of that string, if it exists.
constexpr uint08 hash() const
Creates a simple, quick hash of the object.
StringViewBuffer split(char delimiter, bool preserve_empty=true) const
Given a delimiter, breaks the string into subsections, returning an array of each subsection.
The core String class for the NDEVR API.
StringView substr(uint04 start) const
Creates a substring from a given start position, to the end of the string.
uint04 indexOf(const StringView &sub_string, bool ignore_case=false, uint04 start_index=0) const
Given a substring specified by the input, returns the first index of that string, if it exists.
String & trimWhiteSpace()
Trims any white space (tabs, spaces, etc) from the beginning and end of the string.
bool beginsWith(const StringView &s, bool ignore_case=false) const
Tests if this String starts with the specified prefix.
String & replace(const StringView &sub_string, const StringView &replace_sub_string, bool ignore_case=false, uint04 start_index=0)
Replaces ALL instances of a given substring with the provided replacement.
static String DefaultReadableLabel(const StringView &text_string)
Generates a default human-readable label from a text string.
The primary namespace for the NDEVR SDK.
static constexpr bool IsValid(const Angle< t_type > &value)
Checks whether the given Angle holds a valid value.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
static constexpr bool IsInvalid(const Angle< t_type > &value)
Checks whether the given Angle holds an invalid value.
@ file
The source file path associated with this object.