summaryrefslogtreecommitdiff
path: root/indra/lscript/lscript_compile/lscript_scope.h
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2014-05-29 04:54:58 -0700
committerGraham Linden <graham@lindenlab.com>2014-05-29 04:54:58 -0700
commita815ad481add3dea3f67f1c1c579ddb99d9a9f48 (patch)
treee3cf5b5b77246e8cf4917e613cbffe7e414be63c /indra/lscript/lscript_compile/lscript_scope.h
parentb703a612d7ca96e9c79f40a33208757bba6e9d7e (diff)
parent644ca6a0f8a7759119814f88df93b8e838321a12 (diff)
Mergeup to 3.7.9 viewer-release
Diffstat (limited to 'indra/lscript/lscript_compile/lscript_scope.h')
-rwxr-xr-xindra/lscript/lscript_compile/lscript_scope.h51
1 files changed, 23 insertions, 28 deletions
diff --git a/indra/lscript/lscript_compile/lscript_scope.h b/indra/lscript/lscript_compile/lscript_scope.h
index 5b2a73ad92..ffff91c81b 100755
--- a/indra/lscript/lscript_compile/lscript_scope.h
+++ b/indra/lscript/lscript_compile/lscript_scope.h
@@ -27,8 +27,8 @@
#ifndef LL_LSCRIPT_SCOPE_H
#define LL_LSCRIPT_SCOPE_H
-#include "string_table.h"
-#include "llmap.h"
+#include <map>
+#include "llstringtable.h"
#include "lscript_byteformat.h"
typedef enum e_lscript_identifier_type
@@ -301,13 +301,13 @@ public:
~LLScriptScope()
{
- mEntryMap.deleteAllData();
+ delete_and_clear(mEntryMap);
}
LLScriptScopeEntry *addEntry(const char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type)
{
const char *name = mSTable->addString(identifier);
- if (!mEntryMap.checkData(name))
+ if (mEntryMap.find(name) == mEntryMap.end())
{
if (idtype == LIT_FUNCTION)
mEntryMap[name] = new LLScriptScopeEntry(name, idtype, type, mFunctionCount++);
@@ -324,18 +324,10 @@ public:
}
}
- BOOL checkEntry(const char *identifier)
+ bool checkEntry(const char *identifier)
{
const char *name = mSTable->addString(identifier);
- if (mEntryMap.checkData(name))
- {
- return TRUE;
- }
- else
- {
- // identifier already exists at this scope
- return FALSE;
- }
+ return mEntryMap.find(name) != mEntryMap.end();
}
LLScriptScopeEntry *findEntry(const char *identifier)
@@ -345,10 +337,11 @@ public:
while (scope)
{
- if (scope->mEntryMap.checkData(name))
+ entry_map_t::iterator found_it = mEntryMap.find(name);
+ if (found_it != mEntryMap.end())
{
// cool, we found it at this scope
- return scope->mEntryMap[name];
+ return found_it->second;
}
scope = scope->mParentScope;
}
@@ -362,24 +355,25 @@ public:
while (scope)
{
- if (scope->mEntryMap.checkData(name))
+ entry_map_t::iterator found_it = scope->mEntryMap.find(name);
+ if (found_it != scope->mEntryMap.end())
{
// need to check type, and if type is function we need to check both types
if (idtype == LIT_FUNCTION)
{
- if (scope->mEntryMap[name]->mIDType == LIT_FUNCTION)
+ if (found_it->second->mIDType == LIT_FUNCTION)
{
- return scope->mEntryMap[name];
+ return (found_it->second);
}
- else if (scope->mEntryMap[name]->mIDType == LIT_LIBRARY_FUNCTION)
+ else if (found_it->second->mIDType == LIT_LIBRARY_FUNCTION)
{
- return scope->mEntryMap[name];
+ return (found_it->second);
}
}
- else if (scope->mEntryMap[name]->mIDType == idtype)
+ else if (found_it->second->mIDType == idtype)
{
// cool, we found it at this scope
- return scope->mEntryMap[name];
+ return (found_it->second);
}
}
scope = scope->mParentScope;
@@ -392,11 +386,12 @@ public:
mParentScope = scope;
}
- LLMap<const char *, LLScriptScopeEntry *> mEntryMap;
- LLScriptScope *mParentScope;
- LLStringTable *mSTable;
- S32 mFunctionCount;
- S32 mStateCount;
+ typedef std::map<const char *, LLScriptScopeEntry *> entry_map_t;
+ entry_map_t mEntryMap;
+ LLScriptScope* mParentScope;
+ LLStringTable* mSTable;
+ S32 mFunctionCount;
+ S32 mStateCount;
};
extern LLStringTable *gScopeStringTable;