当前位置: 首页>>代码示例>>C++>>正文


C++ AString::PathPart方法代码示例

本文整理汇总了C++中AString::PathPart方法的典型用法代码示例。如果您正苦于以下问题:C++ AString::PathPart方法的具体用法?C++ AString::PathPart怎么用?C++ AString::PathPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AString的用法示例。


在下文中一共展示了AString::PathPart方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetFileInfo

bool GetFileInfo(const AString& FileName, FILE_INFO *file)
{
	struct dirent ent;

	strcpy(ent.d_name, FileName.FilePart());

	return SetFileData(FileName.PathPart(), ent, file);
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例2: CreateDirectory

bool CreateDirectory(const AString& dir)
{
	AString parentdir = dir.PathPart();
	FILE_INFO file;
	bool success = true;

	if (parentdir.Valid() && (parentdir != "/") && !::GetFileInfo(parentdir, &file)) success = CreateDirectory(parentdir);

	if (success && (dir.FilePart().Valid()) && !::GetFileInfo(dir, &file)) {
#ifdef __LINUX__
		success = (mkdir(dir, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH) == 0);
#else
		success = ::CreateDirectoryA(dir.str(), NULL);
#endif
	}

	return success;
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例3: ListUsers

void ADVBConfig::ListUsers(AList& list) const
{
	AHash 	 users(10);
	AList 	 userpatterns;
	AString  filepattern 	   = GetUserPatternsPattern();
	AString  filepattern_parsed = ParseRegex(filepattern);
	AString  _users             = GetConfigItem("users");
	AStdFile fp;
	uint_t   i, n = _users.CountColumns();

	//debug("Reading users from config %s\n", config.GetFilename().str());

	for (i = 0; i < n; i++) {
		AString user = _users.Column(i).Words(0);

		if (!users.Exists(user)) {
			users.Insert(user, 0);
			list.Add(new AString(user));
		}
	}

	if (fp.open(GetPatternsFile())) {
		AString line;

		while (line.ReadLn(fp) >= 0) {
			AString user;
			int p;

			if		((p = line.PosNoCase(" user:=")) >= 0) user = line.Mid(p + 7).Word(0).DeQuotify();
			else if (line.PosNoCase("user:=") == 0)        user = line.Mid(6).Word(0).DeQuotify();

			if (user.Valid() && !users.Exists(user)) {
				users.Insert(user, 0);
				list.Add(new AString(user));
			}
		}

		fp.close();
	}

	::CollectFiles(filepattern.PathPart(), filepattern.FilePart(), 0, userpatterns);

	const AString *file = AString::Cast(userpatterns.First());
	while (file) {
		AString   user;
		ADataList regions;

		if (MatchRegex(*file, filepattern_parsed, regions)) {
			const REGEXREGION *region = (const REGEXREGION *)regions[0];

			if (region) {
				user = file->Mid(region->pos, region->len);
				if (!users.Exists(user)) {
					users.Insert(user, 0);
					list.Add(new AString(user));
				}
			}
		}

		file = file->Next();
	}

	list.Sort(&AString::AlphaCompareCase);
}
开发者ID:,项目名称:,代码行数:64,代码来源:

示例4: ProcessImage


//.........这里部分代码省略.........
            }
        }

        double avg2 = 0.0, sd2 = 0.0;
        uint_t mx, my, cx = (matwid - 1) >> 1, cy = (mathgt - 1) >> 1;
        for (x = 0; x < w; x++) {
            for (y = 0; y < h; y++) {
                float val = 0.f;

                if (matwid && mathgt) {
                    for (my = 0; my < mathgt; my++) {
                        if (((y + my) >= cy) && ((y + my) < (h + cy))) {
                            for (mx = 0; mx < matwid; mx++) {
                                if (((x + mx) >= cx) && ((x + mx) < (h + cx))) {
                                    val += matrix[mx + my * matwid] * ptr[(x + mx - cx) + (y + my - cy) * w];
                                }
                            }
                        }
                    }

                    val *= matmul;
                }
                else val = ptr[x + y * w];

                ptr[w * h + x + y * w] = (float)val;
                avg2 += val;
                sd2  += val * val;
            }
        }

        avg2 /= (double)len;
        sd2   = sqrt(sd2 / (double)len - avg2 * avg2);

        Interpolate(diffavg, avg2, coeff);
        Interpolate(diffsd,  sd2,  coeff);

        stats.Set(AString("avg%").Arg(index), AString("%0.16e").Arg(diffavg));
        stats.Set(AString("sd%").Arg(index),  AString("%0.16e").Arg(diffsd));

        double diff = avgfactor * diffavg + sdfactor * diffsd, total = 0.0;
        for (x = 0; x < len; x++) {
            ptr[x] = MAX(ptr[w * h + x] - diff, 0.0);
            total += ptr[x];
        }

        total = total * 1000.0 / ((double)w * (double)h);

        if (verbose) {
            log.printf("%s[%u]: Level = %0.1lf (diff = %0.6lf)\n",
                       datestr.str(), index, total, diff);
        }

        stats.Set(AString("level%").Arg(index), AString("%0.4").Arg(total));

        if (total >= threshold) {
            static const TAG tags[] = {
                {AImage::TAG_JPEG_QUALITY, 95},
                {TAG_DONE, 0},
            };

            if (detimgdir.Valid()) {
                AImage img;
                if (img.Create(rect.w, rect.h)) {
                    const AImage::PIXEL *pixel1 = image1.GetPixelData();
                    const AImage::PIXEL *pixel2 = image2.GetPixelData();
                    AImage::PIXEL       *pixel  = img.GetPixelData();

                    for (x = 0; x < len; x++, pixel++, pixel1++, pixel2++) {
                        pixel->r = (uint8_t)LIMIT((double)MAX(pixel1->r, pixel2->r) * ptr[x] / 255.0, 0.0, 255.0);
                        pixel->g = (uint8_t)LIMIT((double)MAX(pixel1->g, pixel2->g) * ptr[x] / 255.0, 0.0, 255.0);
                        pixel->b = (uint8_t)LIMIT((double)MAX(pixel1->b, pixel2->b) * ptr[x] / 255.0, 0.0, 255.0);
                    }

                    AString filename = detimgdir.CatPath(dt.DateFormat(detimgfmt) + ".jpg");
                    CreateDirectory(filename.PathPart());
                    img.SaveJPEG(filename, tags);
                }
            }

            AString filename = imagedir.CatPath(dt.DateFormat(imagefmt) + ".jpg");
            CreateDirectory(filename.PathPart());
            log.printf("%s[%u]: Saving detection image in '%s'\n", datestr.str(), index, filename.str());
            image2.SaveJPEG(filename, tags);

            if (detcmd.Valid()) {
                AString cmd = detcmd.SearchAndReplace("{level}", AString("%0.4").Arg(total));
                if (system(cmd) != 0) {
                    log.printf("%s[%u]: Detection command '%s' failed\n", datestr.str(), index, cmd.str());
                }
            }
        }
        else if (nodetcmd.Valid()) {
            AString cmd = nodetcmd.SearchAndReplace("{level}", AString("%0.4").Arg(total));
            if (system(cmd) != 0) {
                log.printf("%s[%u]: No-detection command '%s' failed\n", datestr.str(), index, cmd.str());
            }
        }
    }
    //else debug("Images are different sizes or identical\n");
}
开发者ID:richardxday,项目名称:rdutils,代码行数:101,代码来源:MotionDetector.cpp

示例5: Recurse

bool Recurse(const AString& PathPattern, uint_t nSubDirs, bool (*fn)(const FILE_INFO *file, void *Context), void *Context)
{
	return ::Recurse(PathPattern.PathPart(), PathPattern.FilePart(), nSubDirs, fn, Context);
}
开发者ID:,项目名称:,代码行数:4,代码来源:


注:本文中的AString::PathPart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。