本文整理汇总了C++中Column::GetLastMasterColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ Column::GetLastMasterColumn方法的具体用法?C++ Column::GetLastMasterColumn怎么用?C++ Column::GetLastMasterColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Column
的用法示例。
在下文中一共展示了Column::GetLastMasterColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AccumulateMasterColumns
void ColumnSet::AccumulateMasterColumns()
{
DCHECK(master_columns_.empty());
for(std::vector<Column*>::iterator i=columns_.begin();
i!=columns_.end(); ++i)
{
Column* column = *i;
Column* master_column = column->GetLastMasterColumn();
if(master_column && find(master_columns_.begin(),
master_columns_.end(), master_column)==master_columns_.end())
{
master_columns_.push_back(master_column);
}
// At this point, GetLastMasterColumn may not == master_column
// (may have to go through a few Columns)_. Reset master_column to
// avoid hops.
column->master_column_ = master_column;
}
}
示例2: CalculateMasterColumns
void ColumnSet::CalculateMasterColumns()
{
for(std::vector<Column*>::iterator i=columns_.begin();
i!=columns_.end(); ++i)
{
Column* column = *i;
int same_size_column_index = column->same_size_column_;
if(same_size_column_index != -1)
{
DCHECK(same_size_column_index>=0 &&
same_size_column_index<static_cast<int>(columns_.size()));
Column* master_column = column->master_column_;
Column* same_size_column = columns_[same_size_column_index];
Column* same_size_column_master = same_size_column->master_column_;
if(master_column == NULL)
{
// Current column is not linked to any other column.
if(same_size_column_master == NULL)
{
// Both columns are not linked.
column->master_column_ = column;
same_size_column->master_column_ = column;
column->same_size_columns_.push_back(same_size_column);
column->same_size_columns_.push_back(column);
}
else
{
// Column to link to is linked with other columns.
// Add current column to list of linked columns in other columns
// master column.
same_size_column->GetLastMasterColumn()->
same_size_columns_.push_back(column);
// And update the master column for the current column to that
// of the same sized column.
column->master_column_ = same_size_column;
}
}
else
{
// Current column is already linked with another column.
if(same_size_column_master == NULL)
{
// Column to link with is not linked to any other columns.
// Update it's master_column.
same_size_column->master_column_ = column;
// Add linked column to list of linked column.
column->GetLastMasterColumn()->same_size_columns_.
push_back(same_size_column);
}
else if(column->GetLastMasterColumn() !=
same_size_column->GetLastMasterColumn())
{
// The two columns are already linked with other columns.
std::vector<Column*>* same_size_columns =
&(column->GetLastMasterColumn()->same_size_columns_);
std::vector<Column*>* other_same_size_columns =
&(same_size_column->GetLastMasterColumn()->same_size_columns_);
// Add all the columns from the others master to current columns
// master.
same_size_columns->insert(same_size_columns->end(),
other_same_size_columns->begin(),
other_same_size_columns->end());
// The other master is no longer a master, clear its vector of
// linked columns, and reset its master_column.
other_same_size_columns->clear();
same_size_column->GetLastMasterColumn()->master_column_ = column;
}
}
}
}
AccumulateMasterColumns();
}