BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Functions | |
MVVM_MODEL_EXPORT std::string | DoubleToString (double input, int precision=12) |
Returns string representation of double with given precision. More... | |
bool | is_binary (const std::string &filename) |
Returns true if file is binary. More... | |
bool | is_text (const std::string &filename) |
Returns true if file is text/ascii. More... | |
MVVM_MODEL_EXPORT std::vector< double > | ParseSpaceSeparatedDoubles (const std::string &str) |
Parses string for double values and returns result as a vector. More... | |
MVVM_MODEL_EXPORT void | ParseSpaceSeparatedDoubles (const std::string &str, std::vector< double > &result) |
Parses string for double values and stores result in a vector. More... | |
MVVM_MODEL_EXPORT std::string | RemoveRepeatedSpaces (std::string str) |
Removes repeating spaces for a string. More... | |
MVVM_MODEL_EXPORT std::string | ScientificDoubleToString (double input, int precision=6) |
Returns string representation of scientific double. More... | |
MVVM_MODEL_EXPORT std::vector< std::string > | SplitString (const std::string &str, const std::string &delimeter) |
Split string on substring using given delimeter. Reproduces Python's str.split() behavior. More... | |
MVVM_MODEL_EXPORT std::optional< double > | StringToDouble (const std::string &str) |
Converts string to double value using classc locale and returns it in the form of optional. More... | |
MVVM_MODEL_EXPORT std::optional< int > | StringToInteger (const std::string &str) |
Converts string to integer. More... | |
MVVM_MODEL_EXPORT std::string | TrimWhitespace (const std::string &str) |
Returns string after trimming whitespace surrounding, including tabs and carriage returns. More... | |
MVVM_MODEL_EXPORT std::string ModelView ::Utils::DoubleToString | ( | double | input, |
int | precision = 12 |
||
) |
Returns string representation of double with given precision.
Provides additional formatting on top of iomanip, so "double x{0}" becomes "0.0".
Referenced by TEST_F().
MVVM_MODEL_EXPORT bool ModelView ::Utils::ModelView::Utils::is_binary | ( | const std::string & | filename | ) |
Returns true if file is binary.
Definition at line 33 of file binutils.cpp.
References BYTE_LENGTH, and FileSystemUtils::filename().
Referenced by is_text(), TEST_F(), and gui2::ImportFileWidget::validateForBinaryFiles().
MVVM_MODEL_EXPORT bool ModelView ::Utils::ModelView::Utils::is_text | ( | const std::string & | filename | ) |
Returns true if file is text/ascii.
Definition at line 53 of file binutils.cpp.
References FileSystemUtils::filename(), and is_binary().
Referenced by TEST_F().
MVVM_MODEL_EXPORT std::vector<double> ModelView ::Utils::ParseSpaceSeparatedDoubles | ( | const std::string & | str | ) |
Parses string for double values and returns result as a vector.
All non-numeric symbols are ingored.
Referenced by TEST_F().
MVVM_MODEL_EXPORT void ModelView ::Utils::ParseSpaceSeparatedDoubles | ( | const std::string & | str, |
std::vector< double > & | result | ||
) |
Parses string for double values and stores result in a vector.
All non-numeric symbols are ingored.
MVVM_MODEL_EXPORT std::string ModelView ::Utils::RemoveRepeatedSpaces | ( | std::string | str | ) |
Removes repeating spaces for a string.
Referenced by gui2::Utils::CreateSeparatorBasedSplitter(), and TEST_F().
MVVM_MODEL_EXPORT std::string ModelView ::Utils::ScientificDoubleToString | ( | double | input, |
int | precision = 6 |
||
) |
Returns string representation of scientific double.
Provides additional formatting on top of iomanip, so "double x{1}" becomes "1.0e+00".
Referenced by TEST_F().
MVVM_MODEL_EXPORT std::vector<std::string> ModelView ::Utils::SplitString | ( | const std::string & | str, |
const std::string & | delimeter | ||
) |
Split string on substring using given delimeter. Reproduces Python's str.split() behavior.
Referenced by gui2::Utils::CreateSeparatorBasedSplitter(), gui2::Utils::ExpandLineNumberPattern(), and TEST_F().
MVVM_MODEL_EXPORT std::optional<double> ModelView ::Utils::StringToDouble | ( | const std::string & | str | ) |
Converts string to double value using classc locale and returns it in the form of optional.
Requires that string represents exactly one double and contains no other literals. Empty spaces at the beginning and end of the string are still allowed.
Referenced by gui2::Utils::ExtractTwoColumns(), and TEST_F().
MVVM_MODEL_EXPORT std::optional<int> ModelView ::Utils::StringToInteger | ( | const std::string & | str | ) |
Converts string to integer.
Requires that string represents exactly one integer and no extra symbols are defined. Empty spaces at the beginning and end of the string are still allowed.
Referenced by gui2::Utils::ExpandLineNumberPattern(), and TEST_F().
MVVM_MODEL_EXPORT std::string ModelView ::Utils::TrimWhitespace | ( | const std::string & | str | ) |
Returns string after trimming whitespace surrounding, including tabs and carriage returns.
Referenced by gui2::Utils::CreateSeparatorBasedSplitter(), and TEST_F().