projects
/
laserbrain_demo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed bugs in the resource manager and removed the hardcoded textures
[laserbrain_demo]
/
src
/
datamap.cc
diff --git
a/src/datamap.cc
b/src/datamap.cc
index
626c47f
..
19aaf44
100644
(file)
--- a/
src/datamap.cc
+++ b/
src/datamap.cc
@@
-4,7
+4,7
@@
#include <vector>
#include <map>
#include <string>
#include <vector>
#include <map>
#include <string>
-#include <regex>
+//#include <regex>
#include "datamap.h"
#ifdef WIN32
#include "datamap.h"
#ifdef WIN32
@@
-15,13
+15,13
@@
static char *clean_line(char *s);
static char *clean_line(char *s);
-static std::vector<std::pair<std::regex, std::string>> dmap;
+//static std::vector<std::pair<std::regex, std::string>> dmap;
+static std::vector<std::pair<std::string, std::string>> dmap;
static std::map<std::string, std::string> cache;
static std::string root;
void datamap_reset()
{
static std::map<std::string, std::string> cache;
static std::string root;
void datamap_reset()
{
- root.clear();
dmap.clear();
cache.clear();
}
dmap.clear();
cache.clear();
}
@@
-64,8
+64,10
@@
bool datamap_load_map(const char *fname)
}
*colon = 0;
}
*colon = 0;
- std::pair<std::regex, std::string> pair;
- pair.first = std::regex(line);
+ //std::pair<std::regex, std::string> pair;
+ //pair.first = std::regex(line);
+ std::pair<std::string, std::string> pair;
+ pair.first = std::string(line);
char *value = clean_line(colon + 1);
if(!value || !*value) {
char *value = clean_line(colon + 1);
if(!value || !*value) {
@@
-88,8
+90,10
@@
err:
void datamap_map(const char *re, const char *path)
{
void datamap_map(const char *re, const char *path)
{
- std::pair<std::regex, std::string> mapping;
- mapping.first = std::regex(re);
+ //std::pair<std::regex, std::string> mapping;
+ //mapping.first = std::regex(re);
+ std::pair<std::string, std::string> mapping;
+ mapping.first = std::string(re);
mapping.second = std::string(path);
dmap.push_back(std::move(mapping));
}
mapping.second = std::string(path);
dmap.push_back(std::move(mapping));
}
@@
-108,15
+112,17
@@
int datamap_lookup(const char *in, char *buf, int bsz)
res = it->second;
} else {
// try matching with the available mappings
res = it->second;
} else {
// try matching with the available mappings
+ res = std::string(in);
+
int num = dmap.size();
for(int i=0; i<num; i++) {
int num = dmap.size();
for(int i=0; i<num; i++) {
- if(std::regex_match(in, dmap[i].first)) {
+ //if(std::regex_search(in, dmap[i].first)) {
+ if(strstr(in, dmap[i].first.c_str())) {
res = root.empty() ? dmap[i].second : root + "/" + dmap[i].second;
cache[in] = res; // add it to the cache
break;
}
}
res = root.empty() ? dmap[i].second : root + "/" + dmap[i].second;
cache[in] = res; // add it to the cache
break;
}
}
- return 0;
}
// copy result in buf, truncating if necessary and return the size of the
}
// copy result in buf, truncating if necessary and return the size of the