本文整理汇总了C++中LocalPointer::getKeyBytes方法的典型用法代码示例。如果您正苦于以下问题:C++ LocalPointer::getKeyBytes方法的具体用法?C++ LocalPointer::getKeyBytes怎么用?C++ LocalPointer::getKeyBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalPointer
的用法示例。
在下文中一共展示了LocalPointer::getKeyBytes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fprintf
//.........这里部分代码省略.........
/* test for NULL */
if(openFileName == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
goto finish;
}
uprv_strcpy(openFileName, inputDir);
}
}
uprv_strcat(openFileName, filename);
ucbuf = ucbuf_open(openFileName, &cp,getShowWarning(),TRUE, &status);
if(status == U_FILE_ACCESS_ERROR) {
fprintf(stderr, "couldn't open file %s\n", openFileName == NULL ? filename : openFileName);
goto finish;
}
if (ucbuf == NULL || U_FAILURE(status)) {
fprintf(stderr, "An error occured processing file %s. Error: %s\n",
openFileName == NULL ? filename : openFileName, u_errorName(status));
goto finish;
}
/* auto detected popular encodings? */
if (cp!=NULL && isVerbose()) {
printf("autodetected encoding %s\n", cp);
}
/* Parse the data into an SRBRoot */
data.adoptInstead(parse(ucbuf, inputDir, outputDir, filename,
!omitBinaryCollation, options[NO_COLLATION_RULES].doesOccur, &status));
if (data.isNull() || U_FAILURE(status)) {
fprintf(stderr, "couldn't parse the file %s. Error:%s\n", filename, u_errorName(status));
goto finish;
}
if(options[WRITE_POOL_BUNDLE].doesOccur) {
data->fWritePoolBundle = newPoolBundle;
data->compactKeys(status);
int32_t newKeysLength;
const char *newKeys = data->getKeyBytes(&newKeysLength);
newPoolBundle->addKeyBytes(newKeys, newKeysLength, status);
if(U_FAILURE(status)) {
fprintf(stderr, "bundle_compactKeys(%s) or bundle_getKeyBytes() failed: %s\n",
filename, u_errorName(status));
goto finish;
}
/* count the number of just-added key strings */
for(const char *newKeysLimit = newKeys + newKeysLength; newKeys < newKeysLimit; ++newKeys) {
if(*newKeys == 0) {
++newPoolBundle->fKeysCount;
}
}
}
if(options[USE_POOL_BUNDLE].doesOccur) {
data->fUsePoolBundle = &poolBundle;
}
/* Determine the target rb filename */
rbname = make_res_filename(filename, outputDir, packageName, status);
if(U_FAILURE(status)) {
fprintf(stderr, "couldn't make the res fileName for bundle %s. Error:%s\n",
filename, u_errorName(status));
goto finish;
}
if(write_java== TRUE){
bundle_write_java(data.getAlias(), outputDir, outputEnc,
outputFileName, sizeof(outputFileName),
options[JAVA_PACKAGE].value, options[BUNDLE_NAME].value, &status);
}else if(write_xliff ==TRUE){
bundle_write_xml(data.getAlias(), outputDir, outputEnc,
filename, outputFileName, sizeof(outputFileName),
language, xliffOutputFileName, &status);
}else{
/* Write the data to the file */
data->write(outputDir, packageName, outputFileName, sizeof(outputFileName), status);
}
if (U_FAILURE(status)) {
fprintf(stderr, "couldn't write bundle %s. Error:%s\n", outputFileName, u_errorName(status));
}
finish:
if (inputDirBuf != NULL) {
uprv_free(inputDirBuf);
}
if (openFileName != NULL) {
uprv_free(openFileName);
}
if(ucbuf) {
ucbuf_close(ucbuf);
}
if (rbname) {
uprv_free(rbname);
}
}