本文整理汇总了C++中sd函数的典型用法代码示例。如果您正苦于以下问题:C++ sd函数的具体用法?C++ sd怎么用?C++ sd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sd函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sd
void indri::file::Path::remove( const std::string& path ) {
std::stack<indri::file::DirectoryIterator*> iterators;
indri::utility::StackDeleter<indri::file::DirectoryIterator> sd( iterators );
iterators.push( new indri::file::DirectoryIterator( path ) );
while( iterators.size() ) {
indri::file::DirectoryIterator* top = iterators.top();
// all done, so go up a level
if( (*top) == indri::file::DirectoryIterator::end() ) {
// release any search handles that may point
// to this directory
top->close();
int result = rmdir( top->base().c_str() );
if( result != 0 )
LEMUR_THROW( LEMUR_IO_ERROR, "indri::file::Path::remove couldn't remove directory '" + top->base() + "'." );
delete top;
iterators.pop();
continue;
}
std::string path = **top;
(*top)++;
if( indri::file::Path::isFile( path ) ) {
int result = lemur_compat::remove( path.c_str() );
if( result != 0 )
LEMUR_THROW( LEMUR_IO_ERROR, "indri::file::Path::remove couldn't remove file '" + path + "'." );
} else {
iterators.push( new indri::file::DirectoryIterator( path ) );
}
}
}
开发者ID:wangxuemin,项目名称:coding,代码行数:35,代码来源:Path.cpp
示例2: min_bucket
void STATS::short_print( //print stats table
FILE *, //Now uses tprintf instead
BOOL8 dump //dump full table
) {
inT32 index; //table index
inT32 min = min_bucket ();
inT32 max = max_bucket ();
if (buckets == NULL) {
/* err.log(RESULT_LOGICAL_ERROR,E_LOC,ERR_PRIMITIVES,
ERR_SCROLLING,ERR_CONTINUE,ERR_ERROR,
"Empty stats"); */
return;
}
if (dump) {
for (index = min; index <= max; index++) {
tprintf ("%4d:%-3d ", rangemin + index, buckets[index]);
if ((index - min) % 8 == 7)
tprintf ("\n");
}
tprintf ("\n");
}
tprintf ("Total count=%d\n", total_count);
tprintf ("Min=%d Really=%d\n", (inT32) (ile ((float) 0.0)), min);
tprintf ("Max=%d Really=%d\n", (inT32) (ile ((float) 1.1)), max);
tprintf ("Range=%d\n", max + 1 - min);
tprintf ("Lower quartile=%.2f\n", ile ((float) 0.25));
tprintf ("Median=%.2f\n", ile ((float) 0.5));
tprintf ("Upper quartile=%.2f\n", ile ((float) 0.75));
tprintf ("Mean= %.2f\n", mean ());
tprintf ("SD= %.2f\n", sd ());
}
开发者ID:coffeesam,项目名称:tesseract-ocr,代码行数:33,代码来源:statistc.cpp
示例3: sd
ServiceDescription ServiceDiscovery::getServiceDescription(const std::string& name)
{
bool found = false;
ServiceDescription sd("");
{
boost::unique_lock<boost::mutex> lock(mServicesMutex);
std::vector<ServiceDiscovery*>::iterator it;
for(it = msServiceDiscoveries.begin(); it != msServiceDiscoveries.end(); it++)
{
try {
ServiceConfiguration conf = (*it)->getConfiguration();
if(conf.getName() == name)
{
sd = conf;
found = true;
break;
}
} catch(...)
{
// ignore errors
}
}
}
if(!found)
{
char buffer[512];
snprintf(buffer, 512, "Could not find service: %s\n", name.c_str());
throw std::runtime_error(std::string(buffer));
}
return sd;
}
开发者ID:rock-core,项目名称:tools-service_discovery,代码行数:34,代码来源:ServiceDiscovery.cpp
示例4: sd
void ListaCursor::newCursor(int valor)
{
int temp = sd();
disponibles[temp] = disponibles[0];
bdd[disponibles[0]].numero = valor;
disponibles[0] = bdd[disponibles[0]].next;
bdd[disponibles[temp]].next = -1;
}
开发者ID:Segebre,项目名称:EstructuraDeDatos,代码行数:8,代码来源:listacursor.cpp
示例5: sd
void DisassemblerView::showSegments()
{
SegmentsDialog sd(this->_listing, this);
int res = sd.exec();
if(res == SegmentsDialog::Accepted && sd.selectedSegment())
ui->disassemblerWidget->jumpTo(sd.selectedSegment());
}
开发者ID:baiyunping333,项目名称:PREF,代码行数:8,代码来源:disassemblerview.cpp
示例6: TEST
TEST(JsonTest, LoadInvalidKey)
{
ScopedDevice sd(sample_invalid_key);
ASSERT_EQ(sd.device, nullptr);
ASSERT_EQ(sd.error.type, MB_DEVICE_JSON_UNKNOWN_KEY);
ASSERT_STREQ(sd.error.context, ".foo");
}
开发者ID:shakalaca,项目名称:DualBootPatcher,代码行数:8,代码来源:test_json.cpp
示例7: main
int main(int argc, char **argv)
{
QApplication app( argc, argv);
app.setFont( QFont( "helvetica", 18));
KDMShutdown sd( 0, 0,"Hej", "echo shutdown", "echo restart");
app.setMainWidget( &sd);
return sd.exec();
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:8,代码来源:kdmshutdown.cpp
示例8: ts
void Background::draw() {
ci::gl::clear(mSettings.mBackgroundColor);
if (mTexture) {
ci::gl::color(1, 1, 1, 1);
ci::gl::ScopedTextureBind ts(mTexture);
ci::gl::ScopedDepth sd(false);
mBatch->draw();
}
}
开发者ID:hackborn,项目名称:cellulite,代码行数:9,代码来源:background.cpp
示例9: assert
// o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o
void
BRTKernelDef::print(std::ostream& out, int) const
{
char name[1024];
if (Project::gDebug) {
out << "/* BRTKernelDef:" ;
location.printLocation(out) ;
out << " */" << std::endl;
}
assert(FunctionName());
assert(FunctionName()->entry);
assert(FunctionName()->entry->scope);
/* If the symbol for the generated assembly code already
** exists, don't generate the assembly. This allows the user
** to hand generate the code.
*/
#define PRINT_CODE(a,b) \
sprintf (name, "__%s_%s", FunctionName()->name.c_str(), #b); \
if (!FunctionName()->entry->scope->Lookup(name)) { \
if (globals.target & TARGET_##a) { \
BRTKernelCode *var; \
var = decl->isReduce() ? new BRT##a##ReduceCode(*this) : \
new BRT##a##KernelCode(*this); \
out << *var << std::endl; \
delete var; \
} else { \
out << "static const char *__" \
<< *FunctionName() << "_" << #b << "= NULL;\n"; \
} \
}
PRINT_CODE(PS20, ps20);
PRINT_CODE(FP30, fp30);
PRINT_CODE(ARB, arb);
PRINT_CODE(CPU, cpu);
#undef PRINT_CODE
/*
* XXX I have no idea why this is here instead of in
* BRTCPUKernel::print(). It's CPU only and needs to be suppressed when
* the CPU target is suppressed. --Jeremy.
* The scatter functions need to be there whether or not the CPU target is repressed
* For the fallback requirement --Daniel
*/
if (decl->isReduce()) {
BRTCPUReduceCode crc(*this);
BRTScatterDef sd(*crc.fDef);
sd.print(out,0);
// this is needed for CPU fallback for scatter whether or not CPU is enabled
}
printStub(out);
}
开发者ID:darwin,项目名称:inferno,代码行数:58,代码来源:brtstemnt.cpp
示例10: SaveStateDescriptor
SaveStateDescriptor AdlMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
Common::String fileName = Common::String::format("%s.s%02d", target, slot);
Common::InSaveFile *inFile = g_system->getSavefileManager()->openForLoading(fileName);
if (!inFile)
return SaveStateDescriptor();
if (inFile->readUint32BE() != MKTAG('A', 'D', 'L', ':')) {
delete inFile;
return SaveStateDescriptor();
}
byte saveVersion = inFile->readByte();
if (saveVersion != SAVEGAME_VERSION) {
delete inFile;
return SaveStateDescriptor();
}
char name[SAVEGAME_NAME_LEN] = { };
inFile->read(name, sizeof(name) - 1);
inFile->readByte();
if (inFile->eos() || inFile->err()) {
delete inFile;
return SaveStateDescriptor();
}
SaveStateDescriptor sd(slot, name);
int year = inFile->readUint16BE();
int month = inFile->readByte();
int day = inFile->readByte();
sd.setSaveDate(year + 1900, month + 1, day);
int hour = inFile->readByte();
int minutes = inFile->readByte();
sd.setSaveTime(hour, minutes);
uint32 playTime = inFile->readUint32BE();
sd.setPlayTime(playTime);
if (inFile->eos() || inFile->err()) {
delete inFile;
return SaveStateDescriptor();
}
Graphics::Surface *thumbnail;
if (!Graphics::loadThumbnail(*inFile, thumbnail)) {
delete inFile;
return SaveStateDescriptor();
}
sd.setThumbnail(thumbnail);
delete inFile;
return sd;
}
开发者ID:athrxx,项目名称:scummvm,代码行数:56,代码来源:detection.cpp
示例11: sd
QString SupportDialog::getHost( QWidget *parent )
{
SupportDialog sd( parent );
if( sd.exec() == Accepted )
{
return sd.ui->hostEdit->text();
}
return QString();
}
开发者ID:EmebedQtsoft,项目名称:italc2,代码行数:10,代码来源:Dialogs.cpp
示例12: sd
void MainApp::OnFatalException()
{
#ifndef __APPLE__
#ifndef _DEBUG
SLADEStackTrace st;
st.WalkFromException();
SLADECrashDialog sd(st);
sd.ShowModal();
#endif
#endif
}
开发者ID:STJrInuyasha,项目名称:SLADE,代码行数:11,代码来源:MainApp.cpp
示例13: if
str::seq LexicalAnnotation::lines(size_t i, size_t f) const {
if (!this->bfptr) {
return str::seq();
} else if (this->bfptr->first) {
std::ifstream fd(this->bfptr->second);
return slurpLines(fd, i, f);
} else {
std::istringstream sd(this->bfptr->second);
return slurpLines(sd, i, f);
}
}
开发者ID:lipei0330,项目名称:hobbes,代码行数:11,代码来源:lannotation.C
示例14: sd
integer_t ScalarDialog::getScalar(QWidget *parent, const QString &title, const QString &description)
{
ScalarDialog sd(parent);
sd.setWindowTitle(title);
sd.setDescription(description);
if(sd.exec() == ScalarDialog::Accepted)
return sd.value();
return UINT64_MAX;
}
开发者ID:PREF-Framework,项目名称:PREF,代码行数:11,代码来源:scalardialog.cpp
示例15: CreateServer
void CreateServer()
{
if (m_Peer == NULL)
Initialize();
RakNet::SocketDescriptor sd(SERVER_PORT, 0);
m_Peer->Startup(MAX_CLIENTS, &sd, 1);
m_IsServer = true;
m_Peer->SetMaximumIncomingConnections(MAX_CLIENTS);
}
开发者ID:karthiknarayan0512,项目名称:GraphicsEngine,代码行数:11,代码来源:Networking.cpp
示例16: getText
void RepoQuery::getStaticString(int iCol, StringData*& s) {
if (isNull(iCol)) {
s = nullptr;
} else {
const char* text;
size_t size;
getText(iCol, text, size);
StackStringData sd(text, size, AttachLiteral);
s = StringData::GetStaticString(&sd);
}
}
开发者ID:MarkTseng,项目名称:hiphop-php,代码行数:11,代码来源:repo_helpers.cpp
示例17: ParamPolicy
GaussianBartModel::GaussianBartModel(int number_of_trees,
const Vector &y,
const Matrix &x)
: ParamPolicy(new UnivParams(sd(y))),
BartModelBase(number_of_trees, mean(y))
{
for (int i = 0; i < y.size(); ++i) {
NEW(RegressionData, dp)(y[i], x.row(i));
add_data(dp);
}
}
开发者ID:Hkey1,项目名称:boom,代码行数:11,代码来源:GaussianBartModel.cpp
示例18: ASSERT
int ThreadSharedVariant::getIndex(litstr key) {
ASSERT(is(KindOfArray));
if (getIsVector()) return -1;
StringData sd(key);
if (RuntimeOption::ApcUseGnuMap) {
StringDataToIntMap::const_iterator it = m_data.gnuMap->strMap->find(&sd);
if (it == m_data.gnuMap->strMap->end()) return -1;
return it->second;
}
return m_data.map->indexOf(&sd);
}
开发者ID:ckwalsh,项目名称:hiphop-php,代码行数:11,代码来源:thread_shared_variant.cpp
示例19: sd_thread
void sd_thread(void const *argument) {
#if defined(TARGET_KL25Z)
SDFileSystem sd(PTD2, PTD3, PTD1, PTD0, "sd");
#else
SDFileSystem sd(p11, p12, p13, p14, "sd");
#endif
FILE *f = fopen("/sd/out.txt", "w");
// allocate buffers
uint8_t data_written[SIZE];
uint8_t data_read[SIZE];
// fill data_written buffer with random data
// write these data into the file
printf("written: [");
for (int i = 0; i < SIZE; i++) {
data_written[i] = rand() % 0xff;
fprintf(f, "%c", data_written[i]);
printf("%d ", data_written[i]);
}
printf("]\r\nclosing\r\n");
fclose(f);
// read back the data from the file and store them in data_read
f = fopen("/sd/out.txt", "r");
printf("read: [");
for (int i=0; i<SIZE; i++) {
data_read[i] = fgetc(f);
printf("%d ", data_read[i]);
}
printf("]\r\nclosing\r\n");
fclose(f);
// check that the data written == data read
for (int i = 0; i < SIZE; i++) {
if (data_written[i] != data_read[i]) {
notify_completion(false);
}
}
notify_completion(true);
}
开发者ID:barroque,项目名称:mbed,代码行数:41,代码来源:main.cpp
示例20: main
int main(){
int c, d, u, n;
n = recebe();
c = sc(n);
d = sd(n);
u = su(n);
print(c);
print(d);
print(u);
}
开发者ID:Linguagem-I,项目名称:Lista01,代码行数:12,代码来源:02.c
注:本文中的sd函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论