StringMatrix.h File Reference

#include "sciMatrix.h"

Include dependency graph for StringMatrix.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef sciMatrix StringMatrix

Functions

StringMatrixnewFullStringMatrix (char **textMat, int nbRow, int nbCol)
StringMatrixcopyStringMatrix (const StringMatrix *copyMat)
char * getStrMatElement (const StringMatrix *mat, int row, int col)
char ** getStrMatData (const StringMatrix *mat)
void copyStrMatElement (StringMatrix *mat, int row, int col, const char *copyStr)


Typedef Documentation

typedef sciMatrix StringMatrix

The StringMatrix is just a pointer matrix. So it can be used in any function using sciMatrix. The typedef is used for a more understandable code.

Definition at line 19 of file StringMatrix.h.


Function Documentation

StringMatrix* copyStringMatrix ( const StringMatrix copyMat  ) 

copy constructor

Definition at line 32 of file StringMatrix.c.

References sciMatrix::data, sciMatrix::nbCol, sciMatrix::nbRow, and newFullStringMatrix().

Referenced by sciSetStrings().

00033 {
00034   return newFullStringMatrix( (char **) copyMat->data, copyMat->nbCol, copyMat->nbRow ) ;
00035 }

Here is the call graph for this function:

Here is the caller graph for this function:

void copyStrMatElement ( StringMatrix mat,
int  row,
int  col,
const char *  copyStr 
)

desalocate the (row,col) current string and copy the new one.

Definition at line 47 of file StringMatrix.c.

References CALLOC, FREE, mat, and NULL.

Referenced by computeDefaultTicsLabels().

00048 {
00049   char * changedString = (char *) mat->data[row + col * mat->nbRow] ; /* for speed */
00050   if ( changedString != NULL )
00051   {
00052     FREE( changedString ) ;
00053   }
00054   changedString = CALLOC( strlen( copyStr ) + 1, sizeof(char) ) ;
00055   strcpy( changedString, copyStr ) ;
00056   mat->data[row + col * mat->nbRow] = changedString ;
00057 }

Here is the caller graph for this function:

char** getStrMatData ( const StringMatrix mat  ) 

get the pointer on the array of string. May be used for faster access to the data.

Definition at line 42 of file StringMatrix.c.

References getMatData(), and mat.

Referenced by CloneText(), get_text_property(), and get_tics_labels_property().

00043 {
00044   return (char **) getMatData( mat ) ;
00045 }

Here is the call graph for this function:

Here is the caller graph for this function:

char* getStrMatElement ( const StringMatrix mat,
int  row,
int  col 
)

Definition at line 37 of file StringMatrix.c.

References getMatElement(), and mat.

Referenced by box3d(), computeSuitableFont(), drawLegendEntity(), drawStringsInPosition(), and getStringsRect().

00038 {
00039   return (char *) getMatElement( mat, row, col ) ;
00040 }

Here is the call graph for this function:

Here is the caller graph for this function:

StringMatrix* newFullStringMatrix ( char **  textMat,
int  nbRow,
int  nbCol 
)

create a nbRow x nbCol matrix which data are copied.

Parameters:
textMat the copied data.

Definition at line 15 of file StringMatrix.c.

References CALLOC, sciMatrix::data, i, and newMatrix().

Referenced by allocateText(), ConstructLegend(), ConstructTitle(), ConstructUimenu(), copyStringMatrix(), and sciSetText().

00016 {
00017   int i ;
00018   /* create the matrix */
00019   StringMatrix * newMat = newMatrix( nbRow, nbCol ) ;
00020 
00021   /* copy each element */
00022   for ( i = 0 ; i < nbRow * nbCol ; i++ )
00023   {
00024     /* +1 for the /0 last character */
00025     newMat->data[i] = CALLOC( strlen(textMat[i]) + 1, sizeof(char) ) ;
00026     strcpy( newMat->data[i], textMat[i] ) ;
00027   }
00028 
00029   return newMat ;
00030 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Sun Mar 4 15:33:28 2007 for Scilab [trunk] by  doxygen 1.5.1