Just renaming some class members and adding Jim Park's comments
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6049 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
f5df185ba2
commit
9852de80be
8 changed files with 176 additions and 133 deletions
|
@ -20,7 +20,7 @@
|
|||
|
||||
ConstantsStringList::ConstantsStringList()
|
||||
{
|
||||
index = 0;
|
||||
m_index = 0;
|
||||
}
|
||||
|
||||
int ConstantsStringList::add(const TCHAR *name, int value1, int value2)
|
||||
|
@ -28,13 +28,13 @@ int ConstantsStringList::add(const TCHAR *name, int value1, int value2)
|
|||
int pos=SortedStringListND<struct constantstring>::add(name);
|
||||
if (pos == -1) return -1;
|
||||
|
||||
((struct constantstring*)gr.get())[pos].index = index;
|
||||
((struct constantstring*)gr.get())[pos].pos = pos;
|
||||
((struct constantstring*)gr.get())[pos].value1 = value1;
|
||||
((struct constantstring*)gr.get())[pos].value2 = value2;
|
||||
((struct constantstring*)m_gr.get())[pos].index = m_index;
|
||||
((struct constantstring*)m_gr.get())[pos].pos = pos;
|
||||
((struct constantstring*)m_gr.get())[pos].value1 = value1;
|
||||
((struct constantstring*)m_gr.get())[pos].value2 = value2;
|
||||
|
||||
int temp = index;
|
||||
index++;
|
||||
int temp = m_index;
|
||||
m_index++;
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
@ -43,42 +43,42 @@ int ConstantsStringList::get(TCHAR *name, int n_chars /*= -1*/)
|
|||
{
|
||||
int v=SortedStringListND<struct constantstring>::find(name, n_chars);
|
||||
if (v==-1) return -1;
|
||||
return (((struct constantstring*)gr.get())[v].index);
|
||||
return (((struct constantstring*) m_gr.get())[v].index);
|
||||
}
|
||||
|
||||
int ConstantsStringList::getnum()
|
||||
{
|
||||
return index;
|
||||
return m_index;
|
||||
}
|
||||
|
||||
int ConstantsStringList::get_value1(int idx)
|
||||
{
|
||||
int pos=get_internal_idx(idx);
|
||||
if (pos==-1) return -1;
|
||||
return (((struct constantstring*)gr.get())[pos].value1);
|
||||
return (((struct constantstring*) m_gr.get())[pos].value1);
|
||||
}
|
||||
|
||||
int ConstantsStringList::get_value2(int idx)
|
||||
{
|
||||
int pos=get_internal_idx(idx);
|
||||
if (pos==-1) return -1;
|
||||
return (((struct constantstring*)gr.get())[pos].value2);
|
||||
return (((struct constantstring*) m_gr.get())[pos].value2);
|
||||
}
|
||||
|
||||
TCHAR* ConstantsStringList::idx2name(int idx)
|
||||
{
|
||||
int pos=get_internal_idx(idx);
|
||||
if (pos==-1) return NULL;
|
||||
struct constantstring *data=(struct constantstring *)gr.get();
|
||||
return ((TCHAR*)strings.get() + data[pos].name);
|
||||
struct constantstring *data=(struct constantstring *) m_gr.get();
|
||||
return ((TCHAR*) m_strings.get() + data[pos].name);
|
||||
}
|
||||
|
||||
int ConstantsStringList::get_internal_idx(int idx)
|
||||
{
|
||||
struct constantstring *data=(struct constantstring *)gr.get();
|
||||
struct constantstring *data=(struct constantstring *) m_gr.get();
|
||||
|
||||
// We do a linear search because the strings are sorted.
|
||||
for (int i = 0; i < index; i++)
|
||||
for (int i = 0; i < m_index; i++)
|
||||
{
|
||||
if (data[i].index == idx)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue