@@ -900,7 +900,7 @@ void DocRef::parse()
900900
901901// ---------------------------------------------------------------------------
902902
903- DocCite::DocCite (DocParser *parser,DocNodeVariant *parent,const QCString &target,const QCString &,int opt) : DocNode(parser,parent)
903+ DocCite::DocCite (DocParser *parser,DocNodeVariant *parent,const QCString &target,const QCString &,CiteInfoOption opt) : DocNode(parser,parent)
904904{
905905 size_t numBibFiles = Config_getList (CITE_BIB_FILES).size ();
906906 // printf("DocCite::DocCite(target=%s)\n",qPrint(target));
@@ -939,20 +939,20 @@ DocCite::DocCite(DocParser *parser,DocNodeVariant *parent,const QCString &target
939939QCString DocCite::getText () const
940940{
941941 QCString txt;
942- int opt = m_option;
942+ auto opt = m_option;
943943 const CitationManager &ct = CitationManager::instance ();
944944 const CiteInfo *citeInfo = ct.find (m_target);
945945
946- if (!( opt & CiteInfo::NOPAR_BIT )) txt += " [" ;
946+ if (!opt. noPar ( )) txt += " [" ;
947947
948948 if (citeInfo)
949949 {
950- if (opt & CiteInfo::NUMBER) txt += citeInfo->text ();
951- else if (opt & CiteInfo::SHORTAUTHOR) txt += citeInfo->shortAuthor ();
952- else if (opt & CiteInfo::YEAR) txt += citeInfo->year ();
950+ if (opt. isNumber ()) txt += citeInfo->text ();
951+ else if (opt. isShortAuthor ()) txt += citeInfo->shortAuthor ();
952+ else if (opt. isYear ()) txt += citeInfo->year ();
953953 }
954954
955- if (!( opt & CiteInfo::NOPAR_BIT )) txt += " ]" ;
955+ if (!opt. noPar ( )) txt += " ]" ;
956956 return txt;
957957}
958958
@@ -3329,9 +3329,7 @@ void DocPara::handleCite(char cmdChar,const QCString &cmdName)
33293329 // get the argument of the cite command.
33303330 Token tok=parser ()->tokenizer .lex ();
33313331
3332- int option = CiteInfo::UNKNOWN;
3333- bool nopar_bit = false ;
3334- bool nocite_bit = false ;
3332+ CiteInfoOption option;
33353333 if (tok.is (TokenRetval::TK_WORD) && parser ()->context .token ->name ==" {" )
33363334 {
33373335 parser ()->tokenizer .setStateOptions ();
@@ -3341,48 +3339,52 @@ void DocPara::handleCite(char cmdChar,const QCString &cmdName)
33413339 {
33423340 if (opt == " number" )
33433341 {
3344- if (option != CiteInfo::UNKNOWN )
3342+ if (!option. isUnknown () )
33453343 {
33463344 warn (parser ()->context .fileName ,parser ()->tokenizer .getLineNr ()," Multiple options specified with \\ {}, discarding '{}'" , saveCmdName, opt);
33473345 }
33483346 else
33493347 {
3350- option = CiteInfo::NUMBER ;
3348+ option = CiteInfoOption::makeNumber () ;
33513349 }
33523350 }
33533351 else if (opt == " year" )
33543352 {
3355- if (option != CiteInfo::UNKNOWN )
3353+ if (!option. isUnknown () )
33563354 {
33573355 warn (parser ()->context .fileName ,parser ()->tokenizer .getLineNr ()," Multiple options specified with \\ {}, discarding '{}'" , saveCmdName, opt);
33583356 }
33593357 else
33603358 {
3361- option = CiteInfo::YEAR ;
3359+ option = CiteInfoOption::makeYear () ;
33623360 }
33633361 }
33643362 else if (opt == " shortauthor" )
33653363 {
3366- if (option != CiteInfo::UNKNOWN )
3364+ if (!option. isUnknown () )
33673365 {
33683366 warn (parser ()->context .fileName ,parser ()->tokenizer .getLineNr ()," Multiple options specified with \\ {}, discarding '{}'" , saveCmdName, opt);
33693367 }
33703368 else
33713369 {
3372- option = CiteInfo::SHORTAUTHOR ;
3370+ option = CiteInfoOption::makeShortAuthor () ;
33733371 }
33743372 }
3375- else if (opt == " nopar" ) nopar_bit = true ;
3376- else if (opt == " nocite" ) nocite_bit = true ;
3373+ else if (opt == " nopar" )
3374+ {
3375+ option.setNoPar ();
3376+ }
3377+ else if (opt == " nocite" )
3378+ {
3379+ option.setNoCite ();
3380+ }
33773381 else
33783382 {
33793383 warn (parser ()->context .fileName ,parser ()->tokenizer .getLineNr ()," Unkown option specified with \\ {}, discarding '{}'" , saveCmdName, opt);
33803384 }
33813385 }
33823386
3383- if (option == CiteInfo::UNKNOWN) option = CiteInfo::NUMBER;
3384- if (nopar_bit) option |= CiteInfo::NOPAR_BIT;
3385- if (nocite_bit) option |= CiteInfo::NOCITE_BIT;
3387+ if (option.isUnknown ()) option = CiteInfoOption::makeNumber ();
33863388
33873389 parser ()->tokenizer .setStatePara ();
33883390 tok=parser ()->tokenizer .lex ();
@@ -3401,7 +3403,7 @@ void DocPara::handleCite(char cmdChar,const QCString &cmdName)
34013403 }
34023404 else
34033405 {
3404- option = CiteInfo::NUMBER ;
3406+ option = CiteInfoOption::makeNumber () ;
34053407 }
34063408
34073409 parser ()->tokenizer .setStateCite ();
0 commit comments