Changeset 3c1f60d in tol
- Timestamp:
- May 21, 2012, 4:04:02 PM (14 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 26d815e
- Parents:
- 48b43e8
- File:
-
- 1 edited
-
tol/btol/text_type/txtgra.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/text_type/txtgra.cpp
r48b43e8 r3c1f60d 593 593 } 594 594 595 //-------------------------------------------------------------------- 596 DeclareContensClass(BText, BTxtTemporary, BTxtJoinWith); 597 DefExtOpr(1, BTxtJoinWith, "TextJoinWith", 2, 2, "Set Text", 598 I2("(Set texts, Text separator)", 599 "(Set textos, Text separador)"), 600 I2("Concatenates all the elements of a set of texts, " 601 "using the specified separator between each element.", 602 "Concatena todos los elementos de un conjunto de textos " 603 "usando el separador indicado entre ellos."), 604 BOperClassify::Text_); 605 606 //-------------------------------------------------------------------- 607 void BTxtJoinWith::CalcContens() 608 //-------------------------------------------------------------------- 609 { 610 BSet& set = Set(Arg(1)); 611 BText& separator = Text(Arg(2)); 612 contens_ = ""; 613 bool ok = true; 614 for(BInt n=1; n<=set.Card(); n++) 615 { 616 if(n>1) { contens_ += separator; }; 617 if(set[n]->Grammar()==GraText()) { contens_ += Text(set[n]); } 618 else { ok = false; } 619 } 620 if(!ok) 621 { 622 Error(I2("There are non Text objects in the set argument of " 623 "function Text TextJoinWith", 624 "Hay objetos de tipo distinto de Text en el conjunto " 625 "argumento de la llamada a la función Text TextJoinWith")); 626 contens_ = ""; 627 } 628 } 595 629 596 630 //-------------------------------------------------------------------- … … 873 907 "(Text txt, Real desde, Real hasta)"), 874 908 I2("Returns the substring of a text between two bounds, both included.", 875 "Devueve la subcadena comprendida entre dos límites ambos incluídos."),909 "Devueve la subcadena comprendida entre dos límites, ambos incluidos."), 876 910 BOperClassify::Text_); 877 911 … … 883 917 } 884 918 919 //-------------------------------------------------------------------- 920 DeclareContensClass(BText, BTxtTemporary, BTxtSub); 921 DefExtOpr(1, BTxtSub, "TextSub", 3, 3, "Text Real Real", 922 I2("(Text txt, Real from, Real until)", 923 "(Text txt, Real desde, Real hasta)"), 924 I2("Returns the substring of a text between two bounds, both included. " 925 "Negative character positions count from the end of the text.", 926 "Devueve la subcadena comprendida entre dos límites, ambos incluidos." 927 "Las posiciones negativas cuentan desde el final del texto."), 928 BOperClassify::Text_); 929 930 //-------------------------------------------------------------------- 931 void BTxtSub::CalcContens() 932 //-------------------------------------------------------------------- 933 { 934 BInt m = (BInt)Real(Arg(2)); 935 BInt n = (BInt)Real(Arg(3)); 936 if(m<0) { m += 1+Text(Arg(1)).Length(); }; 937 if(n<0) { n += 1+Text(Arg(1)).Length(); }; 938 contens_.Copy(Text(Arg(1)),m-1,n-1); 939 } 885 940 886 941 //-------------------------------------------------------------------- … … 907 962 } 908 963 909 910 964 //-------------------------------------------------------------------- 965 DeclareContensClass(BText, BTxtTemporary, BFirstTxtToLower); 966 DefExtOpr(1, BFirstTxtToLower, "FirstToLower", 1, 1, "Text", 967 "(Text txt)", 968 I2("Changes the first character of a text to lower case.", 969 "Cambia el primer caracter a minúsculas."), 970 BOperClassify::Text_); 971 972 //-------------------------------------------------------------------- 973 void BFirstTxtToLower::CalcContens() 974 //-------------------------------------------------------------------- 975 { 976 contens_=Text(Arg(1)); 977 char ch = contens_.Get(0); 978 if(ch) 979 { 980 contens_.PutChar(0,(BChar)tolower(ch)); 981 } 982 } 911 983 912 984 //-------------------------------------------------------------------- … … 2109 2181 } 2110 2182 2183 //-------------------------------------------------------------------- 2184 DeclareContensClass(BSet, BSetTemporary, BCharacters); 2185 DefExtOpr(1, BCharacters, "Characters", 1, 1, "Text", "(Text txt)", 2186 I2("Returns a set with the characters of the text.", 2187 "Devuelve un conjunto con los caracteres del texto."), 2188 BOperClassify::System_); 2189 2190 //-------------------------------------------------------------------- 2191 void BCharacters::CalcContens() 2192 //-------------------------------------------------------------------- 2193 { 2194 BText& txt = Text(Arg(1)); 2195 contens_.PrepareStore(txt.Length()); 2196 for(BInt i=0; i<txt.Length(); i++) 2197 { 2198 contens_.AddElement(new BContensText(txt.SubString(i, i))); 2199 } 2200 } 2111 2201 2112 2202 //--------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.
