Changeset cd6c317 in tol
- Timestamp:
- Jun 21, 2009, 5:12:55 PM (17 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- a75504d
- Parents:
- e69e5c6
- File:
-
- 1 edited
-
tol/btol/text_type/txtgra.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/text_type/txtgra.cpp
re69e5c6 rcd6c317 1665 1665 //-------------------------------------------------------------------- 1666 1666 DeclareContensClass(BText, BTxtTemporary, BTxtFormatMatrix); 1667 DefExtOpr(1, BTxtFormatMatrix, "FormatMatrix", 1, 3, 1668 "Matrix Text Text", 1669 I2("(Matrix M [, Text colSep=\";\", Text rowSep=NL])", 1670 "(Matrix M [, Text colSep=\";\", Text rowSep=NL])"), 1671 I2("Converts a matrix in text with a given format. If no format is" 1672 " given, default format is used.", 1673 "Convierte una matriz a texto con un formato dado. Si no se da" 1674 " se utiliza el formato por defecto."), 1667 DefExtOpr(1, BTxtFormatMatrix, "FormatMatrix", 1, 6, 1668 "Matrix Text Text Text Text Text", BText("")+ 1669 "(Matrix mat [, Text cellSep=\";\", Text rowSep=\"\\n\", " 1670 "Text leftBracket=\"(\", Text rightBracket=\")\", " 1671 "Text realFormat=\""+BDat::RealFormat()+"\"])", 1672 I2("Converts a matrix in text with a given format. ", 1673 "Convierte una matriz en texto con un formato dado"), 1675 1674 BOperClassify::Conversion_); 1675 //-------------------------------------------------------------------- 1676 1676 void BTxtFormatMatrix::CalcContens() 1677 1677 //-------------------------------------------------------------------- 1678 1678 { 1679 BMat mat = Mat(Arg(1)); 1680 BText format = BDat::RealFormat(); 1681 BText colSep = ";"; 1682 BText rowSep = "\n"; 1683 if(Arg(2)) { colSep = Text(Arg(2)); } 1684 if(Arg(3)) { rowSep = Text(Arg(3)); } 1685 contens_ = ""; 1686 for(BInt i=0; i<mat.Rows(); i++) 1679 BMat& mat = Mat(Arg(1)); 1680 BText cellSep = ","; 1681 BText rowSep = "\n"; 1682 BText leftBracket = "("; 1683 BText rightBracket = ")"; 1684 BText format = BDat::RealFormat(); 1685 if(Arg(2)) { cellSep = Text(Arg(2)); } 1686 if(Arg(3)) { rowSep = Text(Arg(3)); } 1687 if(Arg(4)) { leftBracket = Text(Arg(4)); } 1688 if(Arg(5)) { rightBracket = Text(Arg(5)); } 1689 if(Arg(6)) { format = Text(Arg(6)); } 1690 1691 contens_ = leftBracket; 1692 int i, j; 1693 for(i=0; i<mat.Rows(); i++) 1694 { 1695 if(i>0) { contens_ += rowSep; } 1696 contens_ += leftBracket; 1697 for(j=0; j<mat.Columns(); j++) 1687 1698 { 1688 if(i>0) { contens_ += rowSep; } 1689 for(BInt j=0; j<mat.Columns(); j++) 1690 { 1691 if(j>0) { contens_ += colSep; } 1692 contens_ += mat(i,j); 1693 } 1699 if(j>0) { contens_ += cellSep; } 1700 contens_ += mat(i,j).Format(format); 1694 1701 } 1702 contens_ += rightBracket; 1703 } 1704 contens_ += rightBracket; 1695 1705 } 1696 1706
Note: See TracChangeset
for help on using the changeset viewer.
