/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// How is the alternate used enumclass AlternateParseModes {
Parallel, // Alternate is always run, if A succedes it is used, otherwise B // is used
Failover, // Alternate is only run on failure of the primary to parse
Never, // Alternate is never run; this is effectively a kill switch
};
private: // Finds the mapping between a pref string and pref value, if none exists the // default is used template <class T> staticauto Pref(const std::string& aPrefName, const std::unordered_map<std::string, T>& aMap) -> T {
MOZ_ASSERT(aMap.find(DEFAULT) != aMap.end());
nsCString value; if (NS_FAILED(Preferences::GetCString(aPrefName.c_str(), value))) { return aMap.at(DEFAULT);
} constauto found = aMap.find(value.get()); if (found != aMap.end()) { return found->second;
} return aMap.at(DEFAULT);
} // The value of the parser pref staticauto Parser() -> Parsers;
// The value of the alternate parse mode pref staticauto AlternateParseMode() -> AlternateParseModes;
public: // Do non-fatal parsing errors count as failure staticauto StrictSuccess() -> bool; // Functions to create the primary, secondary and failover parsers.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.