456 std::ifstream file(fileName);
461 bool exclusion =
false;
462 bool selection =
false;
465 bool exclEnd =
false;
467 bool inIoread =
false;
468 bool inClass =
false;
469 bool inMethod =
false;
470 bool inField =
false;
474 std::unique_ptr<ClassSelectionRule> csr;
475 std::unique_ptr<FunctionSelectionRule> fsr;
476 std::unique_ptr<VariableSelectionRule> vsr;
477 std::unique_ptr<EnumSelectionRule> esr;
482 bool tagOK =
GetNextTag(file, tagStr, lineNum);
484 const char* tagStrCharp = tagStr.c_str();
486 std::ostringstream buf;
488 std::string lineNumStr = buf.str();
489 const char* lineNumCharp = lineNumStr.c_str();
492 out.ClearSelectionRules();
496 if (!tagStr.empty()){
497 std::vector<Attributes> attrs;
503 out.ClearSelectionRules();
512 out.ClearSelectionRules();
520 out.ClearSelectionRules();
527 csr->SetRequestStreamerInfo(
true);
535 out.AddClassSelectionRule(*csr);
540 out.ClearSelectionRules();
549 out.ClearSelectionRules();
559 std::streampos initialPos(file.tellg());
560 const unsigned int lineCharsSize=1000;
561 char lineChars[lineCharsSize];
562 file.getline(lineChars,lineCharsSize);
563 std::string lineStr(lineChars);
565 while (lineStr ==
"" ||
566 std::count(lineStr.begin(),lineStr.end(),
' ') == (
int)lineStr.size()){
567 file.getline(lineChars,lineCharsSize);
571 size_t dataBeginPos = lineStr.find(
"<![CDATA[");
572 if (dataBeginPos==std::string::npos){
573 file.seekg(initialPos);
578 lineStr = lineStr.substr(dataBeginPos+9);
582 std::string codeAttrVal;
587 size_t dataEndPos = lineStr.find(
"]]>");
588 if (dataEndPos!=std::string::npos) {
590 codeAttrVal+=lineStr.substr(0,dataEndPos);
593 codeAttrVal+=lineStr;
595 file.getline(lineChars,lineCharsSize);
598 attrs.emplace_back(
"code", codeAttrVal);
606 out.ClearSelectionRules();
617 out.ClearSelectionRules();
631 out.ClearSelectionRules();
640 out.ClearSelectionRules();
650 out.ClearSelectionRules();
657 out.ClearSelectionRules();
668 out.ClearSelectionRules();
677 out.ClearSelectionRules();
686 ROOT::TMetaUtils::Error(
nullptr,
"At line %s. Tag %s not inside a <class> element\n", lineNumCharp,tagStrCharp);
687 out.ClearSelectionRules();
694 bsrChild = vsr.get();
701 out.ClearSelectionRules();
705 ROOT::TMetaUtils::Info(
nullptr,
"At line %s. A field is not supposed to have an end-tag (this message will become a warning).\n", lineNumCharp);
712 ROOT::TMetaUtils::Error(
nullptr,
"At line %s. Tag %s not inside a <class> element\n", lineNumCharp,tagStrCharp);
713 out.ClearSelectionRules();
720 bsrChild = fsr.get();
727 out.ClearSelectionRules();
731 ROOT::TMetaUtils::Info(
nullptr,
"At line %s. A method is not supposed to have an end-tag (this message will become a warning).\n", lineNumCharp);
738 ROOT::TMetaUtils::Error(
nullptr,
"At line %s. Tag %s not inside a <class> element\n", lineNumCharp,tagStrCharp);
739 out.ClearSelectionRules();
744 out.ClearSelectionRules();
755 out.ClearSelectionRules();
767 out.ClearSelectionRules();
779 out.ClearSelectionRules();
783 attrs.emplace_back(
"fromTypedef",
"true");
792 out.ClearSelectionRules();
806 out.ClearSelectionRules();
824 std::string iAttrName;
825 std::string iAttrValue;
831 std::map<std::string,std::string> pragmaArgs;
832 for (
int i = 0,
n = attrs.size();
i <
n; ++
i) {
833 pragmaArgs[attrs[
i].fName]=attrs[
i].fValue;
836 std::stringstream pragmaLineStream;
837 const std::string attrs[11] ={
"sourceClass",
849 for (
unsigned int i=0;
i<11;++
i) {
850 const std::string&
attr = attrs[
i];
851 if ( pragmaArgs.count(
attr) == 1){
854 pragmaLineStream <<
" " <<
attr <<
"=\""<<
value <<
"\"";
861 std::string error_string;
866 if (!error_string.empty())
874 if (!tagStr.empty() && tagKind !=
kVersion) {
896 else if (tagKind ==
kClass) {
926 std::string iAttrName;
927 std::string iAttrValue;
928 for (
int i = 0,
n = attrs.size();
i <
n; ++
i) {
929 iAttrName=attrs[
i].fName;
930 iAttrValue=attrs[
i].fValue;
933 if (tagKind ==
kClass && csr &&
"noStreamer" == iAttrName){
934 if (iAttrValue ==
"true") {
935 csr->SetRequestNoStreamer(
true);
936 }
else if (iAttrValue !=
"false") {
938 "XML at line %s: class attribute 'noStreamer' must be 'true' or 'false' (it was %s)\n",
939 lineNumCharp, iAttrValue.c_str());
944 if (tagKind ==
kClass && csr &&
"noInputOperator" == iAttrName){
945 if (iAttrValue ==
"true") {
946 csr->SetRequestNoInputOperator(
true);
947 }
else if (iAttrValue !=
"false") {
949 "XML at line %s: class attribute 'noInputOperator' must be 'true' or 'false' (it was %s)\n",
950 lineNumCharp, iAttrValue.c_str());
957 "ClassVersion" == iAttrName){
958 csr->SetRequestedVersionNumber(atoi(iAttrValue.c_str()));
969 std::string preExistingValue;
971 if (preExistingValue!=iAttrValue){
973 "Line %s: assigning new value %s to attribue %s (it was %s)\n",
974 lineNumCharp,iAttrValue.c_str(),iAttrName.c_str(),preExistingValue.c_str());
975 out.ClearSelectionRules();
980 if ((iAttrName ==
"file_name" || iAttrName ==
"file_pattern") && tagKind ==
kClass){
982 out.SetHasFileNameRule(
true);
987 std::string preExistingValue;
989 if (preExistingValue!=iAttrValue){
991 "Line %s: assigning new value %s to attribue %s (it was %s)\n",
992 lineNumCharp,iAttrValue.c_str(),iAttrName.c_str(),preExistingValue.c_str());
993 out.ClearSelectionRules();
1008 if (!inClass) out.AddClassSelectionRule(*csr);
1011 out.AddClassSelectionRule(*csr);
1014 out.AddFunctionSelectionRule(*fsr);
1017 out.AddVariableSelectionRule(*vsr);
1020 out.AddEnumSelectionRule(*esr);
1023 csr->AddFieldSelectionRule(*vsr);
1026 csr->AddMethodSelectionRule(*fsr);
1035 if (
sel && !selEnd) {
1037 out.ClearSelectionRules();
1040 if (excl && !exclEnd ) {
1043 out.ClearSelectionRules();