forked from xsmart/tmf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
286 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,66 @@ | ||
/* | ||
* | ||
* Tiny Multimedia Framework | ||
* Copyright (C) 2014 Arash Shafiei | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#ifndef ATTRIBUTE_H_ | ||
#define ATTRIBUTE_H_ | ||
|
||
#include <map> | ||
|
||
using namespace std; | ||
|
||
class Attribute { | ||
private: | ||
map<string, string> props; /**< The map containing the message (key, value). */ | ||
|
||
public: | ||
/*! | ||
* Get the message value by passing the key | ||
* | ||
* \param key the key to retrieve the message value | ||
*/ | ||
string getProp(const string & key) { | ||
auto k = props.find(key); | ||
|
||
if (k == props.end()) | ||
return ""; | ||
|
||
return props[key]; | ||
} | ||
|
||
/*! | ||
* Set the string message by key and value | ||
* | ||
* \param key the key of the message | ||
* \param val the string value of the message | ||
* | ||
*/ | ||
template <typename T> | ||
void setProp(const string & key, const T& val) { | ||
string valstr = to_string(val); | ||
props.insert(std::make_pair(key, valstr)); | ||
} | ||
|
||
void setProp(const string & key, const string& val) { | ||
props.insert(std::make_pair(key, val)); | ||
} | ||
|
||
}; | ||
|
||
#endif /* ATTRIBUTE_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.