Ignore:
Timestamp:
07/23/15 17:29:49 (10 years ago)
Author:
epyon
Message:
  • massive amount of std::string removal
  • removed slurp, use filesystem::slurp instead
  • lua_values const_string support
  • several bugfixes
  • program_manager and shader loading without std::string/std::stream
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/stl/string/short_string.hh

    r435 r438  
    1010#include <nv/stl/string/common.hh>
    1111#include <nv/stl/string/string_base.hh>
     12#include <nv/stl/string/string_twine.hh>
    1213#include <nv/stl/container/random_access.hh>
    1314#include <nv/stl/container/contiguous_storage.hh>
     
    3233                }
    3334
     35
     36                template < typename Base >
     37                inline explicit string_buffer_base( const string_base< Base >& s ) : this_type( s.data(), s.size() ) {}
    3438                inline explicit string_buffer_base( const string_view& s ) : this_type( s.data(), s.size() ) {}
    35                 template < typename S >
    36                 inline string_buffer_base( const string_base<S>& rhs ) : this_type( rhs.data(), rhs.size() ) {}
     39
     40                inline string_buffer_base( const string_twine& twine )
     41                {
     42                        append( twine );
     43                }
    3744                inline string_buffer_base( string_buffer_base&& copy ) = default;
    3845                inline string_buffer_base& operator=( string_buffer_base&& other ) = default;
    39                 inline string_buffer_base& operator=( const string_view& other )
    40                 {
    41                         clear();
    42                         append( other );
    43                 }
    4446
    4547                size_t append( const char* data, size_t sz )
     
    4951                        raw_copy_n( data, amount, this->begin() + pos );
    5052                        return amount;
     53                }
     54
     55                size_t append( const string_twine& twine )
     56                {
     57                        size_t pos = size();
     58                        size_t dump_size = twine.dump_size();
     59                        expand_by( dump_size );
     60                        twine.dump( array_ref< char >( data() + pos, size() - pos ) );
     61                        return size() - pos;
    5162                }
    5263
     
    111122                void reserve( size_type new_capacity )
    112123                {
    113                         Storage::reserve( new_capacity + 1, true );
     124                        Storage::reserve( new_capacity + 1 );
    114125                        this->data()[this->size()] = 0;
    115126                }
     
    117128                void resize( size_type new_size )
    118129                {
    119                         Storage::reserve( new_size + 1, true );
     130                        Storage::reserve( new_size + 1 );
    120131                        Storage::resize( min( new_size, capacity() - 1 ) );
    121132                        this->data()[this->size()] = 0;
Note: See TracChangeset for help on using the changeset viewer.