本文整理汇总了C++中columns函数的典型用法代码示例。如果您正苦于以下问题:C++ columns函数的具体用法?C++ columns怎么用?C++ columns使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了columns函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dst_ostr
XMLRowOutputStream::XMLRowOutputStream(WriteBuffer & ostr_, const Block & sample_)
: dst_ostr(ostr_)
{
NamesAndTypesList columns(sample_.getColumnsList());
fields.assign(columns.begin(), columns.end());
field_tag_names.resize(sample_.columns());
bool have_non_numeric_columns = false;
for (size_t i = 0; i < sample_.columns(); ++i)
{
if (!sample_.unsafeGetByPosition(i).type->isNumeric())
have_non_numeric_columns = true;
/// В качестве имён элементов будем использовать имя столбца, если оно имеет допустимый вид, или "field", иначе.
/// Условие, приведённое ниже, более строгое, чем того требует стандарт XML.
bool is_column_name_suitable = true;
const char * begin = fields[i].name.data();
const char * end = begin + fields[i].name.size();
for (const char * pos = begin; pos != end; ++pos)
{
char c = *pos;
if (!( (c >= 'a' && c <= 'z')
|| (c >= 'A' && c <= 'Z')
|| (pos != begin && c >= '0' && c <= '9')
|| c == '_'
|| c == '-'
|| c == '.'))
{
is_column_name_suitable = false;
break;
}
}
field_tag_names[i] = is_column_name_suitable
? fields[i].name
: "field";
}
if (have_non_numeric_columns)
{
validating_ostr.reset(new WriteBufferValidUTF8(dst_ostr));
ostr = validating_ostr.get();
}
else
ostr = &dst_ostr;
}
开发者ID:Aahart911,项目名称:ClickHouse,代码行数:46,代码来源:XMLRowOutputStream.cpp
示例2: QPoint
QList<QPoint> PrimMaze::neighbors(const QPoint& cell)
{
QList<QPoint> n;
if (cell.x() > 0) {
n.append(cell + QPoint(-1, 0));
}
if (cell.y() > 0) {
n.append(cell + QPoint(0, -1));
}
if (cell.y() < rows() - 1) {
n.append(cell + QPoint(0, 1));
}
if (cell.x() < columns() - 1) {
n.append(cell + QPoint(1, 0));
}
return n;
}
开发者ID:Artox,项目名称:qtmoko,代码行数:17,代码来源:maze.cpp
示例3: columns
rePTerrainRenderable::rePTerrainRenderable()
{
node = 0;
columns(256);
rows(256);
size(reVec2(2, 2));
textures[3] = new reTexture();
textures[3]->fileName("/materials/textures/tiles/arctic/Snow0095_2_S.jpg");
textures[1] = new reTexture();
textures[1]->fileName("materials/textures/tiles/arctic/Snow0041_5_S.jpg");
textures[2] = new reTexture();
textures[2]->fileName("materials/textures/tiles/arctic/Snow0041_5_S.jpg");
textures[0] = new reTexture();
textures[0]->fileName("materials/textures/tiles/arctic/Snow0041_5_S.jpg");
mesh = new reMesh;
load();
}
开发者ID:ZhaoJie1987,项目名称:Radial-Engine,代码行数:17,代码来源:rePTerrain.cpp
示例4: columns
ProgressResult TimerRecordDialog::PreActionDelay(int iActionIndex, TimerRecordCompletedActions eCompletedActions)
{
wxString sAction = m_pTimerAfterCompleteChoiceCtrl->GetString(iActionIndex);
wxString sCountdownLabel;
sCountdownLabel.Printf("%s in:", sAction);
// Two column layout.
TimerProgressDialog::MessageTable columns(2);
auto &column1 = columns[0];
auto &column2 = columns[1];
column1.push_back(_("Timer Recording completed."));
column2.push_back( {} );
column1.push_back( {} );
column2.push_back( {} );
column1.push_back(_("Recording Saved:"));
column2.push_back(((eCompletedActions & TR_ACTION_SAVED) ? _("Yes") : _("No")));
column1.push_back(_("Recording Exported:"));
column2.push_back(((eCompletedActions & TR_ACTION_EXPORTED) ? _("Yes") : _("No")));
column1.push_back(_("Action after Timer Recording:"));
column2.push_back(sAction);
wxDateTime dtNow = wxDateTime::UNow();
wxTimeSpan tsWait = wxTimeSpan(0, 1, 0, 0);
wxDateTime dtActionTime = dtNow.Add(tsWait);
TimerProgressDialog dlgAction(tsWait.GetMilliseconds().GetValue(),
_("Audacity Timer Record - Waiting"),
columns,
pdlgHideStopButton | pdlgHideElapsedTime,
sCountdownLabel);
auto iUpdateResult = ProgressResult::Success;
bool bIsTime = false;
while (iUpdateResult == ProgressResult::Success && !bIsTime)
{
iUpdateResult = dlgAction.UpdateProgress();
wxMilliSleep(10);
bIsTime = (dtActionTime <= wxDateTime::UNow());
}
return iUpdateResult;
}
开发者ID:MindFy,项目名称:audacity,代码行数:46,代码来源:TimerRecordDialog.cpp
示例5: access
bool Matrix<Type>::equalWithTolerance(const Matrix& otherMatrix, const Type tolerance) const
{
if (size != otherMatrix.size) {
return false;
}
for (long int i = 0; i < rows(); i++) {
for (long int j = 0; j < columns(); j++) {
Type first = access(i, j), second = otherMatrix.access(i, j);
if (((first - second) > tolerance) || (second - first) > tolerance) {
return false;
}
}
}
return true;
}
开发者ID:chiku,项目名称:cmatrix,代码行数:17,代码来源:equality_with_tolerance.cpp
示例6: castRemoveNullable
ColumnPtr FunctionArrayIntersect::castRemoveNullable(const ColumnPtr & column, const DataTypePtr & data_type) const
{
if (auto column_nullable = checkAndGetColumn<ColumnNullable>(column.get()))
{
auto nullable_type = checkAndGetDataType<DataTypeNullable>(data_type.get());
const auto & nested = column_nullable->getNestedColumnPtr();
if (nullable_type)
{
auto casted_column = castRemoveNullable(nested, nullable_type->getNestedType());
return ColumnNullable::create(casted_column, column_nullable->getNullMapColumnPtr());
}
return castRemoveNullable(nested, data_type);
}
else if (auto column_array = checkAndGetColumn<ColumnArray>(column.get()))
{
auto array_type = checkAndGetDataType<DataTypeArray>(data_type.get());
if (!array_type)
throw Exception{"Cannot cast array column to column with type "
+ data_type->getName() + " in function " + getName(), ErrorCodes::LOGICAL_ERROR};
auto casted_column = castRemoveNullable(column_array->getDataPtr(), array_type->getNestedType());
return ColumnArray::create(casted_column, column_array->getOffsetsPtr());
}
else if (auto column_tuple = checkAndGetColumn<ColumnTuple>(column.get()))
{
auto tuple_type = checkAndGetDataType<DataTypeTuple>(data_type.get());
if (!tuple_type)
throw Exception{"Cannot cast tuple column to type "
+ data_type->getName() + " in function " + getName(), ErrorCodes::LOGICAL_ERROR};
auto columns_number = column_tuple->getColumns().size();
Columns columns(columns_number);
const auto & types = tuple_type->getElements();
for (auto i : ext::range(0, columns_number))
{
columns[i] = castRemoveNullable(column_tuple->getColumnPtr(i), types[i]);
}
return ColumnTuple::create(columns);
}
return column;
}
开发者ID:greck2908,项目名称:ClickHouse,代码行数:45,代码来源:arrayIntersect.cpp
示例7: columns
void ListView::resizeColums()
{
int c = columns();
if(c == 0)
{
return;
}
int w1 = viewport()->width();
int w2 = w1 / c;
int w3 = w1 - (c - 1) * w2;
for(int i = 0; i < c - 1; i++)
{
setColumnWidth(i, w2);
}
setColumnWidth(c - 1, w3);
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:18,代码来源:configuredialog_p.cpp
示例8: computeContrastCovariance
// get the covariance of a contrast given a contrast vector
// if this matrix is X, this function computes c' pinv(X'X) c
double RtDesignMatrix::computeContrastCovariance(
vnl_vector<double> &contrastVector) {
if (contrastVector.size() != columns()) {
cerr << "ERROR: number of elements in contrast vector does not match the "
<< "number of columns in the design matrix" << endl;
return std::numeric_limits<double>::quiet_NaN();
}
// compute the contrast covariance based on the currently known regressors
// NOTE: this will not be the same as computing it at the end of the
// experiment when all regressors are known. it would be nice to compute
// final values using the known design.
vnl_matrix<double> convec(contrastVector.data_block(),
contrastVector.size(), 1);
vnl_svd<double> pinv(transpose() * (*this));
vnl_matrix<double> result = convec.transpose() * pinv.pinverse() * convec;
return result.get(0, 0);
}
开发者ID:cccbauer,项目名称:murfi2,代码行数:20,代码来源:RtDesignMatrix.cpp
示例9: copy
/**
* Perform an LU decomposition. LAPACK routine DGBTRF is used.
* The factorization is saved in ludata.
*/
int BandMatrix::factor() {
int info=0;
copy(data.begin(), data.end(), ludata.begin());
ct_dgbtrf(rows(), columns(), nSubDiagonals(), nSuperDiagonals(),
DATA_PTR(ludata), ldim(), DATA_PTR(ipiv()), info);
// if info = 0, LU decomp succeeded.
if (info == 0) {
m_factored = true;
}
else {
m_factored = false;
ofstream fout("bandmatrix.csv");
fout << *this << endl;
fout.close();
}
return info;
}
开发者ID:anujg1991,项目名称:cantera,代码行数:22,代码来源:BandMatrix.cpp
示例10: rows
bool QGLPixmapConvolutionFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const
{
QGLPixmapConvolutionFilter *filter = const_cast<QGLPixmapConvolutionFilter *>(this);
m_srcSize = src.size();
int kernelSize = rows() * columns();
if (m_prevKernelSize == -1 || m_prevKernelSize != kernelSize) {
filter->setSource(generateConvolutionShader());
m_prevKernelSize = kernelSize;
}
filter->setOnPainter(painter);
painter->drawPixmap(pos, src, srcRect);
filter->removeFromPainter(painter);
return true;
}
开发者ID:Suneal,项目名称:qt,代码行数:18,代码来源:qglpixmapfilter.cpp
示例11: createRawTable
storage::atable_ptr_t createRawTable() {
metadata_vec_t columns({ *ColumnMetadata::metadataFromString("INTEGER", "col1"),
*ColumnMetadata::metadataFromString("STRING", "col2"),
*ColumnMetadata::metadataFromString("FLOAT", "col3") });
auto main = std::make_shared<RawTable<>>(columns);
storage::rawtable::RowHelper rh(columns);
unsigned char *data = nullptr;
for(size_t i=0; i<10; i++) {
rh.set<storage::hyrise_int_t>(0, i);
rh.set<storage::hyrise_string_t>(1, "SomeText" + std::to_string(i));
rh.set<storage::hyrise_float_t>(2, 1.1*i);
data = rh.build();
main->appendRow(data);
free(data);
}
return main;
}
开发者ID:InsZVA,项目名称:HyriseVisualizer,代码行数:19,代码来源:SimpleRawTableScanTests.cpp
示例12: printTitle
QString MultiModelPrinter::printGvars()
{
QString str = printTitle(tr("Global Variables"));
int gvars = firmware->getCapability(Gvars);
MultiColumns columns(models.size());
columns.append("<table border='0' cellspacing='0' cellpadding='1' width='100%'><tr>");
for (int i=0; i<gvars; i++) {
columns.append(QString("<td><b>") + tr("GV%1").arg(i+1) + "</b></td>");
}
columns.append("</tr><tr>");
for (int i=0; i<gvars; i++) {
columns.append("<td>");
COMPARE(model->flightModeData[0].gvars[i]);
columns.append("</td>");
}
columns.append("</tr>");
str.append(columns.print());
return str;
}
开发者ID:BenZoFly,项目名称:opentx,代码行数:19,代码来源:multimodelprinter.cpp
示例13: TEST_F
TEST_F(VirtualTableTests, test_tableplugin_options) {
auto table = std::make_shared<optionsTablePlugin>();
EXPECT_EQ(ColumnOptions::INDEX | ColumnOptions::REQUIRED,
std::get<2>(table->columns()[0]));
PluginResponse response;
PluginRequest request = {{"action", "columns"}};
EXPECT_TRUE(table->call(request, response).ok());
auto index_required =
static_cast<size_t>(ColumnOptions::INDEX | ColumnOptions::REQUIRED);
EXPECT_EQ(INTEGER(index_required), response[0]["op"]);
response = table->routeInfo();
EXPECT_EQ(INTEGER(index_required), response[0]["op"]);
std::string expected_statement =
"(`id` INTEGER PRIMARY KEY, `username` TEXT, `name` TEXT) WITHOUT ROWID";
EXPECT_EQ(expected_statement, columnDefinition(response, true));
}
开发者ID:defaultnamehere,项目名称:osquery,代码行数:19,代码来源:virtual_table_tests.cpp
示例14: sprand
sparse<double> sprand(size_t nrow, size_t ncol, double density)
{
assert(density <= 1 && density > 0);
size_t n = (size_t)(density * nrow * ncol);
dense_vector<size_t> rows(n);
dense_vector<size_t> columns(n);
dense_vector<double> values(n);
for (size_t i = 0; i < n; ++i)
{
rows[i] = (size_t)RANDI(0, nrow - 1);
columns[i] = (size_t)RANDI(0, ncol - 1);
values[i] = RAND();
}
return triplet<double>(rows, columns, values, nrow, ncol, n).to_sparse();
}
开发者ID:basp1,项目名称:spmat,代码行数:19,代码来源:util.cpp
示例15: columns
Block ODBCBlockInputStream::readImpl()
{
if (iterator == result.end())
return {};
MutableColumns columns(description.sample_block.columns());
for (const auto i : ext::range(0, columns.size()))
columns[i] = description.sample_block.getByPosition(i).column->cloneEmpty();
size_t num_rows = 0;
while (iterator != result.end())
{
Poco::Data::Row & row = *iterator;
for (const auto idx : ext::range(0, row.fieldCount()))
{
const Poco::Dynamic::Var & value = row[idx];
if (!value.isEmpty())
{
if (description.types[idx].second)
{
ColumnNullable & column_nullable = static_cast<ColumnNullable &>(*columns[idx]);
insertValue(column_nullable.getNestedColumn(), description.types[idx].first, value);
column_nullable.getNullMapData().emplace_back(0);
}
else
insertValue(*columns[idx], description.types[idx].first, value);
}
else
insertDefaultValue(*columns[idx], *description.sample_block.getByPosition(idx).column);
}
++iterator;
++num_rows;
if (num_rows == max_block_size)
break;
}
return description.sample_block.cloneWithColumns(std::move(columns));
}
开发者ID:chipitsine,项目名称:ClickHouse,代码行数:42,代码来源:ODBCBlockInputStream.cpp
示例16: character
int TextDisplay::_putc(int value) {
if(value == '\n') {
_column = 0;
_row++;
if(_row >= rows()) {
_row = 0;
}
} else {
character(_column, _row, value);
_column++;
if(_column >= columns()) {
_column = 0;
_row++;
if(_row >= rows()) {
_row = 0;
}
}
}
return value;
}
开发者ID:3eggert,项目名称:mbed,代码行数:20,代码来源:TextDisplay.cpp
示例17: columns
int GridLayoutItem::rows() const
{
int result = 0;
if( m_listController )
{
int count = m_listController->count();
int _columns = columns();
result = count / _columns;
if( (count % _columns) != 0 )
{
result++;
}
}
return result;
}
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:20,代码来源:GraphicsItems.cpp
示例18: gnc_tokenizer_factory
/** Sets the file format for the file to import, which
* may cause the file to be reloaded as well if the
* previously set file format was different and a
* filename was already set.
* @param format the new format to set
* @exception std::ifstream::failure if file reloading fails
*/
void GncTxImport::file_format(GncImpFileFormat format)
{
if (m_tokenizer && m_settings.m_file_format == format)
return;
auto new_encoding = std::string("UTF-8");
auto new_imp_file = std::string();
// Recover common settings from old tokenizer
if (m_tokenizer)
{
new_encoding = m_tokenizer->encoding();
new_imp_file = m_tokenizer->current_file();
if (file_format() == GncImpFileFormat::FIXED_WIDTH)
{
auto fwtok = dynamic_cast<GncFwTokenizer*>(m_tokenizer.get());
if (!fwtok->get_columns().empty())
m_settings.m_column_widths = fwtok->get_columns();
}
}
m_settings.m_file_format = format;
m_tokenizer = gnc_tokenizer_factory(m_settings.m_file_format);
// Set up new tokenizer with common settings
// recovered from old tokenizer
m_tokenizer->encoding(new_encoding);
load_file(new_imp_file);
// Restore potentially previously set separators or column_widths
if ((file_format() == GncImpFileFormat::CSV)
&& !m_settings.m_separators.empty())
separators (m_settings.m_separators);
else if ((file_format() == GncImpFileFormat::FIXED_WIDTH)
&& !m_settings.m_column_widths.empty())
{
auto fwtok = dynamic_cast<GncFwTokenizer*>(m_tokenizer.get());
fwtok->columns (m_settings.m_column_widths);
}
}
开发者ID:Gnucash,项目名称:gnucash,代码行数:48,代码来源:gnc-import-tx.cpp
示例19: show_sysfs
int show_sysfs(const char *seat, const char *prefix, unsigned n_columns) {
_cleanup_udev_unref_ struct udev *udev;
_cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
struct udev_list_entry *first = NULL;
int r;
if (n_columns <= 0)
n_columns = columns();
if (!prefix)
prefix = "";
if (isempty(seat))
seat = "seat0";
udev = udev_new();
if (!udev)
return -ENOMEM;
e = udev_enumerate_new(udev);
if (!e)
return -ENOMEM;
if (!streq(seat, "seat0"))
r = udev_enumerate_add_match_tag(e, seat);
else
r = udev_enumerate_add_match_tag(e, "seat");
if (r < 0)
return r;
r = udev_enumerate_scan_devices(e);
if (r < 0)
return r;
first = udev_enumerate_get_list_entry(e);
if (first)
show_sysfs_one(udev, seat, &first, "/", prefix, n_columns);
return r;
}
开发者ID:chuanchang,项目名称:systemd,代码行数:41,代码来源:sysfs-show.c
示例20: savePrefs
void SEQListView::savePrefs()
{
// only save the preferences if visible
if (isVisible())
{
int i;
int width;
QString columnName;
QString show = "Show";
// save the column width's/visibility
for (i = 0; i < columns(); i++)
{
columnName = columnPreferenceName(i);
width = columnWidth(i);
if (width != 0)
{
pSEQPrefs->setPrefInt(columnName + "Width", preferenceName(), width);
pSEQPrefs->setPrefBool(show + columnName, preferenceName(), true);
}
else
pSEQPrefs->setPrefBool(show + columnName, preferenceName(), false);
}
// save the column order
QString tempStr, tempStr2;
if (header()->count() > 0)
tempStr.sprintf("%d", header()->mapToSection(0));
for(i=1; i < header()->count(); i++)
{
tempStr2.sprintf(":%d", header()->mapToSection(i));
tempStr += tempStr2;
}
pSEQPrefs->setPrefString("ColumnOrder", preferenceName(), tempStr);
// save the current sorting state
pSEQPrefs->setPrefInt("SortColumn", preferenceName(), m_sortColumn);
pSEQPrefs->setPrefBool("SortIncreasing", preferenceName(),
m_sortIncreasing);
}
}
开发者ID:xbackupx,项目名称:showeqx,代码行数:41,代码来源:seqlistview.cpp
注:本文中的columns函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论