utils.odl

00001 /* 
00002    EyeDB Object Database Management System
00003    Copyright (C) 1994-1999,2004,2005 SYSRA
00004    
00005    EyeDB is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009    
00010    EyeDB is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014    
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA 
00018 */
00019 
00020 /*
00021    Author: Eric Viara <viara@sysra.com>
00022 */
00023 
00024 //
00025 // utils.odl
00026 //
00027 // Utility native classes
00028 //
00029 
00030 // ---------------------------------------------------------------------------
00031 //
00032 // Image Class
00033 //
00034 // ---------------------------------------------------------------------------
00035 
00036 enum image_type [ImageType] {
00037   GIF_IMG_TYPE [GIF_IMG_TYPE] = 1,
00038   JPEG_IMG_TYPE [JPEG_IMG_TYPE],
00039   PM_IMG_TYPE [PM_IMG_TYPE],
00040   PBM_IMG_TYPE [PBM_IMG_TYPE],
00041   X11BITMAP_IMG_TYPE [X11BITMAP_IMG_TYPE],
00042   BMP_IMG_TYPE [BMP_IMG_TYPE],
00043   TIFF_IMG_TYPE [TIFF_IMG_TYPE]
00044 };
00045 
00046 class image [Image] {
00047   string name;
00048   image_type #type;
00049   byte data[];
00050   int w;
00051   int h;
00052 };
00053 
00054 // ---------------------------------------------------------------------------
00055 //
00056 // WEB Contributions
00057 //
00058 // ---------------------------------------------------------------------------
00059 
00060 class URL [CURL] {
00061   string proto;
00062   string url;
00063   %C++{
00064   CURL(const char *proto, const char *url);
00065   %}
00066 };
00067 
00068 class w_config [WConfig] {
00069   string name;
00070   string user;
00071   string conf;
00072 };
00073 
00074 // ---------------------------------------------------------------------------
00075 //
00076 // Date Classes
00077 //
00078 // ---------------------------------------------------------------------------
00079 
00080 enum month [Month] {
00081   JANUARY [January] = 1,
00082   FEBRUARY [February] = 2,
00083   MARCH [March] = 3,
00084   APRIL [April] = 4,
00085   MAY [May] = 5,
00086   JUNE [June] = 6,
00087   JULY [July] = 7,
00088   AUGUST [August] = 8,
00089   SEPTEMBER [September] = 9,
00090   OCTOBER [October] = 10,
00091   NOVEMBER [November] = 11,
00092   DECEMBER [December] = 12    
00093 };
00094 
00095 enum weekday [Weekday] {
00096   SUNDAY [Sunday] = 0,
00097   MONDAY [Monday] = 1,
00098   TUESDAY [Tuesday] = 2,
00099   WEDNESDAY [Wednesday] = 3,
00100   THURSDAY [Thursday] = 4,
00101   FRIDAY [Friday] = 5,
00102   SATURDAY [Saturday] = 6
00103 };
00104 
00105 class date [Date] {
00106   attribute int32 julian; // julian day limited to 584554 years
00107 
00108   classmethod<client, called_from=OQL> date date(); // current date
00109   classmethod<client, called_from=OQL> date date(in date d); 
00110   classmethod<client, called_from=OQL> date date(in int32 julian_day);
00111   classmethod<client, called_from=OQL> date date(in int32 year, in month m, in int16 day);
00112   classmethod<client, called_from=OQL> date date(in string d); // ISO date format YYYY-MM-DD
00113   classmethod<client, called_from=OQL> int32 julian(in string d); // ISO date format YYYY-MM-DD
00114   instmethod<client, called_from=OQL> int32 year(); 
00115   instmethod<client, called_from=OQL> int16 month();
00116   instmethod<client, called_from=OQL> int16 day();
00117   instmethod<client, called_from=OQL> int16 day_of_year();
00118   instmethod<client, called_from=OQL> month month_of_year();
00119   instmethod<client, called_from=OQL> weekday day_of_week();
00120   instmethod<client, called_from=OQL> string toString(); // returns YYYY-MM-DD
00121   instmethod<client, called_from=OQL> int16 is_leap_year();
00122   instmethod<client, called_from=OQL> int16 is_equal(in date d);
00123   instmethod<client, called_from=OQL> int16 is_greater(in date d);
00124   instmethod<client, called_from=OQL> int16 is_greater_or_equal(in date d);
00125   instmethod<client, called_from=OQL> int16 is_less(in date d);
00126   instmethod<client, called_from=OQL> int16 is_less_or_equal(in date d);
00127   instmethod<client, called_from=OQL> int16 is_between(in date d1, in date d2);
00128   instmethod<client, called_from=OQL> date next(in weekday day);
00129   instmethod<client, called_from=OQL> date previous(in weekday day);
00130   instmethod<client, called_from=OQL> date add_days(in int32 days);
00131   instmethod<client, called_from=OQL> date substract_days(in int32 days);
00132   instmethod<client, called_from=OQL> int32 substract_date(in date d);
00133   instmethod<client, called_from=OQL> void set_julian(in int32 julian_day);
00134 
00135   %C++{
00136   private:
00137     char string_date[16];
00138 
00139     virtual void userCopy(const Object &);
00140     virtual void userInitialize();
00141     void setClientData();
00142 
00143   public:
00144     static Date * date(Database * db); // current date
00145     static Date * date(Database * db, const Date & d); 
00146     static Date * date(Database * db, eyedblib::int32 julian_day);
00147     static Date * date(Database * db, eyedblib::int32 year, Month::Type m, eyedblib::int16 day);
00148     static Date * date(Database * db, const char * d); // ISO date format YYYY-MM-DD
00149     static eyedblib::int32 julian(const char * d); // ISO date format YYYY-MM-DD
00150     eyedblib::int32 year() const;
00151     eyedblib::int16 month() const;
00152     eyedblib::int16 day() const;
00153     eyedblib::int16 day_of_year() const;
00154     Month::Type month_of_year() const;
00155     Weekday::Type day_of_week() const;
00156     const char * toString() const; // returns YYYY-MM-DD
00157     Bool is_leap_year() const;
00158     Bool is_equal(const Date & d) const;
00159     Bool is_greater(const Date & d) const;
00160     Bool is_greater_or_equal(const Date & d) const;
00161     Bool is_less(const Date & d) const;
00162     Bool is_less_or_equal(const Date & d) const;
00163     Bool is_between(const Date & d1, const Date & d2) const;
00164     Date & next(Weekday::Type day);
00165     Date & previous(Weekday::Type day);
00166     Date & add_days(eyedblib::int32 days);
00167     Date & substract_days(eyedblib::int32 days);
00168     eyedblib::int32 substract_date(const Date & d) const;
00169     Status set_julian(eyedblib::int32 julian_day);
00170     %}
00171 };
00172 
00173 class time [Time] {
00174   attribute int64 usecs; // temps GMT limited to 24 hours
00175   attribute int16 tz; // time zone in minutes
00176 
00177   classmethod<client, called_from=OQL> void get_local_time_zone(out int16 tz_hour, out int16 tz_min);
00178   classmethod<client, called_from=OQL> time gmt_time(); // current gmt time
00179   classmethod<client, called_from=OQL> time local_time(); // current local time
00180   classmethod<client, called_from=OQL> time time(in time t);
00181   classmethod<client, called_from=OQL> time time(in int64 usec);
00182   classmethod<client, called_from=OQL> time time(in int64 usec, in int16 tz);
00183   classmethod<client, called_from=OQL> time time(in int16 hours, in int16 min, in int16 sec, in int16 msec);
00184   classmethod<client, called_from=OQL> time time(in int16 hours, in int16 min, in int16 sec, in int16 msec, in int16 usec);
00185   classmethod<client, called_from=OQL> time time(in int16 hours, in int16 min, in int16 sec, in int16 msec, in int16 tz_hour, in int16 tz_minute);
00186   classmethod<client, called_from=OQL> time time(in int16 hours, in int16 min, in int16 sec, in int16 msec, in int16 usec, in int16 tz_hour, in int16 tz_minute);
00187   classmethod<client, called_from=OQL> time time(in string t); // time format : "HH:MM[:ss[,mmm[,uuu]]] [GMT[(+|-)HH[:MM]]]"
00188   classmethod<client, called_from=OQL> int64 usec_time(in string t); // date format: same as time(string t)
00189   instmethod<client, called_from=OQL> int16 hour();
00190   instmethod<client, called_from=OQL> int16 minute();
00191   instmethod<client, called_from=OQL> int16 second();
00192   instmethod<client, called_from=OQL> int16 millisecond(); 
00193   instmethod<client, called_from=OQL> int16 tz_hour();
00194   instmethod<client, called_from=OQL> int16 tz_minute();
00195   instmethod<client, called_from=OQL> string toString(); // returns "HH:MM:ss,mmm,uuu GMT+HH:MM"
00196   instmethod<client, called_from=OQL> int16 is_equal(in time t);
00197   instmethod<client, called_from=OQL> int16 is_greater(in time t);
00198   instmethod<client, called_from=OQL> int16 is_greater_or_equal(in time t);
00199   instmethod<client, called_from=OQL> int16 is_less(in time t);
00200   instmethod<client, called_from=OQL> int16 is_less_or_equal(in time t);
00201   instmethod<client, called_from=OQL> int16 is_between(in time t1, in time t2);
00202   instmethod<client, called_from=OQL> time add_interval(in time_interval i);
00203   instmethod<client, called_from=OQL> time substract_interval(in time_interval i);
00204   instmethod<client, called_from=OQL> time_interval substract_time(in time t);
00205   instmethod<client, called_from=OQL> int16 gmt_hour();
00206   instmethod<client, called_from=OQL> int16 gmt_minute();
00207   instmethod<client, called_from=OQL> int16 microsecond();
00208   instmethod<client, called_from=OQL> void set_usecs(in int64 usecs, in int16 tz);
00209 
00210   %C++{
00211   private:
00212     char string_time[48];
00213 
00214     virtual void userCopy(const Object &);
00215     virtual void userInitialize();
00216     void setClientData();
00217   public:
00218 
00219   Status set_usecs(eyedblib::int64 usecs, eyedblib::int16 tz);
00220   static void get_local_time_zone(eyedblib::int16 * tz_hour, eyedblib::int16 * tz_min);
00221   static Time * gmt_time(Database * db); // current gmt time
00222   static Time * local_time(Database * db); // current local time
00223   static Time * time(Database * db, const Time & t);
00224   static Time * time(Database * db, eyedblib::int64 usec);
00225   static Time * time(Database * db, eyedblib::int64 usec, eyedblib::int16 tz);
00226   static Time * time(Database * db, eyedblib::int16 hours, eyedblib::int16 min, eyedblib::int16 sec, eyedblib::int16 msec);
00227   static Time * time(Database * db, eyedblib::int16 hours, eyedblib::int16 min, eyedblib::int16 sec, eyedblib::int16 msec, eyedblib::int16 usec);
00228   static Time * time(Database * db, eyedblib::int16 hours, eyedblib::int16 min, eyedblib::int16 sec, eyedblib::int16 msec, eyedblib::int16 tz_hour, eyedblib::int16 tz_minute);
00229   static Time * time(Database * db, eyedblib::int16 hours, eyedblib::int16 min, eyedblib::int16 sec, eyedblib::int16 msec, eyedblib::int16 usec, eyedblib::int16 tz_hour, eyedblib::int16 tz_minute);
00230   static Time * time(Database * db, const char * t); // time format : "HH:MM[:ss[,mmm[,uuu]]] [GMT[(+|-)HH[:MM]]]"
00231   static eyedblib::int64 usec_time(const char * t); // date format: same as time(string t)
00232   eyedblib::int16 hour() const;
00233   eyedblib::int16 minute() const;
00234   eyedblib::int16 second() const;
00235   eyedblib::int16 millisecond() const; 
00236   eyedblib::int16 tz_hour() const;
00237   eyedblib::int16 tz_minute() const;
00238   const char * toString() const; // returns "HH:MM:ss,mmm,uuu GMT+HH:MM"
00239   Bool is_equal(const Time & t) const;
00240   Bool is_greater(const Time & t) const;
00241   Bool is_greater_or_equal(const Time & t) const;
00242   Bool is_less(const Time & t) const;
00243   Bool is_less_or_equal(const Time & t) const;
00244   Bool is_between(const Time & t1, const Time &t2) const;
00245   Time & add_interval(const TimeInterval & i);
00246   Time & substract_interval(const TimeInterval & i);
00247   TimeInterval * substract_time(const Time & t);
00248   eyedblib::int16 gmt_hour() const;
00249   eyedblib::int16 gmt_minute() const;
00250   eyedblib::int16 microsecond() const;
00251   %}
00252 };
00253 
00254 class time_stamp [TimeStamp] {
00255   attribute int64 usecs; // temps GMT limited to 584554 years
00256   attribute int16 tz; // time zone in minutes
00257 
00258   classmethod<client, called_from=OQL> time_stamp gmt_time_stamp(); // current gmt time
00259   classmethod<client, called_from=OQL> time_stamp local_time_stamp(); // current local time
00260   classmethod<client, called_from=OQL> time_stamp time_stamp(in time_stamp ts);
00261   classmethod<client, called_from=OQL> time_stamp time_stamp(in int64 usec);
00262   classmethod<client, called_from=OQL> time_stamp time_stamp(in int64 usec, in int16 tz);
00263   classmethod<client, called_from=OQL> time_stamp time_stamp(in int32 julian_day, in int64 usec);
00264   classmethod<client, called_from=OQL> time_stamp time_stamp(in int32 julian_day, in int64 usec, in int16 tz);
00265   classmethod<client, called_from=OQL> time_stamp time_stamp(in date d, in time t);
00266   classmethod<client, called_from=OQL> time_stamp time_stamp(in date d);
00267   classmethod<client, called_from=OQL> time_stamp time_stamp(in date d, in int16 tz_hour, in int16 tz_min);
00268   classmethod<client, called_from=OQL> time_stamp time_stamp(in string ts);
00269   classmethod<client, called_from=OQL> int64 usec_time_stamp(in string ts);
00270   instmethod<client, called_from=OQL> date date();
00271   instmethod<client, called_from=OQL> time time();
00272   instmethod<client, called_from=OQL> int32 year();
00273   instmethod<client, called_from=OQL> int16 month();
00274   instmethod<client, called_from=OQL> int16 day();
00275   instmethod<client, called_from=OQL> int16 hour();
00276   instmethod<client, called_from=OQL> int16 minute();
00277   instmethod<client, called_from=OQL> int16 second();
00278   instmethod<client, called_from=OQL> int16 millisecond(); 
00279   instmethod<client, called_from=OQL> int16 tz_hour();
00280   instmethod<client, called_from=OQL> int16 tz_minute();
00281   instmethod<client, called_from=OQL> string toString(); // returns Date.toString() + " " + Time.toString()
00282   instmethod<client, called_from=OQL> time_stamp plus(in time_interval i);
00283   instmethod<client, called_from=OQL> time_stamp minus(in time_interval i);
00284   instmethod<client, called_from=OQL> int16 is_equal(in time_stamp ts);
00285   instmethod<client, called_from=OQL> int16 is_greater(in time_stamp ts);
00286   instmethod<client, called_from=OQL> int16 is_greater_or_equal(in time_stamp ts);
00287   instmethod<client, called_from=OQL> int16 is_less(in time_stamp ts);
00288   instmethod<client, called_from=OQL> int16 is_less_or_equal(in time_stamp ts);
00289   instmethod<client, called_from=OQL> int16 is_between(in time_stamp ts1, in time_stamp ts2);
00290   instmethod<client, called_from=OQL> int16 gmt_hour();
00291   instmethod<client, called_from=OQL> int16 gmt_minute();
00292   instmethod<client, called_from=OQL> int16 microsecond();
00293   instmethod<client, called_from=OQL> void set_usecs(in int64 usec, in int16 tz);
00294   instmethod<client, called_from=OQL> time_interval substract(in time_stamp ts);
00295 
00296 
00297   %C++{
00298  private:
00299   Time ts_time;
00300   Date ts_date;
00301   char string_time_stamp[64];
00302 
00303   virtual void userCopy(const Object &);
00304   virtual void userInitialize();
00305   void setClientData();
00306  public:
00307   static TimeStamp * gmt_time_stamp(Database * db); // current gmt time
00308   static TimeStamp * local_time_stamp(Database * db); // current local time
00309   static TimeStamp * time_stamp(Database * db, const TimeStamp &);
00310   static TimeStamp * time_stamp(Database * db, eyedblib::int64 usec);
00311   static TimeStamp * time_stamp(Database * db, eyedblib::int64 usec, eyedblib::int16 tz);
00312   static TimeStamp * time_stamp(Database * db, eyedblib::int32 julian_day, eyedblib::int64 usec);
00313   static TimeStamp * time_stamp(Database * db, eyedblib::int32 julian_day, eyedblib::int64 usec, eyedblib::int16 tz);
00314   static TimeStamp * time_stamp(Database * db, const Date & d, const Time & t);
00315   static TimeStamp * time_stamp(Database * db, const Date & d);
00316   static TimeStamp * time_stamp(Database * db, const Date & d, eyedblib::int16 tz_hour, eyedblib::int16 tz_min);
00317   static TimeStamp * time_stamp(Database * db, const char * t);
00318   static eyedblib::int64 usec_time_stamp(const char * ts);
00319   const Date & date() const;
00320   const Time & time() const;
00321   eyedblib::int32 year() const;
00322   eyedblib::int16 month() const;
00323   eyedblib::int16 day() const;
00324   eyedblib::int16 hour() const;
00325   eyedblib::int16 minute() const;
00326   eyedblib::int16 second() const;
00327   eyedblib::int16 millisecond() const;
00328   eyedblib::int16 tz_hour() const;
00329   eyedblib::int16 tz_minute() const;
00330   const char * toString() const; // returns Date.toString() + " " + Time.toString()
00331   TimeStamp & plus(const TimeInterval & i);
00332   TimeStamp & minus(const TimeInterval & i);
00333   Bool is_equal(const TimeStamp & ts) const;
00334   Bool is_greater(const TimeStamp & ts) const;
00335   Bool is_greater_or_equal(const TimeStamp & ts) const;
00336   Bool is_less(const TimeStamp & ts) const;
00337   Bool is_less_or_equal(const TimeStamp & ts) const;
00338   Bool is_between(const TimeStamp & ts1, const TimeStamp & ts2) const;
00339   eyedblib::int16 gmt_hour() const;
00340   eyedblib::int16 gmt_minute() const;
00341   eyedblib::int16 microsecond() const;
00342   Status set_usecs(eyedblib::int64 usec, eyedblib::int16 tz);
00343   TimeInterval * substract(const TimeStamp & ts);
00344   %}
00345 };
00346 
00347 class time_interval [TimeInterval] {
00348   attribute int64 usecs; // time interval between 2 dates
00349                          // days, hours, min, sec, ms, us
00350 
00351   classmethod<client, called_from=OQL> time_interval time_interval(in int64 usecs);
00352   classmethod<client, called_from=OQL> time_interval time_interval(in int32 day, in int16 hours, in int16 min, in int16 sec, in int16 msec, in int16 usec);
00353   instmethod<client, called_from=OQL> int32 day();
00354   instmethod<client, called_from=OQL> int16 hour();
00355   instmethod<client, called_from=OQL> int16 minute();
00356   instmethod<client, called_from=OQL> int16 second();
00357   instmethod<client, called_from=OQL> int16 millisecond();
00358   instmethod<client, called_from=OQL> int16 microsecond();
00359   instmethod<client, called_from=OQL> int16 is_zero();
00360   instmethod<client, called_from=OQL> string toString(); // format : "[D ]HH:MM:ss,mmm,uuu"
00361   instmethod<client, called_from=OQL> time_interval plus(in time_interval i);
00362   instmethod<client, called_from=OQL> time_interval minus(in time_interval i);
00363   instmethod<client, called_from=OQL> time_interval product(in int64 val);
00364   instmethod<client, called_from=OQL> time_interval quotient(in int64 val);
00365   instmethod<client, called_from=OQL> int16 is_equal(in time_interval i);
00366   instmethod<client, called_from=OQL> int16 is_greater(in time_interval i);
00367   instmethod<client, called_from=OQL> int16 is_greater_or_equal(in time_interval i);
00368   instmethod<client, called_from=OQL> int16 is_less(in time_interval i);
00369   instmethod<client, called_from=OQL> int16 is_less_or_equal(in time_interval i);
00370   instmethod<client, called_from=OQL> void set_usecs(in int64 usecs);
00371  
00372 
00373   
00374   %C++{
00375   private:
00376     char string_time_interval[32];
00377 
00378     virtual void userCopy(const Object &);
00379     virtual void userInitialize();
00380     void setClientData();
00381   public:
00382 
00383   static TimeInterval * time_interval(Database *, eyedblib::int64 usecs);
00384   static TimeInterval * time_interval(Database *, eyedblib::int32 day, eyedblib::int16 hours, eyedblib::int16 min, eyedblib::int16 sec, eyedblib::int16 msec, eyedblib::int16 usec);
00385   eyedblib::int32 day() const;
00386   eyedblib::int16 hour() const;
00387   eyedblib::int16 minute() const;
00388   eyedblib::int16 second() const;
00389   eyedblib::int16 millisecond() const;
00390   eyedblib::int16 microsecond() const;
00391   Bool is_zero() const;
00392   const char * toString() const; // format : "[D ]HH:MM:ss,mmm,uuu"
00393   TimeInterval & plus(const TimeInterval & i);
00394   TimeInterval & minus(const TimeInterval & i);
00395   TimeInterval & product(eyedblib::int64 val);
00396   TimeInterval & quotient(eyedblib::int64 val);
00397   Bool is_equal(const TimeInterval & i) const;
00398   Bool is_greater(const TimeInterval & i) const;
00399   Bool is_greater_or_equal(const TimeInterval & i) const;
00400   Bool is_less(const TimeInterval & i) const;
00401   Bool is_less_or_equal(const TimeInterval & i) const;
00402   Status set_usecs(eyedblib::int64 usecs);
00403   %}
00404 
00405 };
00406 
00407 // ---------------------------------------------------------------------------
00408 //
00409 // Ostring Classes
00410 //
00411 // ---------------------------------------------------------------------------
00412 
00413 class ostring [OString] {
00414   string s;
00415 
00416   classmethod<client, called_from=OQL> ostring ostring();
00417   classmethod<client, called_from=OQL> ostring ostring(in string s);
00418   classmethod<client, called_from=OQL> ostring ostring(in string s, in int len);
00419   classmethod<client, called_from=OQL> ostring ostring(in string s, in int offset, in int len);
00420   classmethod<client, called_from=OQL> ostring ostring(in ostring s);
00421   classmethod<client, called_from=OQL> ostring ostring(in char s);
00422   classmethod<client, called_from=OQL> ostring ostring(in int s);
00423   classmethod<client, called_from=OQL> ostring ostring(in double s);
00424   
00425   classmethod<client, called_from=OQL> int strlen(in string s);
00426   classmethod<client, called_from=OQL> int strcmp(in string s1, in string s2);
00427   classmethod<client, called_from=OQL> int strstr(in string s1, in string s2);
00428   classmethod<client, called_from=OQL> string substr(in string s, in int offset, in int len);
00429   classmethod<client, called_from=OQL> string toLower(in string s);
00430   classmethod<client, called_from=OQL> string toUpper(in string s);
00431   classmethod<client, called_from=OQL> string rtrim(in string s);
00432   classmethod<client, called_from=OQL> string ltrim(in string s);
00433 
00434   classmethod<client, called_from=OQL> ostring concat(in string s1, in string s2);
00435 
00436   instmethod<client, called_from=OQL> void setChar(in char c, in int offset) %oql{
00437     this.s[offset] := c;
00438   %}
00439 
00440   instmethod<client, called_from=OQL> char getChar(in int offset) %oql{
00441     return this.s[offset];
00442   %}
00443 
00444   instmethod<client, called_from=OQL> ostring append(in string s);
00445   instmethod<client, called_from=OQL> ostring append(in string s, in int len);
00446   instmethod<client, called_from=OQL> ostring append(in string s, in int offset, in int len);
00447 
00448   instmethod<client, called_from=OQL>ostring prepend(in string s);
00449   instmethod<client, called_from=OQL> ostring prepend(in string s, in int len);
00450   instmethod<client, called_from=OQL> ostring prepend(in string s, in int offset, in int len);
00451   
00452   instmethod<client, called_from=OQL> ostring insert(in int offset, in string s);
00453   instmethod<client, called_from=OQL> ostring insert(in int offset, in string, in int len);
00454   instmethod<client, called_from=OQL> ostring insert(in int offset, in string, in int offset2, in int len);
00455 
00456   instmethod<client, called_from=OQL> int first(in string s);
00457   instmethod<client, called_from=OQL> int last(in string s);
00458   instmethod<client, called_from=OQL> int find(in string s, in int offset);
00459 
00460   instmethod<client, called_from=OQL> ostring substr(in int offset, in int len);
00461   instmethod<client, called_from=OQL> ostring substr(in string regexp, in int offset);
00462 
00463   instmethod<client, called_from=OQL> ostring erase(in int offset, in int len);
00464   instmethod<client, called_from=OQL> ostring replace(in int offset, in int len, in string);
00465   instmethod<client, called_from=OQL> ostring replace(in int offset, in int len, in string, in int len2);
00466   instmethod<client, called_from=OQL> ostring replace(in int offset, in int len, in string, in int offset2, in int len2);
00467   instmethod<client, called_from=OQL> ostring replace(in string s1, in string s2); // replace global!
00468   instmethod<client, called_from=OQL> void reset();
00469 
00470   instmethod<client, called_from=OQL> ostring assign(in string s) %oql{
00471         this->s := s;
00472         return this;
00473   %}
00474      
00475   instmethod<client, called_from=OQL> ostring assign(in string s, in int len);
00476   instmethod<client, called_from=OQL> ostring assign(in string s, in int offset, in int len);
00477 
00478   instmethod<client, called_from=OQL> ostring toLower();
00479   instmethod<client, called_from=OQL> ostring toUpper();
00480 
00481   instmethod<client, called_from=OQL> ostring rtrim();
00482   instmethod<client, called_from=OQL> ostring ltrim();
00483 
00484   instmethod<client, called_from=OQL> int compare(in string s);
00485   instmethod<client, called_from=OQL> int compare(in string s, in int to);
00486   instmethod<client, called_from=OQL> int compare(in string s, in int from, in int to);
00487 
00488   instmethod<client, called_from=OQL> int is_null();
00489   instmethod<client, called_from=OQL> int match(in string regexp);
00490   instmethod<client, called_from=OQL> int length();
00491   instmethod<client, called_from=OQL> string[] split(in string separator);
00492   instmethod<client, called_from=OQL> string[] regexp_split(in string regexp_separator);
00493 
00494   %C++{
00495     static OString * ostring(Database * db);
00496     static OString * ostring(Database * db, const char * s);
00497     static OString * ostring(Database * db, const char * s, int len);
00498     static OString * ostring(Database * db, const char * s, int offset, int len);
00499     static OString * ostring(Database * db, const OString & s);
00500     static OString * ostring(Database * db, char s);
00501     static OString * ostring(Database * db, int s);
00502     static OString * ostring(Database * db, double s);    
00503     static OString * concat(Database * db, const char * s1, const char * s2);
00504     static char * substr(const char *, int offset, int len);
00505     static char * toLower(const char *);
00506     static char * toUpper(const char *);
00507     static char * rtrim(const char *);
00508     static char * ltrim(const char *);    
00509     
00510     Status setChar(char c, int offset);
00511     char getChar(int offset) const;
00512 
00513     OString & append(const char * s);
00514     OString & append(const char * s, int len);
00515     OString & append(const char * s, int offset, int len);
00516     OString & prepend(const char * s);
00517     OString & prepend(const char * s, int len);   
00518     OString & prepend(const char * s, int offset, int len);   
00519     OString & insert(int offset, const char *);
00520     OString & insert(int offset, const char *, int len);    
00521     OString & insert(int offset, const char *, int offset2, int len);    
00522         
00523     int first(const char *) const;
00524     int last(const char *) const;
00525     int find(const char *, int offset) const;
00526     OString * substr(int offset, int len) const;
00527     OString * substr(const char * regexp, int offset) const;
00528 
00529     OString & erase(int offset, int len);
00530     OString & replace(int offset, int len, const char *);
00531     OString & replace(int offset, int len, const char *, int len2);
00532     OString & replace(int offset, int len, const char *, int offset2, int len2);
00533     OString & replace(const char * s1, const char * s2);
00534     OString & assign(const char *);
00535     OString & assign(const char *, int len);
00536     OString & assign(const char *, int offset, int len);
00537     Status reset();
00538     
00539     OString & toLower();
00540     OString & toUpper();
00541     
00542     OString & rtrim();
00543     OString & ltrim();
00544 
00545     int compare(const char *) const;
00546     int compare(const char *, int to) const;
00547     int compare(const char *, int from, int to) const;
00548     Bool is_null() const;
00549     Bool match(const char * regexp) const;
00550 
00551     int length() const;
00552     char ** split(const char * separator, int & nb_pieces) const; 
00553     char ** regexp_split(const char * regexp_separator, int & nb_pieces) const;
00554     %}
00555 };

Generated on Mon Dec 22 18:16:13 2008 for eyedb by  doxygen 1.5.3