Skip to content
Snippets Groups Projects
Commit f5e30a64 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

add poly logo + comments stuff

parent cd14a880
Branches
No related tags found
No related merge requests found
doc/images/polytechnique.jpg

54.6 KiB

......@@ -33,9 +33,8 @@ class AudioDevice {
public:
/**
* Constructor
* @param id
* @param
* @param
* @param id Identifier
* @param name Name
*/
AudioDevice(int id, const std::string& name);
......
......@@ -127,8 +127,8 @@ class AudioLayer {
/**
* Send a chunk of data to the hardware buffer to start the playback
* Copy data in the urgent buffer.
* @params buffer The buffer containing the data to be played ( ringtones )
* @params toCopy The size of the buffer
* @param buffer The buffer containing the data to be played ( ringtones )
* @param toCopy The size of the buffer
* @return int The number of bytes copied in the urgent buffer
*/
int putUrgent(void* buffer, int toCopy);
......@@ -158,7 +158,7 @@ class AudioLayer {
/**
* Scan the sound card available on the system
* @param flag To indicate whether we are looking for capture devices or playback devices
* @param stream To indicate whether we are looking for capture devices or playback devices
* SFL_PCM_CAPTURE
* SFL_PCM_PLAYBACK
* SFL_PCM_BOTH
......
......@@ -35,7 +35,7 @@ class DTMF {
public:
/**
* Create a new DTMF.
* @param samplingRate frequency of the sample (ex: 8000 hz)
* @param sampleRate frequency of the sample (ex: 8000 hz)
*/
DTMF (unsigned int sampleRate);
......
......@@ -26,131 +26,153 @@
#include <list>
/**
* Configuration namespace for ConfigTree object (like .ini files)
* @file config.h
* @brief Configuration namespace for ConfigTree object (like .ini files)
*/
namespace Conf {
class ConfigTreeItem;
typedef std::map<std::string, ConfigTreeItem> ItemMap;
typedef std::map<std::string, ItemMap*> SectionMap;
typedef std::list<std::string> TokenList;
class ConfigTreeItemException {
public:
ConfigTreeItemException() {}
~ConfigTreeItemException() {}
};
class ConfigTree;
class ConfigTreeIterator
{
public:
TokenList begin();
const TokenList& end() const { return _endToken; }
TokenList next();
private:
friend class ConfigTree;
ConfigTreeIterator(ConfigTree *configTree) : _tree(configTree) {}
ConfigTree* _tree;
TokenList _endToken;
SectionMap::iterator _iter;
ItemMap::iterator _iterItem;
};
class ConfigTree {
public:
ConfigTree();
~ConfigTree();
void createSection(const std::string& section);
void removeSection(const std::string& section);
/**
* Return an array of strings, listing the sections of the config file
*
* This will be mainly used to filter which sections are an
* "Account" definition.
*
* @return array Strings of the sections
*/
TokenList getSections();
void addConfigTreeItem(const std::string& section, const ConfigTreeItem item);
/**
* Set a configuration value.
*
* @param section Write to this [section] of the .ini file
* @param itemName The itemName= in the .ini file
* @param value The value to assign to that itemName
*/
bool setConfigTreeItem(const std::string& section, const std::string& itemName, const std::string& value);
/**
* Get a value.
*
* This function does all the validity tests, so none are needed throughout
* the program.
*
* @param section The name of the [section] in the .ini file.
* @param itemName The name of the item= in the .ini file.
* @return The value of the corresponding item. The default value if the section exists
* but the item doesn't.
*/
std::string getConfigTreeItemValue(const std::string& section, const std::string& itemName);
int getConfigTreeItemIntValue(const std::string& section, const std::string& itemName);
/**
* Flush data to .ini file
*/
bool saveConfigTree(const std::string& fileName);
/**
* Load data (and fill ConfigTree) from disk
*/
int populateFromFile(const std::string& fileName);
bool getConfigTreeItemToken(const std::string& section, const std::string& itemName, TokenList& arg);
private:
ConfigTreeItem* getConfigTreeItem(const std::string& section, const std::string& itemName);
/**
* List of sections. Each sections has an ItemList as child
*/
SectionMap _sections;
friend class ConfigTreeIterator;
public:
ConfigTreeIterator createIterator() {
return ConfigTreeIterator(this);
}
};
class ConfigTreeItem {
public:
ConfigTreeItem() : _defaultValue(""), _type("string") {}
// defaultvalue = value
ConfigTreeItem(const std::string& name, const std::string& value, const std::string& type) :
_name(name), _value(value),
_defaultValue(value), _type(type) {}
ConfigTreeItem(const std::string& name, const std::string& value, const std::string& defaultValue, const std::string& type) :
_name(name), _value(value),
_defaultValue(defaultValue), _type(type) {}
~ConfigTreeItem() {}
void setValue(const std::string& value) { _value = value; }
const std::string getName() const { return _name; }
const std::string getValue() const { return _value; }
const std::string getDefaultValue() const { return _defaultValue; }
const std::string getType() const { return _type; }
private:
std::string _name;
std::string _value;
std::string _defaultValue;
std::string _type;
};
class ConfigTreeItem;
typedef std::map<std::string, ConfigTreeItem> ItemMap;
typedef std::map<std::string, ItemMap*> SectionMap;
typedef std::list<std::string> TokenList;
class ConfigTreeItemException {
public:
/**
* Constructor
* */
ConfigTreeItemException() {}
/**
* Destructor
* */
~ConfigTreeItemException() {}
};
class ConfigTree;
class ConfigTreeIterator
{
public:
/**
* Parsing method
* @return TokenList
*/
TokenList begin();
/**
* Parsing method
* @return TokenList
*/
const TokenList& end() const { return _endToken; }
/**
* Parsing method
* @return TokenList
*/
TokenList next();
private:
friend class ConfigTree;
ConfigTreeIterator(ConfigTree *configTree) : _tree(configTree) {}
ConfigTree* _tree;
TokenList _endToken;
SectionMap::iterator _iter;
ItemMap::iterator _iterItem;
};
class ConfigTree {
public:
ConfigTree();
~ConfigTree();
void createSection(const std::string& section);
void removeSection(const std::string& section);
/**
* Return an array of strings, listing the sections of the config file
*
* This will be mainly used to filter which sections are an
* "Account" definition.
*
* @return array Strings of the sections
*/
TokenList getSections();
void addConfigTreeItem(const std::string& section, const ConfigTreeItem item);
/**
* Set a configuration value.
*
* @param section Write to this [section] of the .ini file
* @param itemName The itemName= in the .ini file
* @param value The value to assign to that itemName
*/
bool setConfigTreeItem(const std::string& section, const std::string& itemName, const std::string& value);
/**
* Get a value.
*
* This function does all the validity tests, so none are needed throughout
* the program.
*
* @param section The name of the [section] in the .ini file.
* @param itemName The name of the item= in the .ini file.
* @return The value of the corresponding item. The default value if the section exists
* but the item doesn't.
*/
std::string getConfigTreeItemValue(const std::string& section, const std::string& itemName);
int getConfigTreeItemIntValue(const std::string& section, const std::string& itemName);
/**
* Flush data to .ini file
*/
bool saveConfigTree(const std::string& fileName);
/**
* Load data (and fill ConfigTree) from disk
*/
int populateFromFile(const std::string& fileName);
bool getConfigTreeItemToken(const std::string& section, const std::string& itemName, TokenList& arg);
private:
ConfigTreeItem* getConfigTreeItem(const std::string& section, const std::string& itemName);
/**
* List of sections. Each sections has an ItemList as child
*/
SectionMap _sections;
friend class ConfigTreeIterator;
public:
ConfigTreeIterator createIterator() {
return ConfigTreeIterator(this);
}
};
class ConfigTreeItem {
public:
ConfigTreeItem() : _defaultValue(""), _type("string") {}
// defaultvalue = value
ConfigTreeItem(const std::string& name, const std::string& value, const std::string& type) :
_name(name), _value(value),
_defaultValue(value), _type(type) {}
ConfigTreeItem(const std::string& name, const std::string& value, const std::string& defaultValue, const std::string& type) :
_name(name), _value(value),
_defaultValue(defaultValue), _type(type) {}
~ConfigTreeItem() {}
void setValue(const std::string& value) { _value = value; }
const std::string getName() const { return _name; }
const std::string getValue() const { return _value; }
const std::string getDefaultValue() const { return _defaultValue; }
const std::string getType() const { return _type; }
private:
std::string _name;
std::string _value;
std::string _defaultValue;
std::string _type;
};
} // end namespace ConfigTree
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment