Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  SdpPref.h

  Sprache: C
 

/* 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/. */


#ifndef DOM_MEDIA_WEBRTC_SDP_SDPPREF_H_
#define DOM_MEDIA_WEBRTC_SDP_SDPPREF_H_

#include <string>
#include <unordered_map>

#include "mozilla/Maybe.h"
#include "mozilla/Preferences.h"

namespace mozilla {

class SdpParser;

// Interprets about:config SDP parsing preferences
class SdpPref {
 private:
  static constexpr const char PRIMARY_PREF[] =
      "media.peerconnection.sdp.parser";
  static constexpr const char ALTERNATE_PREF[] =
      "media.peerconnection.sdp.alternate_parse_mode";
  static constexpr const char STRICT_SUCCESS_PREF[] =
      "media.peerconnection.sdp.strict_success";
  static constexpr const char DEFAULT[] = "default";

 public:
  // Supported Parsers
  enum class Parsers {
    Sipcc,
    WebRtcSdp,
  };

  // How is the alternate used
  enum class AlternateParseModes {
    Parallel,  // Alternate is always run, if A succeeds 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>
  static auto 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);
    }
    const auto found = aMap.find(value.get());
    if (found != aMap.end()) {
      return found->second;
    }
    return aMap.at(DEFAULT);
  }
  // The value of the parser pref
  static auto Parser() -> Parsers;

  // The value of the alternate parse mode pref
  static auto AlternateParseMode() -> AlternateParseModes;

 public:
  // Do non-fatal parsing errors count as failure
  static auto StrictSuccess() -> bool;
  // Functions to create the primary, secondary and failover parsers.

  // Reads about:config to choose the primary Parser
  static auto Primary() -> UniquePtr<SdpParser>;
  static auto Secondary() -> Maybe<UniquePtr<SdpParser>>;
  static auto Failover() -> Maybe<UniquePtr<SdpParser>>;
};

}  // namespace mozilla

#endif

Messung V0.5 in Prozent
C=93 H=94 G=93

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002