本文整理汇总了C++中AString::Line方法的典型用法代码示例。如果您正苦于以下问题:C++ AString::Line方法的具体用法?C++ AString::Line怎么用?C++ AString::Line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AString
的用法示例。
在下文中一共展示了AString::Line方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParsePatterns
uint_t ADVBPatterns::ParsePatterns(ADataList& patternlist, const AString& patterns, AString& errors, const AString& sep, const AString& user)
{
uint_t i, n = patterns.CountLines(sep);
for (i = 0; i < n; i++) {
ParsePattern(patternlist, patterns.Line(i, sep), errors, user);
}
return patternlist.Count();
}
示例2: GetErrorMessage
/*--------------------------------------------------------------------------------*/
AString PostgresDatabase::GetErrorMessage(PGconn *conn, bool full)
{
AString msg;
if (conn) {
msg = AString(PQerrorMessage(conn)).SearchAndReplace("\r", "").SearchAndReplace("\n\n", ", ");
if (msg.EndsWith(", ")) msg = msg.Left(msg.len() - 2);
if (!full) msg = msg.Line(0);
}
else msg = "No connection!";
return msg;
}
示例3: vlogit
void ADVBConfig::vlogit(const char *fmt, va_list ap, bool show) const
{
ADateTime dt;
AString filename = GetLogFile(dt.GetDays());
AString str;
AStdFile fp;
str.vprintf(fmt, ap);
if (fp.open(filename, "a")) {
uint_t i, n = str.CountLines("\n", 0);
for (i = 0; i < n; i++) {
fp.printf("%s [%05u]: %s\n", dt.DateFormat("%Y-%M-%D %h:%m:%s.%S").str(), (uint_t)getpid(), str.Line(i, "\n", 0).str());
}
fp.close();
}
if (show && !webresponse) {
Stdout->printf("%s\n", str.str());
}
}
示例4: Configure
void MotionDetector::Configure()
{
AString nstr = AString("%").Arg(index);
log.printf("%s[%u]: Reading new settings...\n", ADateTime().DateFormat("%Y-%M-%D %h:%m:%s.%S").str(), index);
stream.Close();
stream.SetUsernameAndPassword(GetSetting("username", "admin"),
GetSetting("password", "arsebark"));
AString camera = GetSetting("camera", "");
log.printf("%s[%u]: Connecting to %s...\n", ADateTime().DateFormat("%Y-%M-%D %h:%m:%s.%S").str(), index, camera.str());
if (!stream.OpenHost(camera)) {
log.printf("%s[%u]: Failed to connect to %s...\n", ADateTime().DateFormat("%Y-%M-%D %h:%m:%s.%S").str(), index, camera.str());
}
imagedir = GetSetting("imagedir", "/media/cctv");
imagefmt = GetSetting("filename", "%Y-%M-%D/%h/Image-{camera}-%Y-%M-%D-%h-%m-%s-%S");
detimgdir = GetSetting("detimagedir");
detimgfmt = GetSetting("detfilename", "%Y-%M-%D/%h/detection/Image-{camera}-%Y-%M-%D-%h-%m-%s-%S");
detcmd = GetSetting("detcommand", "");
nodetcmd = GetSetting("nodetcommand", "");
coeff = (double)GetSetting("coeff", "1.0e-3");
avgfactor = (double)GetSetting("avgfactor", "1.0");
sdfactor = (double)GetSetting("sdfactor", "2.0");
redscale = (double)GetSetting("rscale", "1.0");
grnscale = (double)GetSetting("gscale", "1.0");
bluscale = (double)GetSetting("bscale", "1.0");
threshold = (double)GetSetting("threshold", "3000.0");
verbose = (uint_t)GetSetting("verbose", "0");
matmul = 1.f;
matwid = mathgt = 0;
AString _matrix = GetSetting("matrix", "");
if (_matrix.Valid()) {
uint_t row, nrows = _matrix.CountLines(";");
uint_t col, ncols = 1;
int p;
if ((p = _matrix.Pos("*")) >= 0) {
AString mul = _matrix.Mid(p + 1);
_matrix = _matrix.Left(p);
if ((p = mul.Pos("/")) >= 0) {
matmul = (float)mul.Left(p) / (float)mul.Mid(p + 1);
}
else matmul = (float)mul;
}
else if ((p = _matrix.Pos("/")) >= 0) {
AString mul = _matrix.Mid(p + 1);
_matrix = _matrix.Left(p);
matmul = 1.f / (float)mul;
}
for (row = 0; row < nrows; row++) {
uint_t n = _matrix.Line(row, ";").CountLines(",");
ncols = MAX(ncols, n);
}
nrows |= 1;
ncols |= 1;
matrix.resize(nrows * ncols);
for (row = 0; row < nrows; row++) {
AString line = _matrix.Line(row,";");
for (col = 0; col < ncols; col++) matrix[col + row * ncols] = (float)line.Line(col, ",");
}
matwid = ncols;
mathgt = nrows;
#if 0
printf("Matrix is %u x %u:\n", matwid, mathgt);
for (row = 0; row < nrows; row++) {
for (col = 0; col < ncols; col++) printf("%8.3f", matrix[col + row * ncols]);
printf("\n");
}
printf("Multiplier %0.6f\n", matmul);
#endif
}
else matrix.resize(0);
}