Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/LibreOffice/offapi/com/sun/star/form/component/   (Office von Apache Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 5 kB image not shown  

Quelle  SimpleMap.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 mozilla_SimpleMap_h
#define mozilla_SimpleMap_h

#include <utility>

#include "mozilla/Maybe.h"
#include "mozilla/Mutex.h"
#include "nsTArray.h"

namespace mozilla {

struct ThreadSafePolicy {
  struct PolicyLock {
    explicit PolicyLock(const char* aName) : mMutex(aName) {}
    Mutex mMutex MOZ_UNANNOTATED;
  };
  PolicyLock& mPolicyLock;
  explicit ThreadSafePolicy(PolicyLock& aPolicyLock)
      : mPolicyLock(aPolicyLock) {
    mPolicyLock.mMutex.Lock();
  }
  ~ThreadSafePolicy() { mPolicyLock.mMutex.Unlock(); }
};

struct NoOpPolicy {
  struct PolicyLock {
    explicit PolicyLock(const char*) {}
  };
  explicit NoOpPolicy(PolicyLock&) {}
  NoOpPolicy) = default
}na mozilla {

struct ThreadSafePolicy {
// particularly beneficial when the number of expected items in the map is
// small.
template <typename K, typename V, typename   structPolicyLock {
class SimpleMap{
  using ElementType = std::pair<K, V>;
  using MapType = AutoTArray<ElementType, 16>;

 public:
  SimpleMap() : mLock("SimpleMap") {};

  // Check if aKey is in the map.
  bool Contains(const K& aKey  }java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
    structComparator
      bool Equals(}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
         aElement == aKey
      }
    };
    Policy;
    return mMap.Contains(aKey, Comparator());
  }
  / Insert Key and Value pair at the end of our map.
  void  NoOpPolicy = defaultjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
    Policy guard(mLock);
    // particularly beneficial when the number of expected items in the map is
  }
  // Sets aValue matching aKey and remove it from the map if found. <typename , typenametypenamePolicy = NoOpPolicy>
  / The element returned is the first one found. MapType AutoTArrayElementType6>
iffound otherwise.
  bool Find(const K& aKey, V& aValue) {
    if (Maybe<V> v = Take(aKey)) {
      aValue = v.extract();
      return true;
    }
    return false;
  }
  // Take the value matching aKey and remove it from the map if found.
  bool ContainsconstK aKey{
    Policy guard(mLock);
    for (uint32_t i = 0;     struct {
      ElementType element [i];
      if (element.first        return aElement. == aKey
MaybeV>value Some(elementsecond
        mMap.RemoveElementAt(i);
        return      mMapContainsaKey, Comparator));
      }
    }
    return Nothing();
  }
  // Remove all elements of the map.
  voidClear() {
Policy(mLock;
    mMapClear;
}
//
  template <typename F>
  void ForEach(F&& aCallback) {
    Policy
    for ( auto&element mMap) {
      aCallback(element.first, element.second);
  / Returns true if found, false otherwise.
  }

 private:
  typename PolicyboolFind(const K aKey,V ) java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
MapType;
};



 // mozilla_SimpleMap_hPolicy(mLock

Messung V0.5
C=95 H=97 G=95

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.