Ignore:
Timestamp:
Jan 30, 2006 6:40:05 PM (18 years ago)
Author:
bennylp
Message:

Finished implementation of UA layer (to be tested)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj++/string.hpp

    r122 r127  
    4141 
    4242    // 
    43     // Construct the buffer from a char*. 
    44     // 
    45     explicit Pj_String(char *str)  
     43    // Construct the buffer from a char* (use with care) 
     44    // 
     45    Pj_String(char *str)  
    4646    {  
    4747        set(str); 
     
    5151    // Construct from a const char*. 
    5252    // 
    53     Pj_String(Pj_Pool *pool, const char *src) 
     53    Pj_String(Pj_Pool &pool, const char *src) 
    5454    { 
    5555        set(pool, src); 
     
    5757 
    5858    // 
    59     // Construct from pj_str_t*. 
    60     // 
    61     explicit Pj_String(pj_str_t *s) 
    62     { 
    63         set(s); 
     59    // Construct from pj_str_t&. 
     60    // 
     61    explicit Pj_String(pj_str_t &s) 
     62    { 
     63        ptr = s.ptr; 
     64        slen = s.slen; 
     65    } 
     66 
     67    // 
     68    // Construct from const pj_str_t& (use with care!). 
     69    // 
     70    explicit Pj_String(const pj_str_t &s) 
     71    { 
     72        ptr = (char*)s.ptr; 
     73        slen = s.slen; 
    6474    } 
    6575 
     
    6777    // Construct by copying from const pj_str_t*. 
    6878    // 
    69     Pj_String(Pj_Pool *pool, const pj_str_t *s) 
     79    Pj_String(Pj_Pool &pool, const pj_str_t *s) 
    7080    { 
    7181        set(pool, s); 
     
    7383 
    7484    // 
    75     // Construct from another Pj_String 
    76     // 
    77     explicit Pj_String(Pj_String &rhs) 
    78     { 
    79         set(rhs); 
    80     } 
    81  
    82     // 
    8385    // Construct by copying from Pj_String 
    8486    // 
    85     Pj_String(Pj_Pool *pool, const Pj_String &rhs) 
     87    Pj_String(Pj_Pool &pool, const Pj_String &rhs) 
    8688    { 
    8789        set(pool, rhs); 
     
    8991 
    9092    // 
     93    // Construct from another Pj_String, use with care! 
     94    // 
     95    explicit Pj_String(const Pj_String &rhs) 
     96    { 
     97        ptr = rhs.ptr; 
     98        slen = rhs.slen; 
     99    } 
     100 
     101    // 
    91102    // Construct from a char* and a length. 
    92103    // 
     
    105116 
    106117    // 
     118    // You can cast Pj_String to pj_str_t* 
     119    // 
     120    operator pj_str_t*() 
     121    { 
     122        return this; 
     123    } 
     124 
     125    // 
     126    // You can cast const Pj_String to const pj_str_t* 
     127    // 
     128    operator const pj_str_t*() const 
     129    { 
     130        return this; 
     131    } 
     132 
     133    // 
    107134    // Get the length of the string. 
    108135    // 
     
    139166    // Initialize by copying from a const char*. 
    140167    // 
    141     void set(Pj_Pool *pool, const char *s) 
    142     { 
    143         pj_strdup2(pool->pool_(), this, s); 
     168    void set(Pj_Pool &pool, const char *s) 
     169    { 
     170        pj_strdup2(pool, this, s); 
    144171    } 
    145172 
     
    155182    // Initialize by copying from const pj_str_t*. 
    156183    // 
    157     void set(Pj_Pool *pool, const pj_str_t *s) 
    158     { 
    159         pj_strdup(pool->pool_(), this, s); 
     184    void set(Pj_Pool &pool, const pj_str_t *s) 
     185    { 
     186        pj_strdup(pool, this, s); 
    160187    } 
    161188 
     
    187214    // Initialize by copying from a Pj_String*. 
    188215    // 
    189     void set(Pj_Pool *pool, const Pj_String *s) 
    190     { 
    191         pj_strdup(pool->pool_(), this, s); 
     216    void set(Pj_Pool &pool, const Pj_String *s) 
     217    { 
     218        pj_strdup(pool, this, s); 
    192219    } 
    193220 
     
    195222    // Initialize by copying from other Pj_String. 
    196223    // 
    197     void set(Pj_Pool *pool, const Pj_String &s) 
    198     { 
    199         pj_strdup(pool->pool_(), this, &s); 
     224    void set(Pj_Pool &pool, const Pj_String &s) 
     225    { 
     226        pj_strdup(pool, this, &s); 
    200227    } 
    201228 
     
    354381 
    355382    /// 
    356     // Assign from another Pj_String 
    357     // 
    358     Pj_String& operator=(Pj_String &rhs) 
    359     { 
    360         set(rhs); 
     383    // Assign from another Pj_String, use with care! 
     384    // 
     385    Pj_String& operator=(const Pj_String &rhs) 
     386    { 
     387        ptr = rhs.ptr; 
     388        slen = rhs.slen; 
    361389        return *this; 
    362390    } 
Note: See TracChangeset for help on using the changeset viewer.