예제 #1
0
파일: scrollbar.cpp 프로젝트: calref/cboe
void cScrollbar::restore(storage_t to) {
	cControl::restore(to);
	if(to.find("scroll-pos") != to.end())
		pos = boost::any_cast<int>(to["scroll-pos"]);
	if(to.find("scroll-max") != to.end())
		pos = boost::any_cast<int>(to["scroll-max"]);
	else pos = 0;
}
예제 #2
0
 void clear()
 {
     if ( has_value )
     {
         contained.destruct_value();
         contained.construct_error( std::exception_ptr() );
     }
     has_value = false;
 }
예제 #3
0
파일: scrollpane.cpp 프로젝트: calref/cboe
void cScrollPane::restore(storage_t to) {
	// We don't call the superclass restore() here like the other controls do
	if(to.find("") != to.end())
		scroll.restore(boost::any_cast<storage_t>(to[""]));
	for(auto& ctrl : contents) {
		if(to.find(ctrl.first) != to.end())
			ctrl.second->restore(boost::any_cast<storage_t>(to[ctrl.first]));
	}
}
예제 #4
0
 void clear()
 {
     if ( has_value )
     {
         contained.destruct_value();
         contained.construct_error( error_type() );
     }
     has_value = false;
 }
예제 #5
0
파일: field.cpp 프로젝트: calref/cboe
void cTextField::restore(storage_t to) {
	cControl::restore(to);
	if(to.find("fld-ip") != to.end())
		insertionPoint = boost::any_cast<int>(to["fld-ip"]);
	else insertionPoint = getText().length();
	if(to.find("fld-sp") != to.end())
		selectionPoint = boost::any_cast<int>(to["fld-sp"]);
	else selectionPoint = 0;
}
예제 #6
0
    void swap( expected & rhs )
    {
        using std::swap;

        if      ( has_value == true  && rhs.has_value == true  ) { swap( contained.value(), rhs.contained.value() ); }
        else if ( has_value == false && rhs.has_value == false ) { swap( contained.error(), rhs.contained.error() ); }
        else if ( has_value == false && rhs.has_value == true  ) { rhs.swap( *this ); }
        else if ( has_value == true  && rhs.has_value == false ) { error_type t = rhs.contained.error();
                                                                   rhs.contained.destruct_error();
                                                                   rhs.contained.construct_value( contained.value() );
                                                                   contained.construct_error( t );
                                                                   swap( has_value, rhs.has_value );
                                                                 }
    }
예제 #7
0
 al_graph(std::initializer_list<nodeid_t> const& list)
     : has_mark(false)
 {
     std::for_each(list.begin(), list.end(),
     [&](nodeid_t id) {
         _data.insert({id, node_t{id}});
     });
 }
예제 #8
0
    // klen: key field length in bits in hash (i.e before rounding up to bytes)
    // vlen: value field length in bits
    sorted_dumper(uint_t _threads, const char *_file_prefix, size_t _buffer_size, 
                  uint_t _vlen, storage_t *_ary) :
      threads(_threads), file_prefix(_file_prefix), buffer_size(_buffer_size),
      klen(_ary->get_key_len()), vlen(_vlen), ary(_ary), file_index(0),
      tr(), lower_count(0), upper_count(std::numeric_limits<uint64_t>::max()),
      one_file(false)
    {
      key_len    = bits_to_bytes(klen);
      val_len    = bits_to_bytes(vlen);
      record_len = key_len + val_len;
      nb_records = ary->floor_block(_buffer_size / record_len, nb_blocks);
      while(nb_records < ary->get_max_reprobe_offset()) {
        nb_records = ary->floor_block(2 * nb_records, nb_blocks);
      }

      thread_info = new struct thread_info_t[threads];
      for(uint_t i = 0; i < threads; i++) {
        //        thread_info[i].token = i == 0;
        thread_info[i].writer.initialize(nb_records, klen, vlen, ary);
        thread_info[i].heap.initialize(ary->get_max_reprobe_offset());
        thread_info[i].token = tr.new_token();
      }
      unique = distinct = total = max_count = 0;
    }
예제 #9
0
 iterator begin() {
     return _data.begin();
 }
예제 #10
0
 node_t const& operator[](nodeid_t id) const {
     return _data.at(id);
 }
예제 #11
0
int storage_unlink(storage_t storage, const char *path)
{
  return storage->unlink(storage->state, path);
}
예제 #12
0
 void initialize_value( V const & v )
 {
     assert( ! has_value );
     contained.construct_value( v );
     has_value = true;
 }
예제 #13
0
 expected()
 : has_value( false )
 {
     contained.construct_error( error_type() );
 }
예제 #14
0
 error_type const & error() const
 {
     return has_value ? (throw nonstd::bad_expected_access("expected: no contained error"), contained.error() ) : contained.error();
 }
예제 #15
0
 expected()
 : has_value( false )
 {
     contained.construct_error( std::exception_ptr() );
 }
예제 #16
0
int storage_store_buffer(storage_t storage, const char *path, struct buffer *buffer)
{
  return storage->store_buffer(storage->state, path, buffer);
}
예제 #17
0
 value_type & value()
 {
     return has_value ? contained.value() : ( std::rethrow_exception( contained.error() ), contained.value() );
 }
예제 #18
0
 const_iterator cend() const {
     return _data.cend();
 }
예제 #19
0
파일: button.cpp 프로젝트: LibreGames/cboe
void cLedGroup::restore(storage_t to) {
	cControl::restore(to);
	if(to.find("led-select") != to.end())
		setSelected(boost::any_cast<std::string>(to["led-select"]));
	else setSelected("");
}
예제 #20
0
 iterator end() {
     return _data.end();
 }
예제 #21
0
 ~expected()
 {
     if ( has_value ) contained.destruct_value();
     else             contained.destruct_error();
 }
예제 #22
0
 expected( expected const & rhs )
 : has_value( rhs.has_value )
 {
     if ( has_value ) contained.construct_value( rhs.contained.value() );
     else             contained.construct_error( rhs.contained.error() );
 }
예제 #23
0
 expected( nullexp_t, error_type const & rhs )
 : has_value( false )
 {
     contained.construct_error( rhs );
 }
예제 #24
0
 expected( value_type const & rhs )
 : has_value( true )
 {
     contained.construct_value( rhs );
 }
예제 #25
0
 const_iterator cbegin() const {
     return _data.cbegin();
 }
예제 #26
0
 value_type * operator ->()
 {
     assert( has_value );
     return contained.value_ptr();
 }
예제 #27
0
파일: button.cpp 프로젝트: LibreGames/cboe
void cLed::restore(storage_t to) {
	cButton::restore(to);
	if(to.find("led-state") != to.end())
		setState(boost::any_cast<eLedState>(to["led-state"]));
	else setState(led_off);
}
예제 #28
0
 value_type const & operator *() const
 {
     assert( has_value );
     return contained.value();
 }
예제 #29
0
 value_type & operator *()
 {
     assert( has_value );
     return contained.value();
 }
예제 #30
0
int storage_store_file(storage_t storage, const char *path, FILE *file)
{
  return storage->store_file(storage->state, path, file);
}