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; }
void clear() { if ( has_value ) { contained.destruct_value(); contained.construct_error( std::exception_ptr() ); } has_value = false; }
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; }
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; }
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 ); } }
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; }
iterator begin() { return _data.begin(); }
node_t const& operator[](nodeid_t id) const { return _data.at(id); }
int storage_unlink(storage_t storage, const char *path) { return storage->unlink(storage->state, path); }
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() ); }
error_type const & error() const { return has_value ? (throw nonstd::bad_expected_access("expected: no contained error"), contained.error() ) : contained.error(); }
expected() : has_value( false ) { contained.construct_error( std::exception_ptr() ); }
int storage_store_buffer(storage_t storage, const char *path, struct buffer *buffer) { return storage->store_buffer(storage->state, path, buffer); }
value_type & value() { return has_value ? contained.value() : ( std::rethrow_exception( contained.error() ), contained.value() ); }
const_iterator cend() const { return _data.cend(); }
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(""); }
iterator end() { return _data.end(); }
~expected() { if ( has_value ) contained.destruct_value(); else contained.destruct_error(); }
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() ); }
expected( nullexp_t, error_type const & rhs ) : has_value( false ) { contained.construct_error( rhs ); }
expected( value_type const & rhs ) : has_value( true ) { contained.construct_value( rhs ); }
const_iterator cbegin() const { return _data.cbegin(); }
value_type * operator ->() { assert( has_value ); return contained.value_ptr(); }
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); }
value_type const & operator *() const { assert( has_value ); return contained.value(); }
value_type & operator *() { assert( has_value ); return contained.value(); }
int storage_store_file(storage_t storage, const char *path, FILE *file) { return storage->store_file(storage->state, path, file); }