AUI Framework  master
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
FormatEtcEnumerator.h
    1/*
    2 * AUI Framework - Declarative UI toolkit for modern C++20
    3 * Copyright (C) 2020-2025 Alex2772 and Contributors
    4 *
    5 * SPDX-License-Identifier: MPL-2.0
    6 *
    7 * This Source Code Form is subject to the terms of the Mozilla Public
    8 * License, v. 2.0. If a copy of the MPL was not distributed with this
    9 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
   10 */
   11
   12#pragma once
   13
   14#include <AUI/Common/AVector.h>
   15#include "AComBase.h"
   16
   20class FormatEtcEnumerator final: public AComBase<FormatEtcEnumerator, IEnumFORMATETC> {
   21public:
   22    FormatEtcEnumerator(AVector<FORMATETC> contents) : mContents(std::move(contents)), mCursor(mContents.begin()) {}
   23    FormatEtcEnumerator(const FormatEtcEnumerator& rhs): mContents(rhs.mContents), mCursor(mContents.begin() + std::distance(rhs.mContents.cbegin(), AVector<FORMATETC>::const_iterator(rhs.mCursor))) {
   24    }
   25
   26    HRESULT __stdcall Next(ULONG celt, FORMATETC* rgelt, ULONG* pceltFetched) override;
   27    HRESULT __stdcall Skip(ULONG celt) override;
   28    HRESULT __stdcall Reset(void) override;
   29    HRESULT __stdcall Clone(IEnumFORMATETC** ppenum) override;
   30
   31private:
   32    AVector<FORMATETC> mContents;
   33    AVector<FORMATETC>::iterator mCursor;
   34};
   35
   36
Helper class implementing COM AddRef Release, and QueryInterface.
Definition AComBase.h:27
A std::vector with AUI extensions.
Definition AVector.h:39