本文整理汇总了C++中element类的典型用法代码示例。如果您正苦于以下问题:C++ element类的具体用法?C++ element怎么用?C++ element使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了element类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//------------------------------------------------------------------
structure_processor::structure_processor(const config& cfg,
const element& e,
content_storage& result) :
m_cfg(cfg),
m_result(result)
{
m_result.reserve(e.total_len());
e.process(*this);
}
示例2: m_cfg
//------------------------------------------------------------------
code_colorer::code_colorer(const config& cfg,
const element& e,
content_storage& result) :
m_cfg(cfg),
m_result(result),
m_coloring_element(0)
{
m_result.reserve(e.total_len());
e.process(*this);
}
示例3: m_cfg
//------------------------------------------------------------------
table_structurizer::table_structurizer(const config& cfg,
const element& e,
content_storage& result) :
m_cfg(cfg),
m_result(result),
m_skip_element(0)
{
m_result.reserve(e.total_len());
e.process(*this);
}
示例4: make_pair
double
element::chemicalMass( const element& e )
{
std::pair<double, double> sum
= std::accumulate( e.isotopes().begin(), e.isotopes().end()
, std::make_pair( 0.0, 0.0 )
, []( const std::pair<double, double>& a, const toe::isotope& i ){
return std::make_pair( a.first + (i.mass * i.abundance), a.second + i.abundance ); });
//assert( adportable::compare<double>::approximatelyEqual( sum.second, 1.0 ) );
return sum.first;
}
示例5: end_element
//------------------------------------------------------------------
void index_storage::end_element(const element& e)
{
if(str_cmp(e.name(), e.name_len(), keyword_dir) == 0)
{
if(m_path.size()) m_path.pop_back();
}
else
if(str_cmp(e.name(), e.name_len(), keyword_file) == 0)
{
m_file_name.erase();
m_file_ext.erase();
}
}
示例6: s
//------------------------------------------------------------------
void table_structurizer::start_element(const element& e)
{
if(m_skip_element) return;
// if(m_cfg.keyword_exists(keyword_formatless_elements, e.name(), e.name_len()))
if(m_cfg.is_solid_element(e.name(), e.name_len()))
{
element_serializer s(m_result, e);
m_skip_element = &e;
return;
}
if(str_cmp(e.name(), e.name_len(), keyword_ssv_table) == 0)
{
process_ssv_table(e);
m_skip_element = &e;
}
else
if(str_cmp(e.name(), e.name_len(), keyword_vbar_table) == 0)
{
process_vbar_table(e);
m_skip_element = &e;
}
else
if(str_cmp(e.name(), e.name_len(), keyword_eln_table) == 0)
{
process_eln_table(e);
m_skip_element = &e;
}
else
{
m_result.add_element_header(e);
}
}
示例7: func
/**
* @brief Given the merit function associated with the rezone data, this function is in the correct form for gsl to parse
*
* @param i_rezone_data A pointer to the rezone data
* @return The merit value that the merit function has returned, summed over all elements
*/
static double func (void *i_rezone_data) {
element *element_ptr = ((rezone_data *) i_rezone_data)->element_ptr;
mpi::messenger *messenger_ptr = element_ptr->messenger_ptr;
double value = ((rezone_data *)i_rezone_data)->merit_func (element_ptr, element_ptr->make_rezoned_virtual_file (((rezone_data *)i_rezone_data)->positions, &*(element_ptr->rezone_virtual_file), profile_only));
messenger_ptr->sum (&value);
return value;
}
示例8: get_state
element_state get_state(void)
{
assert(lock_ != nullptr);
return utils::spinlock_exec([this](void) -> element_state {
return element_->get_state();
}, *lock_);
}
示例9: update
inline
void update(element& elem)
{
boost::optional<HWND> wnd = elem.window();
if (wnd) {
::UpdateWindow(*wnd);
return;
}
boost::optional<element&> pa = elem.parent();
if (!pa) {
BOOST_ASSERT(false); // todo
return;
}
hamburger::update(*pa);
}
示例10: end_element
//------------------------------------------------------------------
void structure_processor::end_element(const element& e)
{
const string_type* p;
if(e.name_len())
{
m_result.add_element_footer(e);
p = m_cfg.find(e.name(), e.name_len(), keyword_close_suffix);
m_result.add(p);
m_result.add(close_brace);
}
else
{
p = m_cfg.find(keyword_page_close.name);
m_result.add(p);
}
}
示例11:
//------------------------------------------------------------------
index_storage::index_storage(const element& e)
{
e.process(*this);
unsigned i;
for(i = 0; i < m_data.size(); ++i)
{
m_key_anchor.insert(&m_data[i]);
m_key_category.insert(&m_data[i]);
}
}
示例12: start_element
//------------------------------------------------------------------
void structure_processor::start_element(const element& e)
{
const string_type* p;
if(e.name_len())
{
m_result.add_element_header(e);
p = m_cfg.find(e.name(), e.name_len(), keyword_open_suffix);
m_result.add(p);
m_result.add(backslash);
m_result.add(keyword_cntn.name, keyword_cntn.len);
m_result.add(open_brace);
}
else
{
p = m_cfg.find(keyword_page_open.name);
m_result.add(p);
}
}
示例13: str_cmp
//------------------------------------------------------------------
void code_colorer::start_element(const element& e)
{
if(e.name_len())
{
if(m_coloring_element == 0)
{
if(m_cfg.keyword_exists(keyword_code, e.name(), e.name_len()) ||
str_cmp(e.name(), e.name_len(), keyword_code) == 0 ||
str_cmp(e.name(), e.name_len(), keyword_m) == 0)
{
m_coloring_element = &e;
color_code(e);
}
else
{
m_result.add_element_header(e);
}
}
}
}
示例14: process_table_header
//------------------------------------------------------------------
void table_structurizer::process_table_header(const element& e)
{
m_result.add(backslash);
m_result.add(keyword_table.name, keyword_table.len);
if(e.attr_len())
{
m_result.add(open_bracket);
m_result.add(e.attr(), e.attr_len());
m_result.add(close_bracket);
}
m_result.add(open_brace);
m_result.add(lf);
if(m_header.length())
{
m_result.add(backslash);
m_result.add(keyword_trh.name, keyword_trh.len);
m_result.add(open_brace);
parse_double_vbar(m_header.text(), m_header.length(), &keyword_th);
m_result.add(close_brace);
}
}
示例15: element_serializer
//------------------------------------------------------------------
void table_content_extractor::start_element(const element& e)
{
if(m_skip_element) return;
if(str_cmp(e.name(), e.name_len(), keyword_th) == 0)
{
element_serializer(m_header, e, false);
m_skip_element = &e;
}
else
if(str_cmp(e.name(), e.name_len(), keyword_al) == 0)
{
content_storage st;
element_serializer(st, e, false);
const char_type* str = st.text();
while(*str)
{
char_type c = *str++;
if(c == open_angle ||
c == close_angle ||
c == vbar ||
c == minus)
{
m_align.push_back(c);
}
}
m_skip_element = &e;
}
else
{
if(m_level)
{
m_table.add_element_header(e);
}
++m_level;
}
}