summaryrefslogtreecommitdiff
path: root/modules/graphics/includes/StringMatrix.h
blob: fd84d8779e3d9e9713d0aaf31af794e6d368f0f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
 *
 * This file must be used under the terms of the CeCILL.
 * This source file is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at
 * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 *
 */

/*----------------------------------------------------------------------------------*/
/* File    : StringMatrix.h                                                                  */
/* Desc.   : Allocation, deletion and modifications of matrices of strings.                  */
/*           The matrix is stored by colmuns like in Scilab                                  */
/*----------------------------------------------------------------------------------*/

#ifndef _SCI_STRING_MATRIX_H_
#define _SCI_STRING_MATRIX_H_

#include "dynlib_graphics.h"
#include "sciMatrix.h"

/*----------------------------------------------------------------------------------*/
/**
 * 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.
 */
typedef sciMatrix StringMatrix;

/*----------------------------------------------------------------------------------*/
/* Constructors */
/**
 * create a nbRow x nbCol matrix which data are copied.
 * @param textMat the copied data.
 */
GRAPHICS_IMPEXP StringMatrix * newFullStringMatrix(char ** textMat, int nbRow, int nbCol);

/**
 * Create a new string matrix filled with empty strings
 */
GRAPHICS_IMPEXP StringMatrix * newEmptyStringMatrix(int nbRow, int nbCol);

/**
 * copy constructor
 */
GRAPHICS_IMPEXP StringMatrix * copyStringMatrix(const StringMatrix * copyMat);

/*----------------------------------------------------------------------------------*/
/* accessors */
GRAPHICS_IMPEXP char * getStrMatElement(const StringMatrix * mat, int row, int col);

/**
 * get the pointer on the array of string. May be used for faster access to the data.
 */
GRAPHICS_IMPEXP char ** getStrMatData( const StringMatrix * mat);

/**
 * desalocate the (row,col) current string and copy the new one.
 */
GRAPHICS_IMPEXP void copyStrMatElement(StringMatrix * mat, int row, int col, const char * copyStr);

/*----------------------------------------------------------------------------------*/
/* utilities */
/**
 * Print the matrix using printf
 */
GRAPHICS_IMPEXP void printStrMat(StringMatrix * mat);
/*----------------------------------------------------------------------------------*/

#endif /* _SCI_STRING_MATRIX_H_ */