Commit 11f5d56d authored by Pawel Sznajder's avatar Pawel Sznajder
Browse files

Merge branch 'new_channels_this_is_it' into 'master'

Partons v2

See merge request !3
parents 19899287 5be5e1c9
......@@ -38,7 +38,7 @@ PROJECT_NAME = PARTONS/ElementaryUtils
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 1.0
PROJECT_NUMBER = 2.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
......@@ -228,8 +228,7 @@ TAB_SIZE = 8
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines.
ALIASES = "st{1}=\htmlonly<span style='text-decoration:line-through'>\1</span>\endhtmlonly" \
"color{2}=\htmlonly<span style='color:\1'>\2</span>\endhtmlonly"
ALIASES = "st{1}=\htmlonly<span style='text-decoration:line-through'>\1</span>\endhtmlonly" "color{2}=\htmlonly<span style='color:\1'>\2</span>\endhtmlonly"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
......@@ -529,7 +528,7 @@ HIDE_SCOPE_NAMES = NO
# YES the compound reference will be hidden.
# The default value is: NO.
HIDE_COMPOUND_REFERENCE= NO
HIDE_COMPOUND_REFERENCE = NO
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
# the files that are included by a file in the documentation of that file.
......@@ -633,7 +632,7 @@ GENERATE_BUGLIST = YES
# the documentation.
# The default value is: YES.
GENERATE_DEPRECATEDLIST= YES
GENERATE_DEPRECATEDLIST = YES
# The ENABLED_SECTIONS tag can be used to enable conditional documentation
# sections, marked by \if <section_label> ... \endif and \cond <section_label>
......@@ -781,8 +780,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
INPUT = src \
include
INPUT = src include
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
......
......@@ -42,6 +42,10 @@ public:
std::string getString(const std::string & section, const std::string & key);
std::string getString(const std::string & key);
bool checkIfAvailable(const std::string & section,
const std::string & key) const;
bool checkIfAvailable(const std::string & key) const;
std::string getPropertiesFilePath() const;
private:
......
......@@ -15,7 +15,6 @@
namespace ElemUtils {
/**
* @class IniFileParser
* @brief
......@@ -39,9 +38,14 @@ public:
void parse(const std::string & configFilePath);
std::map<std::string, std::string> getValues();
std::string getString(const std::string & key);
std::string getString(const std::string & section, const std::string & key);
bool checkIfAvailable(const std::string & section,
const std::string & key) const;
bool checkIfAvailable(const std::string & key) const;
const std::string& getFilePath() const;
private:
......@@ -57,7 +61,7 @@ private:
void analyseValue(const std::string & fileLine,
const std::string & sectionName);
std::string makeKey(const std::string & sectionName,
const std::string & key);
const std::string & key) const;
};
} // namespace ElemUtils
......
......@@ -72,6 +72,9 @@ public:
// Remove leading and trailing spaces from a string
static void trim(std::string &str, const std::string& whitespace = " \t");
// Remove all white spaces from a string
static void trimAll(std::string &str, const std::string& whitespace = " \t");
static unsigned int count(std::string str,
const std::string & searchString);
......
......@@ -60,6 +60,20 @@ std::string PropertiesManager::getString(const std::string & key) {
return m_iniFileParser.getString(key);
} // mutex.unlock()
bool PropertiesManager::checkIfAvailable(const std::string & section,
const std::string & key) const {
sf::Lock lock(m_mutex); // mutex.lock()
return m_iniFileParser.checkIfAvailable(section, key);
} // mutex.unlock()
bool PropertiesManager::checkIfAvailable(const std::string & key) const {
sf::Lock lock(m_mutex); // mutex.lock()
return m_iniFileParser.checkIfAvailable(key);
} // mutex.unlock()
} // namespace ElemUtils
std::string ElemUtils::PropertiesManager::getPropertiesFilePath() const {
......
......@@ -122,7 +122,7 @@ void IniFileParser::analyseValue(const std::string & fileLine,
}
std::string IniFileParser::makeKey(const std::string & sectionName,
const std::string & key) {
const std::string & key) const {
// if the section's name is empty then returns only the key
// else returns the section name concatenated with the value of the key
return (sectionName == StringUtils::EMPTY) ?
......@@ -151,6 +151,15 @@ std::string IniFileParser::getString(const std::string & section,
<< "\" in file \"" << m_filePath << "\"");
}
bool IniFileParser::checkIfAvailable(const std::string & section,
const std::string & key) const {
return (m_values.find(makeKey(section, key)) != m_values.end());
}
bool IniFileParser::checkIfAvailable(const std::string & key) const {
return (m_values.find(makeKey(StringUtils::EMPTY, key)) != m_values.end());
}
std::map<std::string, std::string> IniFileParser::getValues() {
return m_values;
}
......
......@@ -181,6 +181,15 @@ void StringUtils::trim(std::string &str, const std::string& whitespace) {
}
}
void StringUtils::trimAll(std::string &str, const std::string& whitespace) {
std::string::const_iterator it;
for (it = whitespace.begin(); it != whitespace.end(); ++it) {
str.erase(std::remove(str.begin(), str.end(), *it), str.end());
}
}
unsigned int StringUtils::count(std::string str,
const std::string & searchString) {
unsigned int resultat = 0;
......@@ -367,7 +376,8 @@ size_t StringUtils::findFirst(const std::string& file,
return fileSize;
}
std::string StringUtils::formatDate(const time_t &time, const std::string &format) {
std::string StringUtils::formatDate(const time_t &time,
const std::string &format) {
// see : http://stackoverflow.com/questions/16357999/current-date-and-time-as-string
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment