本文整理汇总了C++中MyString::lower_case方法的典型用法代码示例。如果您正苦于以下问题:C++ MyString::lower_case方法的具体用法?C++ MyString::lower_case怎么用?C++ MyString::lower_case使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyString
的用法示例。
在下文中一共展示了MyString::lower_case方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PerformMapping
int
MapFile::GetCanonicalization(const MyString method,
const MyString principal,
MyString & canonicalization)
{
bool match_found = false;
for (int entry = 0;
!match_found && entry < canonical_entries.getlast() + 1;
entry++) {
// printf("comparing: %s == %s => %d\n",
// method.Value(),
// canonical_entries[entry].method.Value(),
// method == canonical_entries[entry].method);
MyString lowerMethod = method;
lowerMethod.lower_case();
if (lowerMethod == canonical_entries[entry].method) {
match_found = PerformMapping(canonical_entries[entry].regex,
principal,
canonical_entries[entry].canonicalization,
canonicalization);
if (match_found) break;
}
}
return match_found ? 0 : -1;
}
示例2: strchr
/** Parse the arguments line of an existing .condor.sub file, extracing
the arguments we want to preserve when updating the .condor.sub file.
@param subLine: the arguments line from the .condor.sub file
@param shallowOpts: the condor_submit_dag shallow options
@return 0 if successful, 1 if failed
*/
int
parseArgumentsLine( const MyString &subLine,
SubmitDagShallowOptions &shallowOpts )
{
const char *line = subLine.Value();
const char *start = strchr( line, '"' );
const char *end = strrchr( line, '"' );
MyString arguments;
if ( start && end ) {
arguments = subLine.Substr( start - line, end - line );
} else {
fprintf( stderr, "Missing quotes in arguments line: <%s>\n",
subLine.Value() );
return 1;
}
ArgList arglist;
MyString error;
if ( !arglist.AppendArgsV2Quoted( arguments.Value(),
&error ) ) {
fprintf( stderr, "Error parsing arguments: %s\n", error.Value() );
return 1;
}
for ( int argNum = 0; argNum < arglist.Count(); argNum++ ) {
MyString strArg = arglist.GetArg( argNum );
strArg.lower_case();
(void)parsePreservedArgs( strArg, argNum, arglist.Count(),
arglist.GetStringArray(), shallowOpts);
}
return 0;
}
示例3: if
//---------------------------------------------------------------------------
void
parseCommandLine(SubmitDagDeepOptions &deepOpts,
SubmitDagShallowOptions &shallowOpts, int argc,
const char * const argv[])
{
for (int iArg = 1; iArg < argc; iArg++)
{
MyString strArg = argv[iArg];
if (strArg[0] != '-')
{
// We assume an argument without a leading hyphen is
// a DAG file name.
shallowOpts.dagFiles.append(strArg.Value());
if ( shallowOpts.primaryDagFile == "" ) {
shallowOpts.primaryDagFile = strArg;
}
}
else if (shallowOpts.primaryDagFile != "")
{
// Disallow hyphen args after DAG file name(s).
printf("ERROR: no arguments allowed after DAG file name(s)\n");
printUsage();
}
else
{
strArg.lower_case();
// Note: in checking the argument names here, we only check for
// as much of the full name as we need to unambiguously define
// the argument.
if (strArg.find("-no_s") != -1) // -no_submit
{
shallowOpts.bSubmit = false;
}
else if (strArg.find("-vers") != -1) // -version
{
printf( "%s\n%s\n", CondorVersion(), CondorPlatform() );
exit( 0 );
}
else if (strArg.find("-help") != -1 || strArg.find("-h") != -1) // -help
{
printUsage(0);
}
// submit and stick to a specific schedd
else if (strArg.find("-schedd-daemon-ad-file") != -1)
{
if (iArg + 1 >= argc) {
fprintf(stderr, "-schedd-daemon-ad-file argument needs a value\n");
printUsage();
}
shallowOpts.strScheddDaemonAdFile = argv[++iArg];
}
// submit and stick to a specific schedd
else if (strArg.find("-schedd-address-file") != -1)
{
if (iArg + 1 >= argc) {
fprintf(stderr, "-schedd-address-file argument needs a value\n");
printUsage();
}
shallowOpts.strScheddAddressFile = argv[++iArg];
}
else if (strArg.find("-f") != -1) // -force
{
deepOpts.bForce = true;
}
else if (strArg.find("-not") != -1) // -notification
{
if (iArg + 1 >= argc) {
fprintf(stderr, "-notification argument needs a value\n");
printUsage();
}
deepOpts.strNotification = argv[++iArg];
}
else if (strArg.find("-r") != -1) // submit to remote schedd
{
if (iArg + 1 >= argc) {
fprintf(stderr, "-r argument needs a value\n");
printUsage();
}
shallowOpts.strRemoteSchedd = argv[++iArg];
}
else if (strArg.find("-dagman") != -1)
{
if (iArg + 1 >= argc) {
fprintf(stderr, "-dagman argument needs a value\n");
printUsage();
}
deepOpts.strDagmanPath = argv[++iArg];
}
else if (strArg.find("-de") != -1) // -debug
{
if (iArg + 1 >= argc) {
fprintf(stderr, "-debug argument needs a value\n");
printUsage();
}
shallowOpts.iDebugLevel = atoi(argv[++iArg]);
}
else if (strArg.find("-noev") != -1) // -noeventchecks
//.........这里部分代码省略.........
示例4: ParseField
int
MapFile::ParseCanonicalizationFile(const MyString filename)
{
int line = 0;
FILE *file = safe_fopen_wrapper_follow(filename.Value(), "r");
if (NULL == file) {
dprintf(D_ALWAYS,
"ERROR: Could not open canonicalization file '%s' (%s)\n",
filename.Value(),
strerror(errno));
return -1;
}
while (!feof(file)) {
MyString input_line;
int offset;
MyString method;
MyString principal;
MyString canonicalization;
line++;
input_line.readLine(file); // Result ignored, we already monitor EOF
if (input_line.IsEmpty()) {
continue;
}
offset = 0;
offset = ParseField(input_line, offset, method);
offset = ParseField(input_line, offset, principal);
offset = ParseField(input_line, offset, canonicalization);
method.lower_case();
if (method.IsEmpty() ||
principal.IsEmpty() ||
canonicalization.IsEmpty()) {
dprintf(D_ALWAYS, "ERROR: Error parsing line %d of %s. (Method=%s) (Principal=%s) (Canon=%s) Skipping to next line.\n",
line, filename.Value(), method.Value(), principal.Value(), canonicalization.Value());
continue;
}
dprintf(D_FULLDEBUG,
"MapFile: Canonicalization File: method='%s' principal='%s' canonicalization='%s'\n",
method.Value(),
principal.Value(),
canonicalization.Value());
/*
Regex *re = new Regex;
if (NULL == re) {
dprintf(D_ALWAYS, "ERROR: Failed to allocate Regex!\n");
}
*/
int last = canonical_entries.getlast() + 1;
canonical_entries[last].method = method;
canonical_entries[last].principal = principal;
canonical_entries[last].canonicalization = canonicalization;
}
fclose(file);
// Compile the entries and print error messages for the ones that don't compile.
// We don't do this in the loop above because canonical_entries[] allocates
// a whole new array when it needs to grow and we don't want to be copying
// compiled regex's when that happens. see #2409
for (int ix = 0; ix <= canonical_entries.getlast(); ++ix) {
const char *errptr;
int erroffset;
if (!canonical_entries[ix].regex.compile(canonical_entries[ix].principal,
&errptr,
&erroffset)) {
dprintf(D_ALWAYS, "ERROR: Error compiling expression '%s' -- %s. this entry will be ignored.\n",
canonical_entries[ix].principal.Value(),
errptr);
}
}
return 0;
}