@@ -101,7 +101,7 @@ int Extension::expressionGetY(TCHAR const *group, TCHAR const *item)
101101
102102TCHAR const *Extension::expressionNthGroup (int n)
103103{
104- if (n > 0 && n < data->ini .size ())
104+ if (n >= 0 && n < data->ini .size ())
105105 {
106106 auto it = data->ini .begin ();
107107 std::advance (it, n);
@@ -112,19 +112,46 @@ TCHAR const *Extension::expressionNthGroup(int n)
112112
113113TCHAR const *Extension::expressionNthItem (TCHAR const *group, int n)
114114{
115- //
115+ if (hasGroup (group))
116+ {
117+ auto g = groupByName (group);
118+ if (n >= 0 && n < g.size ())
119+ {
120+ auto it = g.begin ();
121+ std::advance (it, n);
122+ return Runtime.CopyString (it->first .c_str ());
123+ }
124+ }
116125 return _T (" " );
117126}
118127
119128TCHAR const *Extension::expressionNthItemString (TCHAR const *group, int n)
120129{
121- //
130+ if (hasGroup (group))
131+ {
132+ auto g = groupByName (group);
133+ if (n >= 0 && n < g.size ())
134+ {
135+ auto it = g.begin ();
136+ std::advance (it, n);
137+ return Runtime.CopyString (it->second .c_str ());
138+ }
139+ }
122140 return _T (" " );
123141}
124142
125143float Extension::expressionNthItemValue (TCHAR const *group, int n) // TODO
126144{
127- //
145+ if (hasGroup (group))
146+ {
147+ auto g = groupByName (group);
148+ if (n >= 0 && n < g.size ())
149+ {
150+ auto it = g.begin ();
151+ std::advance (it, n);
152+ return expressionGetItemValue (group, it->first .c_str (), 0 .0f );
153+ }
154+ }
128155 return 0 .0f ;
129156}
130157
@@ -135,14 +162,21 @@ int Extension::expressionGroupCount()
135162
136163int Extension::expressionItemCount (TCHAR const *group)
137164{
138- //
165+ if (hasGroup (group))
166+ {
167+ return groupByName (group).size ();
168+ }
139169 return 0 ;
140170}
141171
142172int Extension::expressionTotalItems ()
143173{
144- //
145- return 0 ;
174+ std::size_t n = 0 ;
175+ for (auto const &group : data->ini )
176+ {
177+ n += group.second .size ();
178+ }
179+ return n;
146180}
147181
148182int Extension::expressionSearchResultCounts ()
0 commit comments