#include </home/scilab/compilation_chain/sci_checkOut/scilab/modules/renderer/src/cpp/BasicAlgos.hxx>
Static Public Member Functions | |
| static char ** | createStringArray (int nbElement) |
| static void | stringArrayCopy (char *dest[], char *src[], int nbElement) |
| static void | destroyStringArray (char *src[], int nbElement) |
| template<typename T> | |
| static bool | listContains (std::list< T > &searchedList, T &value) |
| template<typename T> | |
| static bool | vectorRemove (std::vector< T > &searchedVector, T &value) |
Definition at line 20 of file BasicAlgos.hxx.
| char ** BasicAlgos::createStringArray | ( | int | nbElement | ) | [static] |
Create a new array of char *, with all its elements set to NULL;
Definition at line 18 of file BasicAlgos.cpp.
Referenced by sciGraphics::TicksDrawer::drawTicks(), sciGraphics::TicksDrawer::getInitTicksPos(), sciGetJavaXTicksPos(), sciGetJavaYTicksPos(), and sciGetJavaZTicksPos().
00019 { 00020 char ** res = new char *[nbElement]; 00021 00022 for (int i = 0; i < nbElement; i++) 00023 { 00024 res[i] = NULL; 00025 } 00026 return res; 00027 }

| void BasicAlgos::stringArrayCopy | ( | char * | dest[], | |
| char * | src[], | |||
| int | nbElement | |||
| ) | [static] |
copy a char * array into an other
Definition at line 29 of file BasicAlgos.cpp.
References destroyStringArray(), i, and NULL.
Referenced by sciGraphics::UserDefLogTicksComputer::getTicksPosition(), and sciGraphics::UserDefinedTicksComputer::getTicksPosition().
00030 { 00031 int i ; 00032 for ( i = 0 ; i < nbElement ; i++ ) 00033 { 00034 int elemSize = (int) strlen( src[i] ) + 1 ; 00035 if (dest[i] != NULL) {delete[] dest[i]; } 00036 00037 dest[i] = new char[elemSize] ; 00038 00039 if ( dest[i] == NULL ) 00040 { 00041 destroyStringArray( dest, nbElement ) ; 00042 return ; 00043 } 00044 00045 strcpy( dest[i], src[i] ) ; 00046 } 00047 }


| void BasicAlgos::destroyStringArray | ( | char * | src[], | |
| int | nbElement | |||
| ) | [static] |
delete an array of strings
Definition at line 49 of file BasicAlgos.cpp.
Referenced by sciGraphics::TicksDrawer::drawTicks(), sciGraphics::TicksDrawer::getInitTicksPos(), sciGetJavaXTicksPos(), sciGetJavaYTicksPos(), sciGetJavaZTicksPos(), and stringArrayCopy().
00050 { 00051 if (src == NULL) {return;} 00052 00053 for (int i = 0; i < nbElement; i++) 00054 { 00055 if (src[i] != NULL) {delete[] src[i];} 00056 } 00057 delete[] src; 00058 }

| static bool BasicAlgos::listContains | ( | std::list< T > & | searchedList, | |
| T & | value | |||
| ) | [inline, static] |
Find an object inside a list.
| searchedList,list | in which the value is searched | |
| value | searched value |
Definition at line 46 of file BasicAlgos.hxx.
Referenced by getParentFigureList().
00047 { 00048 typename std::list<T>::iterator it = searchedList.begin(); 00049 for (; it != searchedList.end(); it++) 00050 { 00051 if (*it == value) 00052 { 00053 return true; 00054 } 00055 } 00056 return false; 00057 }

| static bool BasicAlgos::vectorRemove | ( | std::vector< T > & | searchedVector, | |
| T & | value | |||
| ) | [inline, static] |
Remove an object inside a vector.
| searchedList,vector | in which the value is searched | |
| value | searched value |
Definition at line 66 of file BasicAlgos.hxx.
Referenced by sciGraphics::ConcreteDrawableSubwin::removeTextToDraw().
00067 { 00068 typename std::vector<T>::iterator it = searchedVector.begin(); 00069 for (; it != searchedVector.end(); it++) 00070 { 00071 if (*it == value) 00072 { 00073 searchedVector.erase(it); 00074 return true; 00075 } 00076 } 00077 return false; 00078 }

1.5.5