本文整理汇总了C++中processLine函数的典型用法代码示例。如果您正苦于以下问题:C++ processLine函数的具体用法?C++ processLine怎么用?C++ processLine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了processLine函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: input
//-----------------------------------------------------------------------------------------------
// Reads the input file, generates a pressure drop calculator
//-----------------------------------------------------------------------------------------------
PressureDropCalculator* PipeReader::readFile(const QString &file_name)
{
PressureDropCalculator *calc = 0;
// opening the input file
QFile input(file_name);
// checking if file opened ok...
if(!input.open(QIODevice::ReadOnly | QIODevice::Text))
{
qWarning("Could not open PIPE input file: %s", file_name.toLatin1().constData());
exit(1);
}
// starting to read the file, finding what type of calculator to produce
QStringList list = processLine(input.readLine());
while(!input.atEnd() && !list.at(0).startsWith("EOF"))
{
if(list.at(0).startsWith("CORRELATION"))
{
if(list.at(1).startsWith("BB73")) calc = readBeggsBrill(input); // this is a beggs and brill correlation
else if(list.at(1).startsWith("TABLE")) calc = readDpTable(input); // this is a table correlation
}
else if(!isEmpty(list))
{
cout << endl << "### Error detected in PIPE definition file! ###" << endl
<< "File: " << file_name.toLatin1().constData() << endl
<< "Keyword: " << list.join(" ").toLatin1().constData() << endl
<< "Not understood in current context." << endl << endl;
exit(1);
}
list = processLine(input.readLine());
}
// everything ok, closing input file
input.close();
return calc;
}
开发者ID:iocenter,项目名称:ResOpt,代码行数:56,代码来源:pipereader.cpp
示例2: generate
void generate( options *o)
{
FILE *fileHandle = fopen( o->file, "r" );
char line[ 256 ];
if( !fileHandle )
{
perror( "Error opening the source file" );
}
else
{
assert( fileHandle );
while( fgets( line, 256, fileHandle ) )
{
count( line );
}
rewind( fileHandle );
OBJModel.vertices = calloc( OBJModel.numOfObjVertex , sizeof( vertex ) );
assert( OBJModel.vertices );
if( OBJModel.numOfObjNormal > 0 )
{
OBJModel.normals = calloc( OBJModel.numOfObjNormal , sizeof( normal ) );
assert( OBJModel.normals );
}
if( OBJModel.numOfObjNormal > 0 )
{
OBJModel.textures = calloc( OBJModel.numOfObjTex , sizeof( texture ) );
assert( OBJModel.textures );
}
OBJModel.faces = calloc( OBJModel.numOfObjFaces , sizeof( face ) );
OBJModel.indexLength = OBJModel.numOfObjFaces * 3;
OBJModel.indices = calloc( OBJModel.indexLength, sizeof( Index ) );
assert( OBJModel.faces );
assert( OBJModel.indices );
while( fgets( line, 256, fileHandle ) )
{
processLine( line );
}
generateFile( o->outputFile );
if( o->verbose )
{
printf( "Total Vertices: %i\n", OBJModel.numOfObjVertex );
printf( "Total Normals: %i\n", OBJModel.numOfObjNormal );
printf( "Total Textures: %i\n", OBJModel.numOfObjTex );
printf( "Total Index: %i\n", OBJModel.indexCount );
}
fclose( fileHandle );
}
}
开发者ID:dauryg,项目名称:Objexporter,代码行数:60,代码来源:objexporter.c
示例3: readBaseFileStatus
void readBaseFileStatus(char* filename) {
FILE* file;
char line[MAXPATHLEN];
if (!(file = fopen(filename, "r"))) {
// Let's try to create the .file_status in the baseline system
fprintf(stderr, "CreateFileStatus (.file_status is missing)\n");
sprintf(line, "CreateFileStatus -d %s", dirs.working);
if (execute(line)) {
exit(-1);
}
if (!(file = fopen(filename, "r"))) {
fprintf(stderr, "Couldn't open %s and CreateFileStatus failed.\n",
filename);
exit(-1);
}
}
// The first line of the file is a comment so skip it.
if (fgets(line_buf, line_buf_size, file) == NULL) {
fprintf(stderr, "Couldn't read the first line of %s\n", filename);
exit(-1);
}
while (fgets(line_buf, line_buf_size, file) != NULL) {
processLine(line_buf);
}
if (fclose(file)) {
fprintf(stderr, "Couldn't close %s\n", filename);
exit(-1);
}
}
开发者ID:AdamSpitz,项目名称:self,代码行数:32,代码来源:UpdateFiles.cpp
示例4: handleHeader
/*
* handleHeader - scan through and process header information
*/
static void handleHeader( int *start, SAREA *line )
{
int cur;
cur = 0;
if( strnicmp( helpInBuf, ":h", 2 ) == 0 ) {
for( ;; ) {
if( !mygetline() )
break;
if( strnicmp( helpInBuf, ":t", 2 ) == 0 )
break;
if( strnicmp( helpInBuf, ":eh", 3 ) == 0 )
break;
processLine( helpInBuf, helpOutBuf, cur, false );
putline( helpOutBuf, cur );
cur ++;
}
line->row = cur;
uivfill( &helpScreen, *line, AT( ATTR_NORMAL ), UiGChar[UI_SBOX_HORIZ_LINE] );
cur++;
topPos = HelpTell( helpFileHdl );
if( strnicmp( helpInBuf, ":eh", 3 ) == 0 ) {
mygetline();
}
}
*start = cur;
}
开发者ID:bhanug,项目名称:open-watcom-v2,代码行数:30,代码来源:help.c
示例5: handleFooter
/*
* handleFooter - scan through and process footer information
*/
static void handleFooter( int *startline, SAREA *use, SAREA *line )
{
int start;
start = *startline;
if( strnicmp( helpInBuf, ":t", 2 ) == 0 ) {
++start; /* leave room for line */
for( ;; ) {
if( !mygetline() )
break;
if( strnicmp( helpInBuf, ":et", 3 ) == 0 )
break;
processLine( helpInBuf, helpOutBuf, start, false );
putline( helpOutBuf, start );
++start;
}
vscroll_fields( &helpTab, *use, start - use->row - use->height );
vvscroll( &helpScreen, *use, start - use->row - use->height );
use->height -= start - use->row;
line->row = use->row + use->height;
uivfill( &helpScreen, *line, AT( ATTR_NORMAL ), UiGChar[UI_SBOX_HORIZ_LINE] );
topPos = HelpTell( helpFileHdl );
}
*startline = start;
}
开发者ID:bhanug,项目名称:open-watcom-v2,代码行数:28,代码来源:help.c
示例6: processLine
void KateBuildView::slotReadReadyStdErr()
{
// FIXME This works for utf8 but not for all charsets
QString l= QString::fromUtf8(m_proc->readAllStandardError());
l.remove(QLatin1Char('\r'));
m_output_lines += l;
QString tmp;
int end=0;
do {
end = m_output_lines.indexOf(QLatin1Char('\n'));
if (end < 0) break;
end++;
tmp = m_output_lines.mid(0, end);
tmp.remove(QLatin1Char('\n'));
m_buildUi.plainTextEdit->appendPlainText(tmp);
processLine(tmp);
m_output_lines.remove(0,end);
} while (1);
}
开发者ID:cmacq2,项目名称:kate,代码行数:26,代码来源:plugin_katebuild.cpp
示例7: y
void CIniFile::ReadFile()
{
// Normally you would use ifstream, but the SGI CC compiler has
// a few bugs with ifstream. So ... fstream used.
fstream f;
string line;
Vector<string> iniLines;
string x = path;
string y(x.begin(), x.end());
y.assign(x.begin(), x.end());
f.open(y.c_str(), ios::in);
if(!f.fail()) // This is true if the file cannot be opened or something... in which case we don't want to read the file!
{
while(getline(f, line))
if(line.length() > 2) // Anything shorter can't be useful...
iniLines.push_back(line);
f.close();
}
lineCount = iniLines.size(); // Set our INI vector length
// Process our INI lines, will provide sensible defaults for any missing or malformed entries
for(S32 i = 0; i < lineCount; i++)
processLine(iniLines[i]);
}
开发者ID:AnsonX10,项目名称:bitfighter,代码行数:28,代码来源:IniFile.cpp
示例8: while
void LR_IPC_IN::run()
{
while (!threadShouldExit())
{
char line[256] = { '\0' };
int sizeRead = 0;
bool canReadLine = true;
// parse input until we have a line, then process that line
while (!String(line).endsWithChar('\n') && !threadShouldExit())
{
auto waitStatus = waitUntilReady(true, 0);
if (waitStatus < 0)
{
canReadLine = false;
break;
}
else if (waitStatus == 0)
{
wait(100);
continue;
}
sizeRead += read(line + sizeRead, 1, false);
}
if (canReadLine)
{
String param(line);
processLine(param);
}
}
}
开发者ID:Jewest,项目名称:MIDI2LR,代码行数:32,代码来源:LR_IPC_In.cpp
示例9: processFile
void processFile(char *fname, int searchincl)
{
FILE *fp;
char *pathname;
if (verbose)
printf("Processing file:%s\r\n", fname);
pathname = (char *)NULL;
fp = fopen(fname, "r");
if (!fp) {
if (searchincl) {
searchenv(fname, "INCLUDE", &pathname);
if (strlen(pathname)) {
fp = fopen(pathname, "r");
if (fp) goto j1;
}
}
printf("Can't open file <%s>\r\n", fname);
goto j2;
}
j1:
while (!feof(fp)) {
fgets(buf, sizeof(buf)/sizeof(char), fp);
processLine(buf);
}
fclose(fp);
j2:
if (pathname)
free(pathname);
}
开发者ID:NoSuchProcess,项目名称:Cores,代码行数:30,代码来源:main.c
示例10: processLine
/*
* scans a char* buffer for lines that does not
* start with the specified comment character.
*/
bool AnyOption::consumeFile (char *buffer) {
if (buffer == NULL)
return false;
char *cursor = buffer; /* preserve the ptr */
char *pline = NULL;
int linelength = 0;
bool newline = true;
for (unsigned int i = 0; i < strlen (buffer); i++) {
if (*cursor == endofline) { /* end of line */
if (pline != NULL) /* valid line */
processLine (pline, linelength);
pline = NULL;
newline = true;
} else if (newline) { /* start of line */
newline = false;
if ((*cursor != comment)) { /* not a comment */
pline = cursor;
linelength = 0;
}
}
cursor++; /* keep moving */
linelength++;
}
free (buffer);
return true;
}
开发者ID:eendebakpt,项目名称:oapackage,代码行数:32,代码来源:anyoption.cpp
示例11: QFile
GaussianFchk::GaussianFchk(const QString &filename, BasisSet* basis)
{
// Open the file for reading and process it
QFile* file = new QFile(filename);
QtIOCompressor* compressedFile = 0;
if (filename.endsWith(".gz")) {
compressedFile = new QtIOCompressor(file);
compressedFile->setStreamFormat(QtIOCompressor::GzipFormat);
compressedFile->open(QIODevice::ReadOnly);
m_in = compressedFile;
}
else {
file->open(QIODevice::ReadOnly | QIODevice::Text);
m_in = file;
}
qDebug() << "File" << filename << "opened.";
// Process the formatted checkpoint and extract all the information we need
while (!m_in->atEnd()) {
processLine();
}
// Now it should all be loaded load it into the basis set
load(basis);
if (compressedFile)
delete compressedFile;
else
delete file;
}
开发者ID:ChrisWilliams,项目名称:avogadro,代码行数:32,代码来源:gaussianfchk.cpp
示例12: at_send_command_to_data_channel
int at_send_command_to_data_channel(const char *command, ATResponse **pp_outResponse, RILChannelCtx *p_channel) {
const char* line = NULL;
int ret = writeline(command, p_channel);
if (ret == 0) {
p_channel->p_response = at_response_new();
do {
line = readline(p_channel);
if (line != NULL)
RLOGI("readline: %s", line);
else
RLOGI("readline: EMPTY");
} while (line != NULL && !(strcmp(line, "OK") == 0 || strcmp(line, "NO CARRIER") == 0 || strStartsWith(line, "CONNECT") == 1 || strstr(line, "ERROR")));
if (line != NULL) {
RLOGI("process line: %s", line);
processLine(line, p_channel);
if (pp_outResponse == NULL) {
at_response_free(p_channel->p_response);
} else {
reverseIntermediates(p_channel->p_response);
*pp_outResponse = p_channel->p_response;
}
return 0;
}
}
return AT_ERROR_GENERIC;
}
开发者ID:WayWingsDev,项目名称:mediatek,代码行数:27,代码来源:atchannels.c
示例13: file
/**
* Scan and process a configuration file, and store the retrieved
* configuration values into the PortageSettings object.
*
* @param settings The PortageSettings object that will be filled
* with configuration values.
* @param filename Path of the configuration file.
*
* @return PortageLoaderBase::NoError if the file has successfully been handled.
* PortageLoaderBase::OpenFileError if there was an error opening the file.
* PortageLoaderBase::NullObjectError if the given settings object is NULL.
*/
PortageLoaderBase::Error FileMakeConfigLoader::loadFile(
PortageSettings* settings, const QString& filename )
{
// Check on a NULL settings object, which would be bad
if( settings == NULL )
return NullObjectError;
else
this->settings = settings;
// Open the file for reading
QFile file( filename );
if( !file.open( IO_ReadOnly ) ) {
return OpenFileError;
}
QString line;
QTextStream stream( &file );
// Process each line
while ( !stream.atEnd() )
{
line = stream.readLine();
if( line.isEmpty() == true )
continue;
processLine( line );
}
return NoError;
}
开发者ID:BackupTheBerlios,项目名称:pakoo-svn,代码行数:44,代码来源:filemakeconfigloader.cpp
示例14: processPacket
/*
* Processes a packet of data that supposedly contains an HTTP request
* This function looks for CR/LF (or just LF) and calls processLine
* with each line of data found.
*/
boolean processPacket(char* data, int len) {
// Address after the last byte of data
char* end = data + len;
// Start of current line
char* start = data;
// Scan through the bytes in the packet looking for a Line Feed character
while (data < end) {
if (*data == LF) {
// Determine the length of the line excluding the Line Feed
int lineLength = data - start;
if (*(data - 1) == CR) {
lineLength--;
}
*(start + lineLength) = 0;
// Process the line
if (processLine(start, lineLength)) {
return true;
}
// Set up for the start of the next line
start = ++data;
} else {
// Go to the next byte
data++;
}
}
return false;
}
开发者ID:hmeyer,项目名称:RadioClock,代码行数:36,代码来源:WiServer.cpp
示例15: lastSurf
ConfigHandler::ConfigHandler()
: lastSurf(0)
{
//check to see whether config file exists
QDir home = QDir().home();
QFile configFile;
QDir::setCurrent(home.path());
configFile.setFileName(".cangjie");
if(configFile.exists())
{
//read it
configFile.open(QIODevice::ReadOnly | QIODevice::Text);
QTextStream config(&configFile);
QString line(config.readLine());
while(!line.isNull())
{
processLine(line);
line = config.readLine();
}
}
else
{
//make it
configFile.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream config(&configFile);
config << "lastSurf=0\n";
configFile.close();
}
}
开发者ID:cangjie-info,项目名称:viewer,代码行数:29,代码来源:config_handler.cpp
示例16: GetSourceChar
char GetSourceChar() {
char c;
char * result;
if (colno == 0) {
lineno++;
result = fgets(line, MAXLINE + 1, source);
processLine(line);
if (result == NULL) {
return EOF;
}
if (listing != stdout) {
fprintf(listing, "%-3d: %s", lineno, line);
}
}
c = line[colno++];
if (c == '\n') {
colno = 0;
newLine = true;
}
return c;
}
开发者ID:lisanhu2015,项目名称:CS542,代码行数:25,代码来源:IOMngr.c
示例17: fopen
bool BasicOECakeReader::processFile(char * fileName)
{
FILE * fp = fopen(fileName, "rb");
if (fp == NULL)
{
char newFileName[512];
sprintf(newFileName,"../../%s",fileName);
fp = fopen(newFileName, "rb");
if (fp == NULL)
{
sprintf(newFileName,"../../../%s",fileName);
fp = fopen(newFileName, "rb");
if (fp == NULL)
{
printf("ERROR: file(%s) not found", fileName);
return false;
}
}
}
int size;
if (fseek(fp, 0, SEEK_END) || (size = ftell(fp)) == EOF || fseek(fp, 0, SEEK_SET))
{
printf("ERROR: problem reading file(%s)", fileName);
fclose(fp);
return false;
}
else
{
rewind (fp);
char * buffer = (char *) malloc(size+1);
memset(buffer,0,size);
if (fread(buffer,1,size,fp) != size)
{
printf("Error reading file %s!\n",fileName);
fclose(fp);
return false;
}
int totalBytesRead = 0;
while(totalBytesRead<size)
{
int remainingSize = size-totalBytesRead;
// if (remainingSize<1229)
// {
// printf("..");
// }
totalBytesRead +=processLine(&buffer[totalBytesRead],remainingSize);
}
}
convertParticleGroup();
fclose(fp);
return false;
}
开发者ID:svn2github,项目名称:bullet,代码行数:60,代码来源:oecakeLoader.cpp
示例18: doFileInput
/*
* doFileInput()
*
* Get lines from a file (be that a file on disk or stdin) and pass the lines
* to processLine() for calculation.
*/
int doFileInput(FILE *fptr, int quiet, displayMode dm, char siPrefix, int precision)
{
char *line;
int rc = errNoError;
if(!fptr) return errBadInput;
line = calloc(1024, sizeof(char));
if(!line){
fprintf(stderr, _("Error: Out of memory\n"));
return errMemory;
}
fgets(line, 1024, fptr);
while(!feof(fptr)){
if(line[strlen(line)-1] == 10 || line[strlen(line)-1] == 13){
line[strlen(line)-1] = '\0';
}
/* Quit if "q" (or "quit" etc.) is an input */
if(line[0] == 'q' || line[0] == 'Q'){
rc = errNoError;
break;
}
rc = processLine(line, quiet, dm, siPrefix, precision);
if(rc != errNoError){
break;
}
fgets(line, 1024, fptr);
}
free(line);
return rc;
}
开发者ID:ralight,项目名称:ralcalc,代码行数:38,代码来源:ralcalc.c
示例19: processOneBar
Local void processOneBar(struct LOC_musicParagraph *LINK)
{
paragraph_index0 m, cm;
voice_index voice, cvoice;
boolean ignore_voice;
boolean wrote_repeat = false;
boolean alone;
Char STR2[256];
Char STR3[256];
if (bar_of_line > 1) {
sprintf(STR3, "%cBar %s", comment, toString(STR2, bar_no));
putLine(STR3);
}
last_bar = (bar_of_line == nbars && final_paragraph);
if (last_bar && !strcmp(repeat_sign, "|"))
*repeat_sign = '\0';
writeRepeat(repeat_sign);
*LINK->new_meter = '\0';
for (voice = nvoices; voice >= 1; voice--) {
if (musicLineNo(voice) > 0) {
gotoBar(voice, bar_of_line);
getMeterChange(voice, LINK->new_meter);
}
}
if (last_bar && *LINK->new_meter == '\0' && nleft > pickup && meternum > 0)
meterChange(LINK->new_meter, nleft, 64, true);
if (*LINK->new_meter != '\0')
putLine(LINK->new_meter);
for (voice = nvoices; voice >= 1; voice--) {
ignore_voice = !selected[voice-1];
cvoice = companion(voice);
m = musicLineNo(voice);
cm = musicLineNo(cvoice);
alone = (voice == cvoice || m > 0 && cm == 0 ||
m == 0 && cm == 0 && voice < cvoice || !selected[cvoice-1]);
if (selected[voice-1]) {
if (m > 0)
processLine(voice, bar_of_line);
else if (alone)
supplyRests(voice);
else
ignore_voice = true;
if (last_bar && *repeat_sign != '\0' && !wrote_repeat) {
writeRepeat(repeat_sign);
wrote_repeat = true;
}
if (!ignore_voice) {
if (alone || voicePos(voice) == 1)
putLine(" /");
else
putLine(" //");
}
}
}
bar_no++;
pickup = 0;
putLine("");
}
开发者ID:MiKTeX,项目名称:miktex,代码行数:59,代码来源:prepmx.c
示例20: while
DataList EFPFragment::parse(QTextStream& textStream)
{
while (!textStream.atEnd() && !m_done) {
processLine(textStream);
}
return m_dataList;
}
开发者ID:Tyf0n,项目名称:IQmol,代码行数:8,代码来源:EFPFragmentParser.C
注:本文中的processLine函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论