Last change
on this file since 2285 was
1174,
checked in by oabramkina, 7 years ago
|
Two server levels: adding files deleted in the previous commit.
|
File size:
626 bytes
|
Rev | Line | |
---|
[1174] | 1 | #include <boost/uuid/uuid.hpp> |
---|
| 2 | #include <boost/uuid/uuid_generators.hpp> |
---|
| 3 | #include <boost/uuid/uuid_io.hpp> |
---|
| 4 | |
---|
| 5 | namespace xios |
---|
| 6 | { |
---|
| 7 | |
---|
| 8 | std::string getUuidStr(void) |
---|
| 9 | { |
---|
| 10 | boost::uuids::random_generator gen; |
---|
| 11 | boost::uuids::uuid u = gen(); |
---|
| 12 | return boost::uuids::to_string(u) ; |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | std::string getUuidStr(const std::string& format) |
---|
| 16 | { |
---|
| 17 | size_t pos ; |
---|
| 18 | std::string retStr(format) ; |
---|
| 19 | std::string uuid(getUuidStr()) ; |
---|
| 20 | std::string id("%uuid%"); |
---|
| 21 | pos=retStr.find(id) ; |
---|
| 22 | while(pos!=std::string::npos) |
---|
| 23 | { |
---|
| 24 | retStr.replace(pos,id.size(),uuid) ; |
---|
| 25 | pos=retStr.find(id) ; |
---|
| 26 | } |
---|
| 27 | return retStr; |
---|
| 28 | } |
---|
| 29 | } |
---|
| 30 | |
---|
Note: See
TracBrowser
for help on using the repository browser.