Example #1
0
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;
}
Example #2
0
 void clear()
 {
     if ( has_value )
     {
         contained.destruct_value();
         contained.construct_error( std::exception_ptr() );
     }
     has_value = false;
 }
Example #3
0
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]));
	}
}
 void clear()
 {
     if ( has_value )
     {
         contained.destruct_value();
         contained.construct_error( error_type() );
     }
     has_value = false;
 }
Example #5
0
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;
}
Example #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 );
                                                                 }
    }
Example #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}});
     });
 }
    // 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;
    }
Example #9
0
 iterator begin() {
     return _data.begin();
 }
Example #10
0
 node_t const& operator[](nodeid_t id) const {
     return _data.at(id);
 }
Example #11
0
int storage_unlink(storage_t storage, const char *path)
{
  return storage->unlink(storage->state, path);
}
Example #12
0
 void initialize_value( V const & v )
 {
     assert( ! has_value );
     contained.construct_value( v );
     has_value = true;
 }
 expected()
 : has_value( false )
 {
     contained.construct_error( error_type() );
 }
Example #14
0
 error_type const & error() const
 {
     return has_value ? (throw nonstd::bad_expected_access("expected: no contained error"), contained.error() ) : contained.error();
 }
Example #15
0
 expected()
 : has_value( false )
 {
     contained.construct_error( std::exception_ptr() );
 }
Example #16
0
int storage_store_buffer(storage_t storage, const char *path, struct buffer *buffer)
{
  return storage->store_buffer(storage->state, path, buffer);
}
Example #17
0
 value_type & value()
 {
     return has_value ? contained.value() : ( std::rethrow_exception( contained.error() ), contained.value() );
 }
Example #18
0
 const_iterator cend() const {
     return _data.cend();
 }
Example #19
0
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("");
}
Example #20
0
 iterator end() {
     return _data.end();
 }
Example #21
0
 ~expected()
 {
     if ( has_value ) contained.destruct_value();
     else             contained.destruct_error();
 }
Example #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() );
 }
Example #23
0
 expected( nullexp_t, error_type const & rhs )
 : has_value( false )
 {
     contained.construct_error( rhs );
 }
Example #24
0
 expected( value_type const & rhs )
 : has_value( true )
 {
     contained.construct_value( rhs );
 }
Example #25
0
 const_iterator cbegin() const {
     return _data.cbegin();
 }
Example #26
0
 value_type * operator ->()
 {
     assert( has_value );
     return contained.value_ptr();
 }
Example #27
0
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);
}
Example #28
0
 value_type const & operator *() const
 {
     assert( has_value );
     return contained.value();
 }
Example #29
0
 value_type & operator *()
 {
     assert( has_value );
     return contained.value();
 }
Example #30
0
int storage_store_file(storage_t storage, const char *path, FILE *file)
{
  return storage->store_file(storage->state, path, file);
}