raylib-cpp
C++ object-oriented wrapper library for raylib.
include
DroppedFiles.hpp
1
/*
2
* LICENSE: zlib/libpng
3
*
4
* raylib-cpp is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
5
* BSD-like license that allows static linking with closed source software:
6
*
7
* Copyright (c) 2020 Rob Loach (@RobLoach)
8
*
9
* This software is provided "as-is", without any express or implied warranty. In no event
10
* will the authors be held liable for any damages arising from the use of this software.
11
*
12
* Permission is granted to anyone to use this software for any purpose, including commercial
13
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
14
*
15
* 1. The origin of this software must not be misrepresented; you must not claim that you
16
* wrote the original software. If you use this software in a product, an acknowledgment
17
* in the product documentation would be appreciated but is not required.
18
*
19
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
20
* as being the original software.
21
*
22
* 3. This notice may not be removed or altered from any source distribution.
23
*/
24
25
#ifndef RAYLIB_CPP_INCLUDE_DROPPEDFILES_HPP_
26
#define RAYLIB_CPP_INCLUDE_DROPPEDFILES_HPP_
27
28
#include <string>
29
30
#include "./raylib.hpp"
31
32
namespace
raylib
{
36
class
DroppedFiles
{
37
public
:
38
DroppedFiles
() {
39
Get
();
40
}
41
45
DroppedFiles
&
Get
() {
46
m_files
=
::GetDroppedFiles
(&
m_count
);
47
return
*
this
;
48
}
49
53
inline
bool
IsFileDropped
()
const
{
54
return ::IsFileDropped();
55
}
56
60
inline
DroppedFiles
&
Clear
() {
61
::ClearDroppedFiles();
62
m_count
= 0;
63
m_files
= NULL;
64
return
*
this
;
65
}
66
67
~DroppedFiles
() {
68
Clear
();
69
}
70
71
inline
std::string
operator[]
(
int
pos) {
72
return
at
(pos);
73
}
74
75
inline
int
Count
()
const
{
76
return
m_count
;
77
}
78
79
inline
int
size
()
const
{
80
return
m_count
;
81
}
82
83
inline
bool
empty
()
const
{
84
return
m_count
== 0;
85
}
86
87
inline
void
clear
() {
88
Clear
();
89
}
90
91
inline
std::string
front
()
const
{
92
return
at
(0);
93
}
94
95
inline
std::string
back
()
const
{
96
return
at
(
m_count
- 1);
97
}
98
99
std::string
at
(
int
pos)
const
{
100
if
(
m_files
!= NULL && pos < m_count && pos >= 0) {
101
return
std::string(
m_files
[pos]);
102
}
103
// TODO(RobLoach): Throw exception when out of range.
104
return
""
;
105
}
106
107
protected
:
108
char
**
m_files
;
109
int
m_count
;
110
};
111
}
// namespace raylib
112
113
#endif // RAYLIB_CPP_INCLUDE_DROPPEDFILES_HPP_
raylib
Provides all the classes associated with raylib-cpp.
Definition:
AudioDevice.hpp:31
raylib::DroppedFiles::clear
void clear()
Definition:
DroppedFiles.hpp:87
raylib::DroppedFiles::size
int size() const
Definition:
DroppedFiles.hpp:79
raylib::GetDroppedFiles
std::vector< std::string > GetDroppedFiles()
Get dropped files names.
Definition:
Functions.hpp:164
raylib::DroppedFiles::operator[]
std::string operator[](int pos)
Definition:
DroppedFiles.hpp:71
raylib::DroppedFiles::front
std::string front() const
Definition:
DroppedFiles.hpp:91
raylib::DroppedFiles::Clear
DroppedFiles & Clear()
Clear dropped files paths buffer.
Definition:
DroppedFiles.hpp:60
raylib::DroppedFiles::at
std::string at(int pos) const
Definition:
DroppedFiles.hpp:99
raylib::DroppedFiles::Count
int Count() const
Definition:
DroppedFiles.hpp:75
raylib::DroppedFiles::m_files
char ** m_files
Definition:
DroppedFiles.hpp:108
raylib::DroppedFiles
Definition:
DroppedFiles.hpp:36
raylib::DroppedFiles::m_count
int m_count
Definition:
DroppedFiles.hpp:109
raylib::DroppedFiles::Get
DroppedFiles & Get()
Get the dropped files names.
Definition:
DroppedFiles.hpp:45
raylib::DroppedFiles::back
std::string back() const
Definition:
DroppedFiles.hpp:95
raylib::DroppedFiles::DroppedFiles
DroppedFiles()
Definition:
DroppedFiles.hpp:38
raylib::DroppedFiles::~DroppedFiles
~DroppedFiles()
Definition:
DroppedFiles.hpp:67
raylib::DroppedFiles::IsFileDropped
bool IsFileDropped() const
Check if a file has been dropped into window.
Definition:
DroppedFiles.hpp:53
raylib::DroppedFiles::empty
bool empty() const
Definition:
DroppedFiles.hpp:83
Generated on Sat Jan 2 2021 14:24:11 for raylib-cpp by
1.8.17