15 #ifndef BORNAGAIN_GUI2_DATALOADER_DATALOADER_UTILS_H
16 #define BORNAGAIN_GUI2_DATALOADER_DATALOADER_UTILS_H
22 struct GraphImportData;
27 DAREFLCORE_EXPORT std::vector<std::string>
LoadASCIIFile(
const std::string& file_name);
31 DAREFLCORE_EXPORT std::vector<std::pair<int, int>>
46 DAREFLCORE_EXPORT std::string
AddHtmlDivTag(
const std::string& line);
49 DAREFLCORE_EXPORT std::string
AddHtmlColorTag(
const std::string& line,
const std::string& color);
53 const std::string& color);
57 const std::vector<std::string>& parts,
58 const std::string& color_parts,
59 const std::string& color_rest);
66 DAREFLCORE_EXPORT std::pair<std::vector<double>, std::vector<double>>
67 ExtractTwoColumns(
const std::vector<std::vector<std::string>>& text_data,
size_t col1,
size_t col2);
73 DAREFLCORE_EXPORT std::vector<std::pair<ColumnInfo, ColumnInfo>>
DAREFLCORE_EXPORT std::vector< std::string > LoadASCIIFile(const std::string &file_name)
Loads ASCII file, returns it in the form of vector of strings.
DAREFLCORE_EXPORT accept_int_t CreateLineNumberPatternValidator(const std::string &pattern)
Creates a callback to define if given line number satisfies line number pattern.
DAREFLCORE_EXPORT std::pair< std::vector< double >, std::vector< double > > ExtractTwoColumns(const std::vector< std::vector< std::string >> &text_data, size_t col1, size_t col2)
Extracts double values from two columns of a string array.
DAREFLCORE_EXPORT line_splitter_t CreateSeparatorBasedSplitter(const std::string &separator)
Creates line splitter based on separator.
DAREFLCORE_EXPORT accept_string_t CreateLinePrefixValidator(const std::string &prefix_to_exclude)
Creates a callback to define if given line has a valid content for further parsing.
DAREFLCORE_EXPORT std::string AddHtmlColorTagToParts(const std::string &line, const std::vector< std::string > &parts, const std::string &color_parts, const std::string &color_rest)
Returns string representing original 'line', where 'parts' are surrounded with color tag.
DAREFLCORE_EXPORT std::string AddHtmlDivTag(const std::string &line)
Returns string representing original 'line' wrapped in 'div' tag.
DAREFLCORE_EXPORT std::vector< std::pair< ColumnInfo, ColumnInfo > > CreateGraphInfoPairs(const std::vector< ColumnInfo > &column_info)
Pack ColumnInfo into pairs representing {AxisType, IntensityType}.
DAREFLCORE_EXPORT std::vector< std::pair< int, int > > ExpandLineNumberPattern(const std::string &pattern)
Expands string representing line number pattern to inclusive pairs of line numbers.
DAREFLCORE_EXPORT GraphImportData CreateData(const std::vector< std::vector< std::string >> &text_data, const ColumnInfo &axis, const ColumnInfo &intensity)
Creates structure from text data.
DAREFLCORE_EXPORT std::string AddHtmlColorTag(const std::string &line, const std::string &color)
Returns string representing original 'line' wrapped in html color tag.
DAREFLCORE_EXPORT std::string AddHtmlBackgroundTag(const std::string &line, const std::string &color)
Returns string representing original 'line' wrapped in 'div' tag.
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
std::function< bool(const std::string &line)> accept_string_t
Function to define if given string should be accepted for further consideration.
std::function< bool(int)> accept_int_t
Function to define if given index satisfies criteria.
std::function< std::vector< std::string >(const std::string &line)> line_splitter_t
Function to define line splitter according to some criteria.
Info about the column as defined by the user via ImportTableWidget.
Raw data to construct GraphItem and Data1DItem's.