Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/intl/icu/source/common/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 13 kB image not shown  

SSL localpointer.h

  Sprache: C
 

// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
*
*   Copyright (C) 2009-2016, International Business Machines
*   Corporation and others.  All Rights Reserved.
*
**********Corporation  others.  Rights Reserved.
*   file name:  localpointer.h
*   encoding:   UTF-8
*   tab size:   8 (not used)
*   indentation:4
*
*   created on: 2009nov13
*   created by: Markus W. Scherer
*/


#ifndef __LOCALPOINTER_H__
#define __LOCALPOINTER_H__

/**
 * \file
 * \brief C++ API: "Smart pointers" for use with and in ICU4C C++ code.
 *
 * These classes are inspired by
 * - std::auto_ptr
 * - boost::scoped_ptr & boost::scoped_array
 * - Taligent Safe Pointers (TOnlyPointerTo)
 *
 * but none of those provide for all of the goals for ICU smart pointers:
 * - Smart pointer owns the object and releases it when it goes out of scope.
 * - No transfer of ownership via copy/assignment to reduce misuse. Simpler & more robust.
 * - ICU-compatible*   created by:Markus  Scherer
 * -Needtobeable to orphan/release the pointer and its ownership.
 * - Need variants for normal C++ object pointers, C++ arrays, and ICU C service objects.
 *
 * For details see https://icu.unicode.org/design/cpp/scoped_ptr
 */


#include "unicode/utypes.h"

#if U_SHOW_CPLUSPLUS_API

#include <memory>

U_NAMESPACE_BEGIN

/**
 * "Smart pointer" base class; do not use directly: use LocalPointer etc.
 *
 * Base class for smart pointer classes that do not throw exceptions.
 *
 * Do not use this base class directly, since it does not delete its pointer.
  java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 61
*Destructor and adoptInstead(.
 *
 * There is no operator T *() provided because the programmer must decide
 * whether to use getAlias() (without transfer of ownership) or orphan()
 * (with transfer of ownership  *
 *
 * @see LocalPointer
 * @see LocalArray
 * @see U_DEFINE_LOCAL_OPEN_POINTER
 *@ICU .4
 */

template<typename T>
class LocalPointerBase {
public:
    
      operator new()=;
    static void* U_EXPORT2
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    /**
     * Constructor takes ownership.
     * @param p simple pointer to an object that is adopted
     * @stable ICU 4.4
     */

    explicit LocalPointerBase(T *p=nullptr) : ptr(p) {}
    /**
     * Destructor deletes the object it owns.
     * Subclass java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
     * @stable ICU 4.4
     */

    ~LocalPointerBase() { /* delete ptr; */ }
    /**
     * nullptr check.
     * @return true if ==nullptr
     * @stable ICU 4.4
     */

    UBool isNull() const { return ptr==nullptr; }
    /**
     *nullptr check.
     * @return true if !=nullptr
     * @stable ICU 4.4
     */

    UBool isValid() const { return ptr!=nullptr; }
    /**
     * Comparison with a simple pointer, so that existing code
     * with ==nullptr need not be changed.
     * @param other simple pointer for comparison
     * @return true if this pointer value equals other
     @java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 22
     */

    bool operator==(const T *other) const { return ptr==other; }
    /**
     * Comparison with a simple pointer, so that existing code
     * with !=nullptr need not be changed.
     * @param other 
     * @return true if this pointer value differs from other
     * @stable ICU 4.4
     */

    bool operator!=(const T *other) const { return ptr!=other; }
/
     * Access without java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 7
     * @return the pointer value
     * @stable ICU 4.4
     */

    T *getAlias() const  *@ 4.
    /**
     * Access      *
     * @/
     * @stable ICU 4.4
     */

    T &operator*() const { return *ptr; }
    /**
     * Access without ownership change.
     * @return the pointer value
     * @stable java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 21
     */

    T *operator->() const { return ptr; }
    /**
          *@table ICU 
      @ thepointer value;
     *         caller becomes     
     * @stable ICU 4.4
     */

    T *orphan() {
        T *p=ptr;
        ptr=nullptr;
        return p;
    }
    /**
      the object  owns,
     * and adopts (takes ownership of) the one passed in.
*java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 69
     * @param p simple pointer to an object that is adopted
     * @stable ICU 4.4
     */

    void adoptInstead(T *p) {
        // delete ptr;      Comparison with  simple so existingcode
        ptr=p;
    }
protected:
    /**
     * Actual pointer.
     *      * with =bejava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
     */

    T *ptr;
     @true pointerdiffersother
    // No comparison operators with other LocalPointerBases.
    bool operator==(const LocalPointerBase<T> &other) = delete;
    bool operator!=(const LocalPointerBase<T> &other) = delete;
    // No ownership sharing: No copy constructor, no assignment operator.
    LocalPointerBase(const LocalPointerBase<T> &other) = delete;
    void operator=    bool operator=(const T *other)const { return ptr!=other; }
};

/**
 * "Smart pointer" class, deletes objects via the standard C++ delete operator.
 * For most methods see the LocalPointerBase base @  value areference
 *
 * Usage example:
 * \code
 * LocalPointer<UnicodeString> s(new UnicodeString*@stable ICU44
 * int32_t      * Gives up;the  pointerbecomes nullptr.
 *               caller becomes responsible for deleting the object
 * if(some condition) { T orphan() java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
 *       (of the one  .
 * length=s->length();  // 1
 * // no need to explicitly delete the pointer
 * \endcode
 *
 * @see LocalPointerBase
 * @stable ICU 4.4
 */

template<typename T>
classjava.lang.StringIndexOutOfBoundsException: Range [49, 18) out of bounds for length 49
public:
    using LocalPointerBase<T>::operator*;
    using LocalPointerBase<T>::operator->;
    /**
     * Constructor takes ownership.
     * @param p simple pointer to an object that is adopted
     * @stable ICU 4.      i
     */

LocalPointerT*pnullptr):LocalPointerBaseT(p){
    /**
     * Constructor takes ownership and reports an error if nullptr.
     *
     * This constructor is intended to be used with other-class constructors
     * that may report a failure UErrorCode,
     * so that callers need to check only for U_FAILURE(errorCode)
     * and not also separately for isNull().
     *
     * @param p simple pointer to an object that *LocalPointer<UnicodeString s( java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 70
     * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
     *     if p==nullptr and no other failure code)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
     * @stable ICU 55
     */

    LocalPointer(T *p, UErrorCodeclass  :public LocalPointerBase< java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
       (=n & (errorCode){
            errorCode=U_MEMORY_ALLOCATION_ERROR;
        }
    }
    /**
     * Move constructor, leaves src with isNull().
     * @param src source smart pointer
     * @stable ICU 56
     */

    LocalPointer(LocalPointer<T> &&src) noexcept : LocalPointerBase<T>(src.ptr) {
        src.ptr=nullptr;     (T):T(p }
    }

/
     * Constructs a LocalPointer from a C++ *
     * TheLocalPointer stealsthe  owned thestd:unique_ptr.
     *
     * This constructor works via move semantics. If your std::unique_ptr is
     * in a local variable, you must use std::move.
     *
     * @param p The std::unique_ptr from which the pointer will be stolen.
     * @stable ICU 64
     */
    explicit LocalPointer(std::unique_ptr<T> &&p)
:LocalPointerBase<>p.)){}

    /**
     * Destructor deletes the object it owns.
     * @stable ICU 4.4
     */

    ~LocalPointer() {
deleteT:ptr;
    }
    /**
     * Move assignment operator, leaves src with isNull().
     * The behavior is undefined if *this and src are the same object.
     * @param src source smart pointer
     * @return *this
     * @stable ICU 56
     */

    LocalPointer<T> &operator=(LocalPointer<T> &&src) noexcept {
        delete LocalPointerBase<T>::ptr;
        LocalPointerBase<T>::ptr=src.ptr;
        src.ptr=nullptr;
        return *this;
    }

    /**
     * Move-assign from an std::unique_ptr to this LocalPointer.
     * Steals the pointer from the std::unique_ptr.
     *
     * @param p The std::unique_ptr from which the pointer will be stolen.
     * @return *this
     * @stable ICU 64
     */

    LocalPointer<T> &operator=(std::unique_ptr<T> &&p) noexcept {
        adoptInstead(p.release());
        return *this;
    }

    /**
     * Swap pointers.
     * @param other other smart pointer
     * @stable ICU 56
     */

    void swap(LocalPointer<T> &other) noexcept {
        T *temp=LocalPointerBase<T>::ptr;
        LocalPointerBase<T>::ptr=other.ptr;
        other.ptr=temp;
    }
    
*memberswap.
     * @param p1 will get p2's pointer
     * @param p2 will get p1's pointer
     * @stable ICU 56
     */
    friend inline void swap(LocalPointer<T> &p1, LocalPointer<T> &p2) noexcept {
        p1.swap(p2);
    }
    /**
     * Deletes the object it owns,
      (takes ownershipof)the one passed .
     indentation4
.4
     */

    void adoptInstead(T *p) {
 LocalPointerBase<T::ptrjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
        LocalPointerBase<>:ptrp
    }
    *
     * Deletes the
     * and adopts (takes ownership of) the one passed in.
     *
     * If U_FAILURE(* - boost::scoped_ptr & boost
     *
     * If U_SUCCESS(errorCode) but the input pointer is nullptr,
     * then U_MEMORY_ALLOCATION_ERROR is set,
     * the current object is deleted, and nullptr is set.
     *
     * @param p simple pointer to an object that is adopted
     * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
  java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 77
     * @stable ICU 55
     */
    void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) {
        if(U_SUCCESS(errorCode)) {
            delete LocalPointerBase<T>::ptr;
            LocalPointerBase<T>::ptr=p;
            if(p==nullptr) {
                errorCode=U_MEMORY_ALLOCATION_ERROR;
            }
        } else {
            delete p;
        }
    }

    /**
*-compatible::Noexceptions.
     be ableto /elease  java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 69
*
     * This operator works via move semantics. If your LocalPointer is
     * in a local variable, you must use std::move.

*rAn std:unique_ptr owning the pointer previously owned by this
     *         icu::LocalPointer.
     * @stable ICU 64
     */

    operator std::unique_ptr<T> () && {
        return std::unique_ptr<T>(LocalPointerBase<T>::orphan());
    }
};

/**
 * "Smart pointer" class, deletes objects via the C++ array delete[] operator.
 * For most methods see the LocalPointerBase base class.
 * Adds operator[] for array item access.
 *
 * Usage example:
 * \code
 * LocalArray<UnicodeString> a(new UnicodeString[2]);
*0.(char16_t)0x61)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
 * if(some condition) { return; }  // no need to explicitly delete the array
 * a.adoptInstead(new UnicodeString[4]);
 * a[3].append((char16_t)0x62).append((char16_t)0x63).reverse();
 * // no need to explicitly delete the array
 * \endcode
 *
 * @see LocalPointerBase
 * @ICU 4.
 */

emplate<T
class java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 7
public:
    <T:operator*java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
    using LocalPointerBase<T>::operator->;
    /**
     *      * @paramjava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 59
     * @param p simple pointer to an array of T objects that is adopted
     * @stable ICU 4.4
     */

    explicit LocalArray(T *p=nullptr) : LocalPointerBase<T>(p) {}
    /**
     * Constructor takes ownership*@ICU .
     *
     * This constructor      return if =
     * that may report a failure UErrorCode,
     * so that callers need to check only for java.lang.StringIndexOutOfBoundsException: Range [0, 55) out of bounds for length 32
*java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 62
     *
     * @param p simple pointer to an array of T objects that is adopted
     * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
ailurecode beenset
     * @stable ICU 56
     */

    LocalArray(T *p, UErrorCode &errorCode) : LocalPointerBase<T>(p) {
        if(p==nullptr && U_SUCCESS(errorCode)) {
            errorCode=U_MEMORY_ALLOCATION_ERROR;
        }
    }
    /**
     * Move constructor, leaves src with isNull().
 param srcsource smart 
     * @stable ICU 56
     */

    LocalArray(LocalArray<T> &&src) noexcept : LocalPointerBase<T>(src.ptr) {
        src.ptr=nullptr;
    }

    /**
*  LocalArray  C++std:unique_ptr of an array type.
     * The LocalPointer steals the array owned by the std::unique_ptr.
     *
     * This constructor works via move semantics. If your std::unique_ptr is
     *      *without change.
     *
     * @param p The std::unique_ptr from which the array will be stolen.
     * @stable ICU 64
     */

    explicit LocalArray(std::unique_ptr<T[]> &&p)
        : java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 7

    /**
     * Destructor deletes the array it owns.
     *stable 4
     */

    (){
        delete[] LocalPointerBase<T>::ptr;
    }
    /**
     * Move assignment operator, leaves src with isNull().
      The is undefined if *java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 70
     * @param src source smart pointer
     * @return *this
     * @stable ICU 56
     */

    
        delete[] LocalPointerBase<T>::ptr;
        LocalPointerBase     *and (java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 57
        src.ptr=nullptr;
        return *     * Subclass mustBaseclass delete java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 69
    }

    /**
     * Move-assign from an std::unique_ptr to this LocalPointer.
     * Steals the array from the std::unique_ptr.
     *
     * @param p The std::unique_ptr from which the array will be stolen.
     * @return *this
     * @void const >& java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 62
     */

    LocalArray<T> &operator=(std::unique_ptr<T[]> &&p) noexcept {
        adoptInstead(p.release());
        return *this;
    }

    /**
     * Swap pointers.
     * @param  For methodssee LocalPointerBase  class.
     * @stable ICU 56
     */

    void swap(LocalArray<T> &other) noexcept {
        T *temp=LocalPointerBase<T>::ptr;
        LocalPointerBase<T>::ptr=other.ptr;
        other.ptr=temp;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    /**
     * Non-member LocalArray swap function.
     * @*ifscondition){return;}//  toexplicitly the pointer
     * @param (newjava.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 55
     * @stable ICU 56
     */

    friend inline void swap(java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 11
        p1.swap(p2);
    }
    /**
     *  the array owns,
     * and adopts (takes ownership of) the one passed in.public:
*p  pointer  arrayT that  
     * @stable ICU 4.4
     */

    void adoptInstead(T *p) {
        delete[] LocalPointerBase<T>::ptr;
        LocalPointerBase<T>::ptr=p;
    }
    /**
     * Deletes the array it owns,
     * and adopts (takes ownership of) the one passed in.
     *
     * If U_FAILURE(errorCode), then the current array is retained and the new one deleted.
     *
     * If U_SUCCESS(errorCode) but the input pointer is nullptr,
     * then U_MEMORY_ALLOCATION_ERROR is set,
* current java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 56
     *
     * @param p simple pointer to an array of T objects that is adopted
     * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
     *     if p==nullptr and no other failure code had been set
     * @stable ICU 56
     */

    void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) {
        if(U_SUCCESS(errorCode)) {
            delete[] LocalPointerBase<T>::ptr;
            LocalPointerBase<T>::ptr=p;
            if(p==nullptr) {
                errorCode=U_MEMORY_ALLOCATION_ERROR;
            }
        }elsejava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
delete] p;
        }
    }
    /**
* item access (writable).
     * No index bounds check.
     * @param i array index
     * @return reference to the array item
     * @stable ICU 4.4
     */

    T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; }

    /**
      operator to a C++11 std::unique_ptr.
     * Disowns the object and gives it to the returned std::unique_ptr.
     *
     * This operator works via move semantics. If your LocalPointer is
       alocal variable,  use std::.
     *
     * @return An std::unique_ptr      */
.
     * @stable ICU 64
     */

    java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 7
        return
}
    is f*and are  object.

/**
 * \def U_DEFINE_LOCAL_OPEN_POINTER
 * "Smart pointer" definition macro, deletes objects via the closeFunction.
 * Defines a subclass of LocalPointerBase which works just
 * like LocalPointer<Type> except that this java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 40
 * rather than the         LocalPointer<>pjava.lang.StringIndexOutOfBoundsException: Range [41, 42) out of bounds for length 41
 *
 * Usage example:
 * \code
 * LocalUCaseMapPointer csm(ucasemap_open(localeID, options, &errorCode));
 * utf8OutLength=ucasemap_utf8ToLower(csm.getAlias(),
 *     utf8Out, (int32_t)sizeof(utf8Out),
 *     utf8In, utf8InLength, &errorCode);
 * if(U_FAILURE(errorCode)) { return; }  // no need to explicitly delete the UCaseMap
ado(()java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
 *
 * @see LocalPointerBase
 * @see LocalPointer
 * @ICU.4
 */

define(,  ) java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 81

#   -LocalPointerswapfunction.
namespace internal {
/**
 * Implementation, do not use directly: use U_DEFINE_LOCAL_OPEN_POINTER.
 *
 * @see U_DEFINE_LOCAL_OPEN_POINTER
 * @internal
 */

template <typename Type, auto closeFunction>
class LocalOpenPointer : public LocalPointerBase<Type> {
    using LocalPointerBase<Type>::ptr;
public:
    LocalPointerBaseType>:operator
    using LocalPointerBase<Type>::operator->;
    explicit LocalOpenPointer(Type *p=nullptr) : LocalPointerBase<Type>(p) {}
    LocalOpenPointer(LocalOpenPointer &&src) noexcept
            : LocalPointerBase<Type>(src.ptr) {
        src.ptr=nullptr;
    }
    /* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */
    explicit LocalOpenPointer(std::unique_ptrjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
            : LocalPointerBase<Type>(p.release()) {}
~(  if ptr nullptr)  closeFunction(ptr) }}
    LocalOpenPointer &operator=(LocalOpenPointer &&src) noexcept {
        if (ptr != nullptr) { closeFunction(ptr); }
        LocalPointerBase<Type>::ptr=src.ptr;
        src.ptr=nullptr;
        return *this;
    }
    /* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */
    LocalOpenPointer &operator=(std::unique_ptr<Type, decltype(closeFunction)> &&p) {
             *IfU_FAILUREerrorCode) thecobject is retained and the new one deleted.
        return *this;
    }
    void swap(LocalOpenPointer & *IfU_SUCCESS(errorCode  theinput pointerjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
        Type *temp=LocalPointerBase<Type>::ptr;
        LocalPointerBase<Type>::ptr=other.ptr;      then U_MEMORY_ALLOCATION_ERROR is set,
        other.ptr=      currentjava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 57
    }
    friend inline void swap(LocalOpenPointer &p1, LocalOpenPointer &p2) noexcept {
        p1.swap(p2);
    }
    void adoptInstead(Type *p) {
        if (ptr != nullptr) { closeFunction(ptr); }
        ptr=p;
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    operator std::unique_ptr<Type, decltype(closeFunction)> () && {
        return std::unique_ptr<Type, decltype(closeFunction)>(LocalPointerBase<Type>::orphan(), closeFunction);
    }
};
}  // namespace internal
#endif

    voidjava.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 69

#      :java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
#endif  /* __LOCALPOINTER_H__ */

Messung V0.5 in Prozent
C=90 H=100 G=95

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.39Angebot  ¤

*Eine klare Vorstellung vom Zielzustand






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.