69 switch ( src[psrc] ) {
72 dst[pdst] = src[psrc++];
76 if (n1 < 0 || n1 > 15 || n2 < 0 || n2 > 15) {
77 dst[pdst] = src[psrc++];
79 dst[pdst] = (n1 << 4) | n2;
86 dst[pdst] = src[psrc++];
99 list<string> *warning_messages)
101 settings_set.clear();
102 if (track_str.empty() )
return;
105 typedef vector<string>
TTokens;
116 if (key_value_pair.size() == 2) {
119 if ( !key_value_pair[0].
empty() &&
120 !key_value_pair[1].
empty() ) {
122 if (key_value_pair[0] ==
"name") {
123 string track_name = key_value_pair[1];
124 unsigned name_count = 1;
125 while (track_names.
end() != track_names.
find(track_name)) {
126 stringstream new_name;
127 new_name << key_value_pair[1] <<
" (" << ++name_count <<
')';
128 track_name = new_name.str();
130 track_names.
insert(track_name);
131 if (key_value_pair[1] != track_name) {
132 if (warning_messages) {
133 stringstream warning;
134 warning <<
"Track name \"" << key_value_pair[1] <<
"\" already exists. Using \"" << track_name <<
"\" instead.";
135 warning_messages->push_back(warning.str());
137 key_value_pair[1] = track_name;
142 if(key_value_pair[0] ==
"is_scaled") {
150 if ( !settings.
empty() ) {
155 GetKey(settings,
"id", sTMSId);
158 if(!TracksWithTheSameId.empty()) {
160 for(
const auto& iSettings: settings) {
161 duplicate_settings[iSettings.first] = iSettings.second;
167 GetKey(settings,
"annots", annots);
169 if (0 == settings.count(
"remote_path")) {
170 settings[
"remote_path"] = annots;
173 settings_set.push_back(settings);
184 if (k_iter != iter->end() &&
194 const string& track_name,
200 if (k_iter != iter->end() && n_iter != iter->end() &&
201 n_iter->second == track_name &&
244 if (key_iter != iter->end()) {
246 if (db_iter != iter->end() && db_iter->second ==
kBAM_DATA)
248 vector<string> mkeys;
250 ITERATE (vector<string>, mkey_iter, mkeys) {
252 if ( !
key.empty() ) {
266 TrackSettingsSetSelection.clear();
269 if (iTrackSettings != iTrackSettingsSet->end() &&
270 iTrackSettings->second ==
value) {
271 TrackSettingsSetSelection.push_back(iTrackSettingsSet);
281 if (key_iter == TrackSettings.
end()) {
284 value = key_iter->second;
300 const string& short_msg,
325 string::size_type
len =
str.length();
329 string::size_type pdst = 0;
331 for (string::size_type psrc = 0; psrc <
len; ++psrc) {
332 const char& curr_char =
str[psrc];
333 if (curr_char ==
'\\' && !escape ) {
336 out[pdst++] = curr_char;
354 vector<string>& tokens,
360 }
else if (delim.empty()) {
361 tokens.push_back(
str);
367 string::size_type pos = 0;
369 string curr_str =
"";
370 while (pos <
str.size()) {
371 const char& curr_char =
str[pos];
372 if (curr_char ==
'\\') {
380 bool match = delim.find(curr_char) != string::npos;
383 if ( !remove_escape ) {
384 curr_str.append(1,
'\\');
386 curr_str.append(1, curr_char);
388 }
else if ( !curr_str.empty() ) {
389 tokens.push_back(curr_str);
394 curr_str.append(1,
'\\');
395 curr_str.append(1, curr_char);
398 curr_str.append(1, curr_char);
404 if ( !curr_str.empty() ) {
405 tokens.push_back(curr_str);
container_type::const_iterator const_iterator
const_iterator end() const
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
std::ofstream out("events_result.xml")
main entry point for tests
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Warning(CExceptionArgs_Base &args)
static void SetError(TTrackSettings &TrackSettings, TTrackErrorStatus::TErrorSeverity severity, TTrackErrorStatus::TErrorCode code, const string &short_msg, const string &msg)
set error information in the track configuration error codes and such should correspond to ones in CH...
static const size_t cShortErrorLength
static void GetTrackSettingsSetSelection(TTrackSettingsSet &TrackSettingsSet, const string &key, const string &value, TTrackSettingsSetSelection &TrackSettingsSetSelection)
get all tracks that have a given value in a given key the entries in TrackSettingsSetSelection are va...
list< TTrackSettings > TTrackSettingsSet
static const string kStdTrackId
prefix for STD (as opposed to TMS) tracks
static const string cTrackSettingKey_ErrorShortMsg
if present contains the short error message
static void SetKey(TTrackSettings &TrackSettings, const string &key, const string &value)
static const string cTrackSettingKey_ErrorMsg
if present contains the error message
static const string cTrackSettingKey_ErrorSeverity
if present and set to anything, but CHTMLActiveArea::eErrorSeverity_NoError, do not attempt to load t...
static bool GetKey(const TTrackSettings &TrackSettings, const string &key, string &value)
returns a specified key; if it does not exist, returns false
static bool HasTrack(const string &track_key, const TTrackSettingsSet &settings_set)
Check if track settings contain the track of a given track key.
static bool isInErrorStatus(const TTrackSettings &TrackSettings)
check that the track is currently marked as having an error
static string RemoveEscape(const string &str)
remove escape characters ('\') used for escaping special characters in track settings values
static const string kRStdTrackId
prefix for Remote STD (as opposed to TMS) tracks
static const string cTrackSettingKey_PrivatePrefix
some internal reserved track setting keys that are used for internal communication always start with ...
static bool isRemoteData(const TTrackSettings &TrackSettings)
Returns true if the track uses remote (non NCBI hosted) data.
static bool isTMSId(const TTrackSettings &TrackSettings)
returns true if the track id in settings looks like a TMS track id (i.e.
static void TokenizeWithEscape(const string &str, const string &delim, vector< string > &tokens, bool remove_escape=false)
Tokenize a string using the delim.
vector< string > TDataKeys
static const string cTrackSettingKey_ErrorCode
if present contains the error code
list< TTrackSettingsSet::iterator > TTrackSettingsSetSelection
static TDataKeys GetAllDataKeys(const TTrackSettingsSet &settings_set)
Collect all data key values stored in 'data_key'.
static void ExtractTrackConfig(const string &track_str, TTrackSettingsSet &settings_set, list< string > *warning_messages=nullptr)
Extract the track settings from a setting string.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
NCBI_NS_STD::string::size_type SIZE_TYPE
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static string URLDecode(const CTempString str, EUrlDecode flag=eUrlDec_All)
URL-decode string.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static int HexChar(char ch)
Convert character to integer.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string.
@ eNocase
Case insensitive compare.
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::KEY key
static int match(register const pcre_uchar *eptr, register const pcre_uchar *ecode, const pcre_uchar *mstart, int offset_top, match_data *md, eptrblock *eptrb, unsigned int rdepth)
static const char * str(char *buf, int n)
static string s_SVURLDecode(const string &src)
static const string & kBAM_DATA
list< STokenInfo > TTokens