GME  13
StringArrayEx.cpp
Go to the documentation of this file.
00001 // StringArrayEx.cpp: implementation of the CStringArrayEx class.
00002 //
00004 
00005 #include "stdafx.h"
00006 #include "gmeactivebrowser.h"
00007 #include "StringArrayEx.h"
00008 
00009 #ifdef _DEBUG
00010 #undef THIS_FILE
00011 static char THIS_FILE[]=__FILE__;
00012 #define new DEBUG_NEW
00013 #endif
00014 
00016 // Construction/Destruction
00018 
00019 CStringArrayEx::CStringArrayEx()
00020 {
00021 
00022 }
00023 
00024 CStringArrayEx::~CStringArrayEx()
00025 {
00026 
00027 }
00028 
00029 
00031 // Returns the index where the element was inserted
00033 int CStringArrayEx::InsertAtOrder(CString &strElement)
00034 {
00035         bool bIsGreater=true; // Detecting the change in search
00036         
00037         TRACE("\nStrArEx Dump:\n");
00038         TRACE(strElement);
00039         TRACE(" ");
00040 
00041         int nMaxElement=CStringArray::GetUpperBound();
00042 
00043         for(int i=0;i<=nMaxElement;i++)
00044         {
00045                 bIsGreater=((strElement > CStringArray::ElementAt(i))?true:false);
00046                 if(false==bIsGreater) // Change
00047                 {
00048                         CStringArray::InsertAt(i,strElement);
00049                         return i;
00050                 }
00051 
00052         }
00053         return CStringArray::Add(strElement); // The last element,which was greater than each
00054 }