LMMS
Loading...
Searching...
No Matches
juce_UMPIterator.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23#ifndef DOXYGEN
24
25namespace juce
26{
28{
29
40{
41public:
43 Iterator() noexcept = default;
44
46 explicit Iterator (const uint32_t* ptr, size_t bytes) noexcept
47 : view (ptr)
48 #if JUCE_DEBUG
49 , bytesRemaining (bytes)
50 #endif
51 {
52 ignoreUnused (bytes);
53 }
54
55 using difference_type = std::iterator_traits<const uint32_t*>::difference_type;
57 using reference = const View&;
58 using pointer = const View*;
59 using iterator_category = std::forward_iterator_tag;
60
63 {
64 const auto increment = view.size();
65
66 #if JUCE_DEBUG
67 // If you hit this, the memory region contained a truncated or otherwise
68 // malformed Universal MIDI Packet.
69 // The Iterator can only be used on regions containing complete packets!
70 jassert (increment <= bytesRemaining);
71 bytesRemaining -= increment;
72 #endif
73
74 view = View (view.data() + increment);
75 return *this;
76 }
77
82 Iterator operator++ (int) noexcept
83 {
84 auto copy = *this;
85 ++(*this);
86 return copy;
87 }
88
92 bool operator== (const Iterator& other) const noexcept
93 {
94 return view == other.view;
95 }
96
100 bool operator!= (const Iterator& other) const noexcept
101 {
102 return ! operator== (other);
103 }
104
111
118
119private:
121
122 #if JUCE_DEBUG
123 size_t bytesRemaining = 0;
124 #endif
125};
126
127}
128}
129
130#endif
#define copy(x)
Definition ADnoteParameters.cpp:1011
#define noexcept
Definition DistrhoDefines.h:72
View value_type
Definition juce_UMPIterator.h:56
const View & reference
Definition juce_UMPIterator.h:57
pointer operator->() noexcept
Definition juce_UMPIterator.h:117
Iterator & operator++() noexcept
Definition juce_UMPIterator.h:62
reference operator*() noexcept
Definition juce_UMPIterator.h:110
std::forward_iterator_tag iterator_category
Definition juce_UMPIterator.h:59
std::iterator_traits< const uint32_t * >::difference_type difference_type
Definition juce_UMPIterator.h:55
View view
Definition juce_UMPIterator.h:120
const View * pointer
Definition juce_UMPIterator.h:58
Definition juce_UMPView.h:46
#define jassert(expression)
unsigned int uint32_t
Definition mid.cpp:100
Definition juce_UMP_test.cpp:26
Definition carla_juce.cpp:31
jack_client_t client jack_client_t client jack_client_t client jack_client_t JackInfoShutdownCallback void arg jack_client_t jack_port_t port void func jack_client_t const char const char unsigned long flags const jack_port_t port jack_client_t jack_port_id_t port_id const jack_port_t const char port_name const jack_port_t port void * ptr
Definition juce_linux_JackAudio.cpp:79
void ignoreUnused(Types &&...) noexcept
Definition juce_MathsFunctions.h:333
#define const
Definition zconf.h:137