// --------------------------------------------------------------------------- // Examples of libcotras use: 01 // --------------------------------------------------------------------------- // Last modified on: // December 2nd, 2003. (started on October 25th, 2003.) // // Author: // Chusslove Illich (Часлав Илић) // // Legal: // Copyright (C) 2003 by Chusslove Illich. You can use, redistribute and // modify this software under the terms of GNU General Public License, // version 2. // --------------------------------------------------------------------------- // Generated by Autoconf. #include #include #include #include #include #include #define WL #define _tp(x) ctstringp(x) #define _ti(x) ctstringi(x) #define _s(x) tostring(x) using namespace std; using namespace cotras; template const string tostring (const T& dat) { ostringstream oss; oss << dat; return oss.str(); } int main () { loadcat("/home/caslav/project/libcotras/test-nodist/testcat.ct"); cout << endl; // ----- Plural forms. ----- cout << _tp("Plural forms:") << endl; vector nt; vector ns; nt.push_back(4); ns.push_back(1); nt.push_back(14); ns.push_back(2); nt.push_back(1); ns.push_back(5); for (uint i = 0; i < nt.size(); i++) cout << _tp("\"We have %1 train(s) and %2 ship(s).\"") WL .a(_s(nt[i])).a(_s(ns[i])) << endl; cout << endl; // ----- Transforming verb to noun forms. ----- cout << _tp("Transforming verb to noun forms:") << endl; vector action; action.push_back("Delete"); action.push_back("Cut"); action.push_back("Copy"); for (uint i = 0; i < action.size(); i++) cout << _tp("\"Undo %1\"").a(action[i]) << endl; cout << endl; // ----- Backreferencing. ----- cout << _tp("Backreferencing:") << endl; cout << _tp("\"Available filters\"") << " - " WL << _tp("\"Make new\"") << endl; cout << _tp("\"Available actions\"") << " - " WL << _tp("\"Make new\"") << endl; //// ----- Alternative, infix notation. ----- //cout << _ti("We have ").a(nt).t(" train(s) and ").a(ns).t(" ship(s).") //WL << endl; cout << endl; return 0; }