Created
May 25, 2014 12:39
-
-
Save ryanjdew/381af8580143f4c58f6d to your computer and use it in GitHub Desktop.
C++ start MarkLogic UDF function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void BucketeerRegex:: | |
start(Sequence& arg, Reporter& reporter) | |
{ | |
overflow_bucket = "bucketeer:overflow"; | |
case_insensitive = false; | |
capture_overflow = false; | |
int reti; | |
int case_sensitive = 0; | |
int extended = 0; | |
arg.value(regex); | |
arg.next(); | |
while(!arg.done()) { | |
String arg_value; | |
arg.value(arg_value); | |
const char* val = arg_value.get(); | |
if (strcmp(val,"case-insensitive") == 0) { | |
case_sensitive = REG_ICASE; | |
case_insensitive = true; | |
} else if (strcmp(val,"extended") == 0) { | |
extended = REG_EXTENDED; | |
} else if (strcmp(val,"capture-overflow") == 0) { | |
capture_overflow = true; | |
} | |
arg.next(); | |
} | |
/* Compile regular expression */ | |
reti = regcomp(®ex_compiled, regex.get(), case_sensitive|extended); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment