Salome HOME
projects
/
modules
/
kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[EDF30062] : Forward of current directory mecanism
[modules/kernel.git]
/
src
/
SALOMEDSImpl
/
SALOMEDSImpl_AttributeTableOfInteger.cxx
diff --git
a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx
b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx
index 35067de1e99f8f04ac6ee2db46dbd13311f0f079..6322907ff51813abf0dcbb255c2b9c1e388e4c06 100644
(file)
--- a/
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx
+++ b/
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-20
14 CEA/DEN, EDF R&D
, OPEN CASCADE
+// Copyright (C) 2007-20
24 CEA, EDF
, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@
-35,18
+35,15
@@
typedef std::map<int, int>::const_iterator MI;
static std::string getUnit(std::string theString)
{
std::string aString(theString);
static std::string getUnit(std::string theString)
{
std::string aString(theString);
- int aPos = aString.find(SEPARATOR);
- if(aPos <= 0 || aPos == aString.size() ) return std::string();
- return aString.substr(aPos+1, aString.size());
+ size_t aPos = aString.find(SEPARATOR);
+ return aPos >= aString.size()-1 ? std::string() : aString.substr(aPos+1);
}
static std::string getTitle(std::string theString)
{
std::string aString(theString);
}
static std::string getTitle(std::string theString)
{
std::string aString(theString);
- int aPos = aString.find(SEPARATOR);
- if(aPos < 1) return aString;
- if(aPos == 0) return std::string();
- return aString.substr(0, aPos);
+ size_t aPos = aString.find(SEPARATOR);
+ return aPos == std::string::npos ? aString : aString.substr(0, aPos);
}
const std::string& SALOMEDSImpl_AttributeTableOfInteger::GetID()
}
const std::string& SALOMEDSImpl_AttributeTableOfInteger::GetID()
@@
-92,7
+89,7
@@
void SALOMEDSImpl_AttributeTableOfInteger::SetNbColumns(const int theNbColumns)
myNbColumns = theNbColumns;
myNbColumns = theNbColumns;
- while (
myCols.size() < myNbColumns) { // append empty columns titles
+ while (
(int)myCols.size() < myNbColumns) { // append empty columns titles // TODO: mismatch signed/unsigned
myCols.push_back(std::string(""));
}
myCols.push_back(std::string(""));
}
@@
-117,17
+114,17
@@
void SALOMEDSImpl_AttributeTableOfInteger::SetRowData(const int theRow,
const std::vector<int>& theData)
{
CheckLocked();
const std::vector<int>& theData)
{
CheckLocked();
- if(
theData.size() > myNbColumns) SetNbColumns(theData.size());
+ if(
(int)theData.size() > myNbColumns) SetNbColumns((int)theData.size()); //!< TODO: conversion from size_t to const int, possible loss of data
Backup();
Backup();
- while (
myRows.size() < theRow) { // append new row titles
+ while (
(int)myRows.size() < theRow) { // append new row titles // TODO: mismatch signed/unsigned
myRows.push_back(std::string(""));
}
myRows.push_back(std::string(""));
}
-
in
t i, aShift = (theRow-1)*myNbColumns, aLength = theData.size();
+
size_
t i, aShift = (theRow-1)*myNbColumns, aLength = theData.size();
for(i = 1; i <= aLength; i++) {
for(i = 1; i <= aLength; i++) {
- myTable[
aShift + i] = theData[i-1];
+ myTable[
(int)(aShift + i)] = theData[i-1]; //!< TODO: conversion from size_t to int
}
if(theRow > myNbRows) myNbRows = theRow;
}
if(theRow > myNbRows) myNbRows = theRow;
@@
-180,9
+177,9
@@
void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnit(const int theRow,
void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnits(const std::vector<std::string>& theUnits)
{
void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnits(const std::vector<std::string>& theUnits)
{
- if (
theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows");
-
in
t aLength = theUnits.size(), i;
- for(i = 1; i <= aLength; i++) SetRowUnit(
i, theUnits[i-1]);
+ if (
(int)theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows"); // TODO: mismatch signed/unsigned
+
size_
t aLength = theUnits.size(), i;
+ for(i = 1; i <= aLength; i++) SetRowUnit(
(int)i, theUnits[i-1]); //!< TODO: conversion from size_t to int
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
@@
-190,16
+187,16
@@
void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnits(const std::vector<std::st
std::vector<std::string> SALOMEDSImpl_AttributeTableOfInteger::GetRowUnits()
{
std::vector<std::string> aSeq;
std::vector<std::string> SALOMEDSImpl_AttributeTableOfInteger::GetRowUnits()
{
std::vector<std::string> aSeq;
-
in
t aLength = myRows.size(), i;
+
size_
t aLength = myRows.size(), i;
for(i=0; i<aLength; i++) aSeq.push_back(getUnit(myRows[i]));
return aSeq;
}
void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitles(const std::vector<std::string>& theTitles)
{
for(i=0; i<aLength; i++) aSeq.push_back(getUnit(myRows[i]));
return aSeq;
}
void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitles(const std::vector<std::string>& theTitles)
{
- if (
theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows");
-
in
t aLength = theTitles.size(), i;
- for(i = 1; i <= aLength; i++) SetRowTitle(
i, theTitles[i-1]);
+ if (
(int)theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows"); //TODO: mismatch signed/unsigned
+
size_
t aLength = theTitles.size(), i;
+ for(i = 1; i <= aLength; i++) SetRowTitle(
(int)i, theTitles[i-1]); //!< TODO: conversion from size_t to int
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
@@
-207,7
+204,7
@@
void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitles(const std::vector<std::s
std::vector<std::string> SALOMEDSImpl_AttributeTableOfInteger::GetRowTitles()
{
std::vector<std::string> aSeq;
std::vector<std::string> SALOMEDSImpl_AttributeTableOfInteger::GetRowTitles()
{
std::vector<std::string> aSeq;
-
in
t aLength = myRows.size(), i;
+
size_
t aLength = myRows.size(), i;
for(i=0; i<aLength; i++) aSeq.push_back(getTitle(myRows[i]));
return aSeq;
}
for(i=0; i<aLength; i++) aSeq.push_back(getTitle(myRows[i]));
return aSeq;
}
@@
-230,14
+227,14
@@
void SALOMEDSImpl_AttributeTableOfInteger::SetColumnData(const int theColumn,
Backup();
Backup();
-
in
t i, aLength = theData.size();
+
size_
t i, aLength = theData.size();
for(i = 1; i <= aLength; i++) {
for(i = 1; i <= aLength; i++) {
- myTable[myNbColumns*(
i-1)+theColumn] = theData[i-1];
+ myTable[myNbColumns*(
(int)i-1)+theColumn] = theData[i-1]; //!< TODO: conversion from size_t to int
}
}
- if(aLength > myNbRows) {
- myNbRows =
aLength;
- while (myRows.size() < myNbRows) { // append empty row titles
+ if(
(int)
aLength > myNbRows) {
+ myNbRows =
(int)aLength; //!< TODO: conversion from size_t to int
+ while (
(int)
myRows.size() < myNbRows) { // append empty row titles
myRows.push_back(std::string(""));
}
}
myRows.push_back(std::string(""));
}
}
@@
-266,7
+263,7
@@
void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitle(const int theColumn,
{
CheckLocked();
Backup();
{
CheckLocked();
Backup();
- while(myCols.size() < theColumn) myCols.push_back(std::string(""));
+ while(
(int)
myCols.size() < theColumn) myCols.push_back(std::string(""));
myCols[theColumn-1] = theTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
myCols[theColumn-1] = theTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
@@
-275,14
+272,14
@@
void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitle(const int theColumn,
std::string SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitle(const int theColumn) const
{
if(myCols.empty()) return "";
std::string SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitle(const int theColumn) const
{
if(myCols.empty()) return "";
- if(myCols.size() < theColumn) return "";
+ if(
(int)
myCols.size() < theColumn) return "";
return myCols[theColumn-1];
}
void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitles(const std::vector<std::string>& theTitles)
{
return myCols[theColumn-1];
}
void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitles(const std::vector<std::string>& theTitles)
{
- if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns");
-
in
t aLength = theTitles.size(), i;
+ if (
(int)
theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns");
+
size_
t aLength = theTitles.size(), i;
for(i = 0; i < aLength; i++) myCols[i] = theTitles[i];
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
for(i = 0; i < aLength; i++) myCols[i] = theTitles[i];
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
@@
-291,7
+288,7
@@
void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitles(const std::vector<std
std::vector<std::string> SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitles()
{
std::vector<std::string> aSeq;
std::vector<std::string> SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitles()
{
std::vector<std::string> aSeq;
-
in
t aLength = myCols.size(), i;
+
size_
t aLength = myCols.size(), i;
for(i=0; i<aLength; i++) aSeq.push_back(myCols[i]);
return aSeq;
}
for(i=0; i<aLength; i++) aSeq.push_back(myCols[i]);
return aSeq;
}
@@
-318,7
+315,7
@@
void SALOMEDSImpl_AttributeTableOfInteger::PutValue(const int theValue,
myTable[anIndex] = theValue;
if(theRow > myNbRows) {
myTable[anIndex] = theValue;
if(theRow > myNbRows) {
- while (myRows.size() < theRow) { // append empty row titles
+ while (
(int)
myRows.size() < theRow) { // append empty row titles
myRows.push_back(std::string(""));
}
myNbRows = theRow;
myRows.push_back(std::string(""));
}
myNbRows = theRow;
@@
-448,7
+445,7
@@
std::string SALOMEDSImpl_AttributeTableOfInteger::Save()
int i, j, l;
//Title
int i, j, l;
//Title
- l = myTitle.size();
+ l =
(int)
myTitle.size();
sprintf(buffer, "%d\n", l);
aString+=buffer;
for(i=0; i<l; i++) {
sprintf(buffer, "%d\n", l);
aString+=buffer;
for(i=0; i<l; i++) {
@@
-462,7
+459,7
@@
std::string SALOMEDSImpl_AttributeTableOfInteger::Save()
//Row titles
for(i=0; i<myNbRows; i++) {
//Row titles
for(i=0; i<myNbRows; i++) {
- l = myRows[i].size();
+ l =
(int)
myRows[i].size();
sprintf(buffer, "%d\n", l);
aString+=buffer;
for(j=0; j<l; j++) {
sprintf(buffer, "%d\n", l);
aString+=buffer;
for(j=0; j<l; j++) {
@@
-477,7
+474,7
@@
std::string SALOMEDSImpl_AttributeTableOfInteger::Save()
//Columns titles
for(i=0; i<myNbColumns; i++) {
//Columns titles
for(i=0; i<myNbColumns; i++) {
- l = myCols[i].size();
+ l =
(int)
myCols[i].size();
sprintf(buffer, "%d\n", l);
aString+=buffer;
for(j=0; j<l; j++) {
sprintf(buffer, "%d\n", l);
aString+=buffer;
for(j=0; j<l; j++) {
@@
-487,7
+484,7
@@
std::string SALOMEDSImpl_AttributeTableOfInteger::Save()
}
//Store the table values
}
//Store the table values
- l = myTable.size();
+ l =
(int)
myTable.size();
sprintf(buffer, "%d\n", l);
aString+=buffer;
for(MI p = myTable.begin(); p != myTable.end(); p++) {
sprintf(buffer, "%d\n", l);
aString+=buffer;
for(MI p = myTable.begin(); p != myTable.end(); p++) {
@@
-587,12
+584,12
@@
std::vector<int> SALOMEDSImpl_AttributeTableOfInteger::SortRow(const int theRow,
}
result = indices;
}
result = indices;
- for ( int col = 0; col <
indices.size(); col++ ) {
+ for ( int col = 0; col <
(int)indices.size(); col++ ) {//TODO: mismatch signed/unsigned
int idx = indices[col];
if ( col+1 == idx ) continue;
SwapCells(theRow, col+1, theRow, idx);
int idx1 = 0;
int idx = indices[col];
if ( col+1 == idx ) continue;
SwapCells(theRow, col+1, theRow, idx);
int idx1 = 0;
- for ( int i = col+1; i <
indices.size() && idx1 == 0; i++)
+ for ( int i = col+1; i <
(int)indices.size() && idx1 == 0; i++)//TODO: mismatch signed/unsigned
if ( indices[i] == col+1 ) idx1 = i;
indices[idx1] = idx;
}
if ( indices[i] == col+1 ) idx1 = i;
indices[idx1] = idx;
}
@@
-627,12
+624,12
@@
std::vector<int> SALOMEDSImpl_AttributeTableOfInteger::SortColumn(const int theC
}
result = indices;
}
result = indices;
- for ( int row = 0; row <
indices.size(); row++ ) {
+ for ( int row = 0; row <
(int)indices.size(); row++ ) {//TODO: mismatch signed/unsigned
int idx = indices[row];
if ( row+1 == idx ) continue;
SwapCells(row+1, theColumn, idx, theColumn);
int idx1 = 0;
int idx = indices[row];
if ( row+1 == idx ) continue;
SwapCells(row+1, theColumn, idx, theColumn);
int idx1 = 0;
- for ( int i = row+1; i <
indices.size() && idx1 == 0; i++)
+ for ( int i = row+1; i <
(int)indices.size() && idx1 == 0; i++)//TODO: mismatch signed/unsigned
if ( indices[i] == row+1 ) idx1 = i;
indices[idx1] = idx;
}
if ( indices[i] == row+1 ) idx1 = i;
indices[idx1] = idx;
}
@@
-667,12
+664,12
@@
std::vector<int> SALOMEDSImpl_AttributeTableOfInteger::SortByRow(const int theRo
}
result = indices;
}
result = indices;
- for ( int col = 0; col <
indices.size(); col++ ) {
+ for ( int col = 0; col <
(int)indices.size(); col++ ) {//TODO: mismatch signed/unsigned
int idx = indices[col];
if ( col+1 == idx ) continue;
SwapColumns(col+1, idx);
int idx1 = 0;
int idx = indices[col];
if ( col+1 == idx ) continue;
SwapColumns(col+1, idx);
int idx1 = 0;
- for ( int i = col+1; i <
indices.size() && idx1 == 0; i++)
+ for ( int i = col+1; i <
(int)indices.size() && idx1 == 0; i++)//TODO: mismatch signed/unsigned
if ( indices[i] == col+1 ) idx1 = i;
indices[idx1] = idx;
}
if ( indices[i] == col+1 ) idx1 = i;
indices[idx1] = idx;
}
@@
-707,12
+704,12
@@
std::vector<int> SALOMEDSImpl_AttributeTableOfInteger::SortByColumn(const int th
}
result = indices;
}
result = indices;
- for ( int row = 0; row <
indices.size(); row++ ) {
+ for ( int row = 0; row <
(int)indices.size(); row++ ) { //TODO: mismatch signed/unsigned
int idx = indices[row];
if ( row+1 == idx ) continue;
SwapRows(row+1, idx);
int idx1 = 0;
int idx = indices[row];
if ( row+1 == idx ) continue;
SwapRows(row+1, idx);
int idx1 = 0;
- for ( int i = row+1; i <
indices.size() && idx1 == 0; i++)
+ for ( int i = row+1; i <
(int)indices.size() && idx1 == 0; i++) //TODO: mismatch signed/unsigned
if ( indices[i] == row+1 ) idx1 = i;
indices[idx1] = idx;
}
if ( indices[i] == row+1 ) idx1 = i;
indices[idx1] = idx;
}