blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
201
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
7
100
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
260 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
11.4k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
80 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
8
9.86M
extension
stringclasses
52 values
content
stringlengths
8
9.86M
authors
listlengths
1
1
author
stringlengths
0
119
188540fbb1102722bdb4493852336d91839f12a7
6c62c24a5dccdb290543a5767a38d8cb48b1c5cd
/arduino/time_test_array/time_test_array.ino
b7855f27b55edd302ff286e92cea26b0279de85d
[]
no_license
jerry1100/wind-sensor
f92d6917f5349f254acad5c580ad8f44f77370b0
5fa3b04d4df1832b04ea8e9670c431d5ad77df10
refs/heads/master
2020-05-24T19:12:21.442585
2017-05-20T02:22:15
2017-05-20T02:22:15
84,873,109
0
0
null
null
null
null
UTF-8
C++
false
false
4,184
ino
#define CYCLE ARM_DWT_CYCCNT // These don't change const int mic1 = 14; const int mic2 = 15; const int resetPin = 12; const int margin = 35000; // Number of cycles to count up to (1 cycle = 2 triggers) const int cycles = 10; const int triggers = 2*cycles; // Variables used in interrupts volatile int counter1; volatile int counter2; volatile int finished1; volatile int finished2; volatile int arr1[triggers]; volatile int arr2[triggers]; volatile int nums1[triggers]; volatile int nums2[triggers]; volatile int *p1; volatile int *p2; volatile unsigned start1; volatile unsigned start2; //#define DEBUG void setup() { // Set up counting clock cycles ARM_DEMCR |= ARM_DEMCR_TRCENA; ARM_DWT_CTRL |= ARM_DWT_CTRL_CYCCNTENA; counter1 = counter2 = 0; finished1 = finished2 = 0; // Pin configurations pinMode(mic1, INPUT_PULLUP); pinMode(mic2, INPUT_PULLUP); pinMode(LED_BUILTIN, OUTPUT); attachInterrupt(mic1, handler1, FALLING); attachInterrupt(mic2, handler2, FALLING); pinMode(resetPin, INPUT_PULLUP); // Set last 2 elements in array p1 = arr1; p2 = arr2; Serial.begin(9600); } void loop() { // Wait until both are ready while (!finished1 || !finished2) delay(1000); waitForReset(); } void handler1() { // Beginning start1 = CYCLE; #ifdef DEBUG Serial.printf("Handler1 in\n"); #endif // Check if we're done if (counter1 == triggers) { finished1 = 1; detachInterrupt(mic1); #ifdef DEBUG Serial.printf("Handler1 stopped\n"); #endif } // Save current cycle into array nums1[counter1] = CYCLE; arr1[counter1++] = CYCLE - start1; } void handler2() { start2 = CYCLE; #ifdef DEBUG Serial.printf("Handler2 in\n"); #endif // Check if we're done if (counter2 == triggers) { finished2 = 1; detachInterrupt(mic2); #ifdef DEBUG Serial.printf("Handler2 stopped\n"); #endif } nums2[counter2] = CYCLE; arr2[counter2++] = CYCLE - start2; } void waitForReset() { #ifdef DEBUG Serial.printf("Waiting for reset\n"); #endif // Turn LED on to show that we're done delayMicroseconds(100000); digitalWrite(LED_BUILTIN, HIGH); Serial.printf("===========================================================================\n"); Serial.printf("RAW DATA ARR1 (IN ORDER):\n"); int sum1 = 0; for (int i = 0; i < triggers; i++) { Serial.printf("%u\n", arr1[i]); sum1 += arr1[i]; } Serial.printf("The average of %d differences is: %.3f\n", triggers, (float) sum1/triggers); Serial.printf("\nRAW DATA ARR2 (IN ORDER):\n"); int sum2 = 0; for (int i = 0; i < triggers; i++) { Serial.printf("%u\n", arr2[i]); sum2 += arr2[i]; } Serial.printf("The average of %d differences is: %.3f\n", triggers, (float) sum2/triggers); Serial.printf("===========================================================================\n"); // p1 = arr1; // p2 = arr2; // while (p1 < arr1 + triggers || p2 < arr2 + triggers) { // while not at end of array // if (*p1 < *p2 && p1 < arr1 + triggers) { // if (p1 == arr1) { // Serial.printf("P1: %lu\n", *p1); // } else { // Serial.printf("P1: %lu %lu\n", *p1, *p1 - *(p1-1)); // } // p1++; // } else if (p2 < arr2 + triggers) { // if (p2 == arr2) { // Serial.printf("P2: %lu\n", *p2); // } else { // Serial.printf("P2: %lu %lu\n", *p2, *p2 - *(p2-1)); // } // p2++; // } // } // Clear and reset int i; for (i = 0; i < triggers; i++) { arr1[i] = 0; arr2[i] = 0; } counter1 = counter2 = 0; finished1 = finished2 = 0; // Wait for reset then turn LED off while (digitalRead(resetPin) == HIGH); digitalWrite(LED_BUILTIN, LOW); #ifdef DEBUG Serial.printf("Restarting...\r\n"); #endif attachInterrupt(mic1, handler1, FALLING); attachInterrupt(mic2, handler2, FALLING); }
[ "jwu1100@gmail.com" ]
jwu1100@gmail.com
46a98ddb5fca5fd0ceb221753c0b92cdb2442cd0
e41e39e46ccaa44f104f8a817932824dbe4fb0c0
/C++/study_STL/p_vector.cpp
983984a092a9fabea9e2341b94121c0dafe1b29d
[]
no_license
yoshimura19/samples
fd59758e4431565047d306ad865fb000d2f4df4b
fc4cf50a583029016ddcb9eb9476c464c52900f1
refs/heads/master
2021-07-18T00:23:02.252666
2017-10-26T19:21:09
2017-10-26T19:21:09
108,371,681
0
0
null
null
null
null
UTF-8
C++
false
false
1,279
cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { /* *** 宣言・初期化 *** */ vector<char> str; vector<double> pos(3); // 0で初期化 vector<char> a(10, 'a'); for (int i = 0; i < pos.size(); i++) { cout << pos[i] << ' '; } cout << endl; for (int i = 0; i < a.size(); i++) { cout << a[i] << ' '; } cout << endl; vector<double> d{1.1, 2.2, 3.3, 4.4}; vector<int> v1(5); // 要素5個 vector<int> v2{5}; // 要素1個で5 vector<int> v3[5]; // ?? 要素数0のvector * 5個の配列 // int array[] = {1, 2, 3, 4, 5}; // v3.push_back(array); // error /* *** vectorへの代入 *** */ vector<int> v(10); for (int i = 0; i < v.size(); ++i) { v[i] = rand() % 100; } for (vector<int>::iterator it = v.begin(); it != v.end(); it++) { cout << *it << ' '; } cout << endl; cout << "v[20]=" << v[20] << endl; int v_ar[10]; cout << "v_ar[20]=" << v_ar[20] << endl; vector< vector<int> > vv{{1, 5}, {4, 3}, {2, 1}}; sort(vv.begin(), vv.end()); // 行の先頭の要素(行)で並び替え //sort(vv[1].begin(), vv[1].end()); // 2行目内の並び替え for (int i = 0; i < vv.size(); i++) { cout << vv[i][1] << ' '; } cout << endl; return 0; }
[ "yoshimura.job19@gmail.com" ]
yoshimura.job19@gmail.com
4a5889210632755cab2fdd75fcad6769c92c46c7
b1d28efc1718fde990d0be0875f5643a2d4e8a04
/test.cpp
4c9e563dea89c7bcb64fcc829a640ff3177baf21
[]
no_license
szcf-weiya/gobang
d981547078c570259f7a7b570ef16cbecfdae1ca
59b74bb357fd34db80bfc3ad28c60cc2b6099c89
refs/heads/master
2021-01-23T16:13:21.105464
2017-06-17T16:16:43
2017-06-17T16:16:43
93,287,144
0
0
null
2017-06-04T03:14:03
2017-06-04T03:14:03
null
UTF-8
C++
false
false
48
cpp
#include "test.h" test::test() { m = 10; }
[ "2215235182@qq.com" ]
2215235182@qq.com
8c6ab01871ee9573c3b6ab29ce706a99b73704c5
64ed240cfa4bc61cc006ed0f40170d0090d5f0e5
/muduo/net/Poller.h
00e865a935e96716b0ba31d5ffa2b61b0d72d207
[]
no_license
wu0hgl/myMuduo
f9c8b941125d8098d54bbe191ab2e49deb0fb2f4
dc4c3a429e7f6f4e2aabaf9298bdb0dbe98a2e2f
refs/heads/master
2021-12-25T18:54:51.356800
2021-12-22T17:38:31
2021-12-22T17:38:31
188,203,211
0
0
null
null
null
null
UTF-8
C++
false
false
1,617
h
#ifndef MUDUO_NET_POLLER_H #define MUDUO_NET_POLLER_H #include <vector> #include <boost/noncopyable.hpp> #include <muduo/base/Timestamp.h> #include <muduo/net/EventLoop.h> namespace muduo { namespace net { class Channel; /// /// Base class for IO Multiplexing /// /// This class doesn't own the Channel objects. class Poller : boost::noncopyable // 一个EventLoop包含一个Poller { public: typedef std::vector<Channel*> ChannelList; Poller(EventLoop* loop); virtual ~Poller(); /// Polls the I/O events. /// Must be called in the loop thread. virtual Timestamp poll(int timeoutMs, ChannelList* activeChannels) = 0; // activeChannels传出参数, 返回触发的Channel数组 /// Changes the interested I/O events. /// Must be called in the loop thread. virtual void updateChannel(Channel* channel) = 0; // 更新对应Channel的事件, 包括注册Channel /// Remove the channel, when it destructs. /// Must be called in the loop thread. virtual void removeChannel(Channel* channel) = 0; // 从Poller中移除对应的Channel static Poller* newDefaultPoller(EventLoop* loop); // 静态成员函数, 通过环境变量来确定使用PollPoller还是EPollPoller void assertInLoopThread() // 确保在当前线程中 { ownerLoop_->assertInLoopThread(); } private: EventLoop *ownerLoop_; // Poller所属EventLoop }; } // namespace net } // namespace muduo #endif // MUDUO_NET_POLLER_H
[ "ybzhang_haha@163.com" ]
ybzhang_haha@163.com
0cfadc87fca1ff4c87a1b5e44aa03067285c5406
88ae8695987ada722184307301e221e1ba3cc2fa
/third_party/eigen3/src/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h
1cdcd4e21c3aa1ca34e86e6eaa86a4e16d8005e9
[ "Apache-2.0", "LGPL-2.0-or-later", "MIT", "GPL-1.0-or-later", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "MPL-2.0", "Minpack" ]
permissive
iridium-browser/iridium-browser
71d9c5ff76e014e6900b825f67389ab0ccd01329
5ee297f53dc7f8e70183031cff62f37b0f19d25f
refs/heads/master
2023-08-03T16:44:16.844552
2023-07-20T15:17:00
2023-07-23T16:09:30
220,016,632
341
40
BSD-3-Clause
2021-08-13T13:54:45
2019-11-06T14:32:31
null
UTF-8
C++
false
false
3,300
h
#include "./InternalHeaderCheck.h" namespace Eigen { namespace internal { // TODO : once qrsolv2 is removed, use ColPivHouseholderQR or PermutationMatrix instead of ipvt template <typename Scalar> void qrsolv( Matrix< Scalar, Dynamic, Dynamic > &s, // TODO : use a PermutationMatrix once lmpar is no more: const VectorXi &ipvt, const Matrix< Scalar, Dynamic, 1 > &diag, const Matrix< Scalar, Dynamic, 1 > &qtb, Matrix< Scalar, Dynamic, 1 > &x, Matrix< Scalar, Dynamic, 1 > &sdiag) { typedef DenseIndex Index; /* Local variables */ Index i, j, k, l; Scalar temp; Index n = s.cols(); Matrix< Scalar, Dynamic, 1 > wa(n); JacobiRotation<Scalar> givens; /* Function Body */ // the following will only change the lower triangular part of s, including // the diagonal, though the diagonal is restored afterward /* copy r and (q transpose)*b to preserve input and initialize s. */ /* in particular, save the diagonal elements of r in x. */ x = s.diagonal(); wa = qtb; s.topLeftCorner(n,n).template triangularView<StrictlyLower>() = s.topLeftCorner(n,n).transpose(); /* eliminate the diagonal matrix d using a givens rotation. */ for (j = 0; j < n; ++j) { /* prepare the row of d to be eliminated, locating the */ /* diagonal element using p from the qr factorization. */ l = ipvt[j]; if (diag[l] == 0.) break; sdiag.tail(n-j).setZero(); sdiag[j] = diag[l]; /* the transformations to eliminate the row of d */ /* modify only a single element of (q transpose)*b */ /* beyond the first n, which is initially zero. */ Scalar qtbpj = 0.; for (k = j; k < n; ++k) { /* determine a givens rotation which eliminates the */ /* appropriate element in the current row of d. */ givens.makeGivens(-s(k,k), sdiag[k]); /* compute the modified diagonal element of r and */ /* the modified element of ((q transpose)*b,0). */ s(k,k) = givens.c() * s(k,k) + givens.s() * sdiag[k]; temp = givens.c() * wa[k] + givens.s() * qtbpj; qtbpj = -givens.s() * wa[k] + givens.c() * qtbpj; wa[k] = temp; /* accumulate the transformation in the row of s. */ for (i = k+1; i<n; ++i) { temp = givens.c() * s(i,k) + givens.s() * sdiag[i]; sdiag[i] = -givens.s() * s(i,k) + givens.c() * sdiag[i]; s(i,k) = temp; } } } /* solve the triangular system for z. if the system is */ /* singular, then obtain a least squares solution. */ Index nsing; for(nsing=0; nsing<n && sdiag[nsing]!=0; nsing++) {} wa.tail(n-nsing).setZero(); s.topLeftCorner(nsing, nsing).transpose().template triangularView<Upper>().solveInPlace(wa.head(nsing)); // restore sdiag = s.diagonal(); s.diagonal() = x; /* permute the components of z back to components of x. */ for (j = 0; j < n; ++j) x[ipvt[j]] = wa[j]; } } // end namespace internal } // end namespace Eigen
[ "jengelh@inai.de" ]
jengelh@inai.de
07d767b00362b16c453ef65064400d9b8546fa06
1399e45de2d2f7b7a6e604055b580127857b2f5c
/src/Externals/spire/es-render/comp/StaticFontMan.hpp
c6a1077defea0ed4e939055a0301a9e1edb8a2a3
[ "MIT" ]
permissive
jcollfont/SCIRun
6c98d3d84ace348673914356aba5c3193698435a
ab282627fa3043422178813f0f54d9115538cc81
refs/heads/master
2020-04-05T23:11:38.229015
2017-11-03T15:13:02
2017-11-03T15:13:02
31,076,944
0
0
null
2017-06-24T20:18:40
2015-02-20T17:51:23
C++
UTF-8
C++
false
false
1,206
hpp
#ifndef SPIRE_RENDER_COMPONENT_STATIC_FONT_MAN_HPP #define SPIRE_RENDER_COMPONENT_STATIC_FONT_MAN_HPP #include <es-log/trace-log.h> #include <memory> #include <es-cereal/ComponentSerialize.hpp> #include "../FontMan.hpp" namespace ren { struct StaticFontMan { // -- Data -- std::shared_ptr<FontMan> instance_; // -- Functions -- StaticFontMan() : instance_(new FontMan) {} explicit StaticFontMan(FontMan* s) : instance_(s) {} // This assignment operator is only used during modification calls inside // of the entity system. We don't care about those calls as they won't // affect this static shader man. StaticFontMan& operator=(const StaticFontMan&) { // We don't care about the incoming object. We've already created oun own // shader man and will continue to use that. return *this; } static const char* getName() {return "ren:StaticFontMan";} private: friend class spire::CerealHeap<StaticFontMan>; bool serialize(spire::ComponentSerialize&, uint64_t) { // No need to serialize. But we do want that we were in the component // system to be serialized out. return true; } }; } // namespace ren #endif
[ "dwhite@sci.utah.edu" ]
dwhite@sci.utah.edu
a18656f03a8b319e88164578002b0195c79577c6
11372f47584ed7154697ac3b139bf298cdc10675
/刷题比赛/LUOGU/P1149火柴棒等式.cpp
bb811b788f33b4d426b340da7c6738a66615bbbf
[]
no_license
strategist614/ACM-Code
b5d893103e4d2ea0134fbaeb0cbd18c0fec06d12
d1e0f36dab47f649e2fade5e7ff23cfd0e8c8e56
refs/heads/master
2020-12-20T04:21:50.750182
2020-01-24T07:43:50
2020-01-24T07:45:08
235,958,679
0
0
null
null
null
null
UTF-8
C++
false
false
492
cpp
#include<bits/stdc++.h> using namespace std; int c[] = {6,2,5,5,4,5,6,3,7,6}; int a[2005]; int n; int ans = 0; int main () { cin>>n; a[0] = 6; int ans = 0; for(int i = 1;i<=2000;i++) { int j = i; while(j >= 1) { a[i] += c[j%10]; j /= 10; } } for(int i= 0;i<=1000;i++) for(int j= 0;j<=1000;j++) { int c = i+j; if(a[i] + a[j] + 4 == n-a[c]) ans++; } cout<<ans<<endl; return 0 ; }
[ "syf981002@gmail.com" ]
syf981002@gmail.com
ef39493023953851a0d09ddd3b7df76a6dbdf7fd
b5bf497847bcb5a801717f78361653fa0c675b8f
/Goknar/src/Goknar/Controller.h
9113a7daf4bc2044d7cd906416c19f0c947d991b
[]
no_license
emrebarisc/GGJ2020
786b976a4cad922c0611dbde882abe6f9ff5fb79
2702da83552b722b5d926c0ade8e562e308e9511
refs/heads/master
2020-12-26T11:05:50.803356
2020-02-10T20:36:36
2020-02-10T20:36:36
237,489,288
0
0
null
null
null
null
UTF-8
C++
false
false
192
h
#ifndef __CONTROLLER_H__ #define __CONTROLLER_H__ #include "Core.h" class GOKNAR_API Controller { public: Controller(); ~Controller(); virtual void SetupInputs() = 0; private: }; #endif
[ "emrebarisc@gmail.com" ]
emrebarisc@gmail.com
54f3419ed5aed615d44c3b498a17b3031eb402e5
f0ba9db32f36c5aba864e5978872b2e8ad10aa40
/examples/contiguous_iterator/example_contiguous_iterator_operator_star.hpp
cd20d66b977da3a1f24fffcc5bcafa8a8e4f9752
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
Bareflank/bsl
fb325084b19cd48e03197f4265049f9c8d008c9f
6509cfff948fa34b98585512d7be33a36e2f9522
refs/heads/master
2021-12-25T11:19:43.743888
2021-10-21T14:47:58
2021-10-21T14:47:58
216,364,945
77
5
NOASSERTION
2021-10-21T02:24:26
2019-10-20T13:18:28
C++
UTF-8
C++
false
false
1,749
hpp
/// @copyright /// Copyright (C) 2020 Assured Information Security, Inc. /// /// @copyright /// Permission is hereby granted, free of charge, to any person obtaining a copy /// of this software and associated documentation files (the "Software"), to deal /// in the Software without restriction, including without limitation the rights /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell /// copies of the Software, and to permit persons to whom the Software is /// furnished to do so, subject to the following conditions: /// /// @copyright /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// /// @copyright /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE /// SOFTWARE. #include <bsl/debug.hpp> #include <bsl/string_view.hpp> namespace bsl { /// <!-- description --> /// @brief Provides the example's main function /// inline void example_contiguous_iterator_operator_star() noexcept { constexpr bsl::string_view str{"Hello"}; constexpr bsl::string_view::iterator_type iter{str.begin()}; if ('H' == *iter) { bsl::print() << "success: " << *iter << bsl::endl; } else { bsl::error() << "failure\n"; } } }
[ "rianquinn@gmail.com" ]
rianquinn@gmail.com
d0f6d0fb1327f8a1a78d8eb54b406b7c3d32967d
d674a2e496edf4d194c8f09310f7ad589c7d4d33
/Interface.h
a76cb2ff652603ed7bf795a3615011da6fbf0f0f
[ "MIT" ]
permissive
kp-marczynski/zmpo-sparse-matrix
ef640a7d9dc14c2d34043769e8abb92950107812
41eed569e415ca906fd1cca9c7525aa1f1a77c64
refs/heads/master
2020-04-10T15:00:04.585586
2019-03-20T15:08:44
2019-03-20T15:08:44
161,093,882
0
0
null
null
null
null
UTF-8
C++
false
false
2,427
h
// // Created by A671988 on 2017-10-19. // #ifndef INTERFACE_H #define INTERFACE_H #include <iostream> #include <regex> #include "SparseMatrixRepository.h" const char *ADDMAT_INSTRUCTION = "addmat"; const char *LIST_INSTRUCTION = "list"; const char *DEL_INSTRUCTION = "del"; const char *DELALL_INSTRUCTION = "delall"; const char *DEF_INSTRUCTION = "def"; const char *CLONE_INSTRUCTION = "clone"; const char *RENAME_INSTRUCTION = "rename"; const char *PRINT_INSTRUCTION = "print"; const char *QUIT_INSTRUCTION = "quit"; const char *REGEX_TEMPLATE = "^-?\\d+"; const char *HELLO_MESSAGE = "***** Witaj w programie do obslugi wektora rzadkiego! *****\n" "Dostepne polecenia:\n" "1) mvec <len> <def>\n" " wykonanie polecenia usuwa istniejacy wektor rzadki(jesli jakis istnieje)\n" " i tworzy nowy wektor o dlugosci <len>\n" " i wartosci domyslnej wektora rzadkiego <def>\n" "2) len <len>\n" " zmiana dlugosci wektora rzadkiego. Jesli zostaje zmniejszona to, to te\n" " pozycje, ktore inne niż domyslna, a nie mieszcza sie w nowym zakresie\n" " powinny zostac usuniete z tablicy wartosci i tablicy offsetow.\n" "3) def <off> <val>\n" " ustalenie wartosci <val> dla offsetu <off> wektora\n" "4) def2 <off 0> <val 0> <off 1> <val 1>\n" " ustalenie wartosci jak w 3) dla 2 par wartosci\n" "5) print\n" " wykonanie polecenia wypisuje na ekran aktualny stan wektora\n" "6) del\n" " usuwa wszystkie dynamicznie alokowane zmienne dla wektor rzadkiego,\n" " jesli wektor obecnie istnieje.\n" "7) quit\n" " konczy wykonywanie programu\n" "***********************************************************"; const char *OPERATION_PROMPT = "\nPodaj polecenie: "; const char *WRONG_COMMAND_TEXT = "polecenie nie istnieje"; const char *WRONG_ARGUMENT_TEXT = "pierwszy argument nie byl liczba"; class Interface{ public: static void showInterface(); static int getNumberFromUserInput(stringstream &stream, bool &hasGettingArgumentFailed); static int *getMultipleNumbersFromUserInput(stringstream &stream, int number, bool &hasFailed); static string getStringFromUserInput(stringstream &stream); }; #endif //INTERFACE_H
[ "noreply@github.com" ]
noreply@github.com
b78435f9066ebd9fa30da19888abf7c295d8b1a3
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/services/accessibility/features/v8_manager.h
8ee081418f99f83712fd71c50380d9b658359c4c
[ "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
6,246
h
// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SERVICES_ACCESSIBILITY_FEATURES_V8_MANAGER_H_ #define SERVICES_ACCESSIBILITY_FEATURES_V8_MANAGER_H_ #include <memory> #include <vector> #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" #include "base/task/sequenced_task_runner.h" #include "base/task/sequenced_task_runner_helpers.h" #include "base/threading/sequence_bound.h" #include "mojo/public/cpp/bindings/generic_pending_receiver.h" #include "mojo/public/cpp/bindings/pending_associated_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "services/accessibility/features/bindings_isolate_holder.h" #include "services/accessibility/public/mojom/accessibility_service.mojom-forward.h" #include "services/accessibility/public/mojom/automation.mojom-forward.h" #include "third_party/blink/public/mojom/devtools/devtools_agent.mojom.h" #include "v8/include/v8-context.h" #include "v8/include/v8-local-handle.h" namespace v8 { class Isolate; } // namespace v8 namespace gin { class ContextHolder; class IsolateHolder; } // namespace gin namespace ax { class AutomationInternalBindings; class InterfaceBinder; class V8Manager; class OSDevToolsAgent; // A V8Environment owns a V8 context within the Accessibility Service, the // bindings that belong to that context, as well as loading the Javascript that // will run in that context. // // It lives on an implementation-defined task runner (typically a background // task runner dedicated to this isolate+context) and should primarily be used // through its owning class, V8Manager. // // TODO(dcheng): Move this into v8_environment.h. class V8Environment : public BindingsIsolateHolder { public: // The default Context ID to use. We currently will have one context per // isolate. In the future we may need to switch this to an incrementing // system. static const int kDefaultContextId = 1; // Creates a new V8Environment with its own isolate and context. static base::SequenceBound<V8Environment> Create( base::WeakPtr<V8Manager> manager); // Gets a pointer to the V8 manager that belongs to this `context`. static V8Environment* GetFromContext(v8::Local<v8::Context> context); V8Environment(const V8Environment&) = delete; V8Environment& operator=(const V8Environment&) = delete; // Creates a devtools agent to debug javascript running in this environment. void ConnectDevToolsAgent( mojo::PendingAssociatedReceiver<blink::mojom::DevToolsAgent> agent); // All of the APIs needed for this V8Manager (based on the AT type) should be // installed before adding V8 bindings. void InstallAutomation( mojo::PendingAssociatedReceiver<mojom::Automation> automation, mojo::PendingRemote<mojom::AutomationClient> automation_client); void AddV8Bindings(); // Executes the given string as a Javascript script, and calls the // callback when execution is complete. void ExecuteScript(const std::string& script, base::OnceCallback<void()> on_complete); // BindingsIsolateHolder overrides: v8::Isolate* GetIsolate() const override; v8::Local<v8::Context> GetContext() const override; explicit V8Environment(scoped_refptr<base::SequencedTaskRunner> main_runner, base::WeakPtr<V8Manager> manager); virtual ~V8Environment(); // Called by the Mojo JS API when ready to bind an interface. void BindInterface(const std::string& interface_name, mojo::GenericPendingReceiver pending_receiver); private: void CreateIsolate(); // Thread runner for communicating with object which constructed this // class using V8Environment::Create. This may be the main service thread, // but that is not required. const scoped_refptr<base::SequencedTaskRunner> main_runner_; const base::WeakPtr<V8Manager> manager_; // Bindings wrappers for V8 APIs. // TODO(crbug.com/1355633): Add more APIs including TTS, SST, etc. std::unique_ptr<AutomationInternalBindings> automation_bindings_; // Holders for isolate and context. std::unique_ptr<gin::IsolateHolder> isolate_holder_; std::unique_ptr<gin::ContextHolder> context_holder_; std::unique_ptr<OSDevToolsAgent> devtools_agent_; }; // Owns the V8Environment and any Mojo interfaces exposed to that V8Environment. // Lives on the main service thread; any use of the internally-owned // V8Environment will be proxied to the v8 task runner. // // There may be one V8Manager per Assistive Technology feature or features // may share V8Managers. class V8Manager { public: V8Manager(); ~V8Manager(); // Various optional features that can be configured. All configuration must be // done before calling `FinishContextSetUp()`. void ConfigureAutomation( mojo::PendingAssociatedReceiver<mojom::Automation> automation, mojo::PendingRemote<mojom::AutomationClient> automation_client); void ConfigureTts(mojom::AccessibilityServiceClient* ax_service_client); void ConfigureUserInterface( mojom::AccessibilityServiceClient* ax_service_client); void FinishContextSetUp(); // Instructs V8Environment to create a devtools agent. void ConnectDevToolsAgent( mojo::PendingAssociatedReceiver<blink::mojom::DevToolsAgent> agent); // Called by V8Environment when JS wants to bind a Mojo interface. void BindInterface(const std::string& interface_name, mojo::GenericPendingReceiver pending_receiver); // Allow tests to expose additional Mojo interfaces to JS. void AddInterfaceForTest(std::unique_ptr<InterfaceBinder> interface_binder); void RunScriptForTest(const std::string& script, base::OnceClosure on_complete); private: SEQUENCE_CHECKER(sequence_checker_); base::SequenceBound<V8Environment> v8_env_; // The Mojo interfaces that are exposed to JS. When JS wants to bind a Mojo // interface, the first matching InterfaceBinder will be used. std::vector<std::unique_ptr<InterfaceBinder>> interface_binders_; base::WeakPtrFactory<V8Manager> weak_factory_{this}; }; } // namespace ax #endif // SERVICES_ACCESSIBILITY_FEATURES_V8_MANAGER_H_
[ "chromium-scoped@luci-project-accounts.iam.gserviceaccount.com" ]
chromium-scoped@luci-project-accounts.iam.gserviceaccount.com
b190ac07c7b2a211ad04f13aac81628ebcdd985e
7f7ebd4118d60a08e4988f95a846d6f1c5fd8eda
/wxWidgets-2.9.1/include/wx/generic/filepickerg.h
9fea30c3a800ce844c4c4b0145ef744471a227a1
[]
no_license
esrrhs/fuck-music-player
58656fc49d5d3ea6c34459630c42072bceac9570
97f5c541a8295644837ad864f4f47419fce91e5d
refs/heads/master
2021-05-16T02:34:59.827709
2021-05-10T09:48:22
2021-05-10T09:48:22
39,882,495
2
0
null
null
null
null
UTF-8
C++
false
false
8,448
h
///////////////////////////////////////////////////////////////////////////// // Name: wx/generic/filepickerg.h // Purpose: wxGenericFileDirButton, wxGenericFileButton, wxGenericDirButton // Author: Francesco Montorsi // Modified by: // Created: 14/4/2006 // Copyright: (c) Francesco Montorsi // RCS-ID: $Id$ // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_FILEDIRPICKER_H_ #define _WX_FILEDIRPICKER_H_ #include "wx/button.h" #include "wx/filedlg.h" #include "wx/dirdlg.h" wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEvent ); //----------------------------------------------------------------------------- // wxGenericFileDirButton: a button which brings up a wx{File|Dir}Dialog //----------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxGenericFileDirButton : public wxButton, public wxFileDirPickerWidgetBase { public: wxGenericFileDirButton() { Init(); } wxGenericFileDirButton(wxWindow *parent, wxWindowID id, const wxString& label = wxFilePickerWidgetLabel, const wxString& path = wxEmptyString, const wxString &message = wxFileSelectorPromptStr, const wxString &wildcard = wxFileSelectorDefaultWildcardStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxFilePickerWidgetNameStr) { Init(); Create(parent, id, label, path, message, wildcard, pos, size, style, validator, name); } virtual wxControl *AsControl() { return this; } public: // overrideable virtual wxDialog *CreateDialog() = 0; virtual wxWindow *GetDialogParent() { return GetParent(); } virtual wxEventType GetEventType() const = 0; public: bool Create(wxWindow *parent, wxWindowID id, const wxString& label = wxFilePickerWidgetLabel, const wxString& path = wxEmptyString, const wxString &message = wxFileSelectorPromptStr, const wxString &wildcard = wxFileSelectorDefaultWildcardStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxFilePickerWidgetNameStr); // event handler for the click void OnButtonClick(wxCommandEvent &); protected: wxString m_message, m_wildcard; // we just store the style passed to the ctor here instead of passing it to // wxButton as some of our bits can conflict with wxButton styles and it // just doesn't make sense to use picker styles for wxButton anyhow long m_pickerStyle; private: // common part of all ctors void Init() { m_pickerStyle = -1; } }; //----------------------------------------------------------------------------- // wxGenericFileButton: a button which brings up a wxFileDialog //----------------------------------------------------------------------------- #define wxFILEBTN_DEFAULT_STYLE (wxFLP_OPEN) class WXDLLIMPEXP_CORE wxGenericFileButton : public wxGenericFileDirButton { public: wxGenericFileButton() {} wxGenericFileButton(wxWindow *parent, wxWindowID id, const wxString& label = wxFilePickerWidgetLabel, const wxString& path = wxEmptyString, const wxString &message = wxFileSelectorPromptStr, const wxString &wildcard = wxFileSelectorDefaultWildcardStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxFILEBTN_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxFilePickerWidgetNameStr) { Create(parent, id, label, path, message, wildcard, pos, size, style, validator, name); } public: // overrideable virtual long GetDialogStyle() const { // the derived class must initialize it if it doesn't use the // non-default wxGenericFileDirButton ctor wxASSERT_MSG( m_pickerStyle != -1, "forgot to initialize m_pickerStyle?" ); long filedlgstyle = 0; if ( m_pickerStyle & wxFLP_OPEN ) filedlgstyle |= wxFD_OPEN; if ( m_pickerStyle & wxFLP_SAVE ) filedlgstyle |= wxFD_SAVE; if ( m_pickerStyle & wxFLP_OVERWRITE_PROMPT ) filedlgstyle |= wxFD_OVERWRITE_PROMPT; if ( m_pickerStyle & wxFLP_FILE_MUST_EXIST ) filedlgstyle |= wxFD_FILE_MUST_EXIST; if ( m_pickerStyle & wxFLP_CHANGE_DIR ) filedlgstyle |= wxFD_CHANGE_DIR; return filedlgstyle; } virtual wxDialog *CreateDialog() { wxFileDialog *p = new wxFileDialog(GetDialogParent(), m_message, wxEmptyString, wxEmptyString, m_wildcard, GetDialogStyle()); // this sets both the default folder and the default file of the dialog p->SetPath(m_path); return p; } wxEventType GetEventType() const { return wxEVT_COMMAND_FILEPICKER_CHANGED; } protected: void UpdateDialogPath(wxDialog *p) { wxStaticCast(p, wxFileDialog)->SetPath(m_path); } void UpdatePathFromDialog(wxDialog *p) { m_path = wxStaticCast(p, wxFileDialog)->GetPath(); } private: DECLARE_DYNAMIC_CLASS(wxGenericFileButton) }; //----------------------------------------------------------------------------- // wxGenericDirButton: a button which brings up a wxDirDialog //----------------------------------------------------------------------------- #define wxDIRBTN_DEFAULT_STYLE 0 class WXDLLIMPEXP_CORE wxGenericDirButton : public wxGenericFileDirButton { public: wxGenericDirButton() {} wxGenericDirButton(wxWindow *parent, wxWindowID id, const wxString& label = wxDirPickerWidgetLabel, const wxString& path = wxEmptyString, const wxString &message = wxDirSelectorPromptStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDIRBTN_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxDirPickerWidgetNameStr) { Create(parent, id, label, path, message, wxEmptyString, pos, size, style, validator, name); } public: // overrideable virtual long GetDialogStyle() const { long dirdlgstyle = wxDD_DEFAULT_STYLE; if ( m_pickerStyle & wxDIRP_DIR_MUST_EXIST ) dirdlgstyle |= wxDD_DIR_MUST_EXIST; if ( m_pickerStyle & wxDIRP_CHANGE_DIR ) dirdlgstyle |= wxDD_CHANGE_DIR; return dirdlgstyle; } virtual wxDialog *CreateDialog() { return new wxDirDialog(GetDialogParent(), m_message, m_path, GetDialogStyle()); } wxEventType GetEventType() const { return wxEVT_COMMAND_DIRPICKER_CHANGED; } protected: void UpdateDialogPath(wxDialog *p) { wxStaticCast(p, wxDirDialog)->SetPath(m_path); } void UpdatePathFromDialog(wxDialog *p) { m_path = wxStaticCast(p, wxDirDialog)->GetPath(); } private: DECLARE_DYNAMIC_CLASS(wxGenericDirButton) }; #endif // _WX_FILEDIRPICKER_H_
[ "esrrhs@esrrhs-PC" ]
esrrhs@esrrhs-PC
78314cd066ed81595dec0beca166da6e613735e3
f9b12f47b23be64ec06e2f4ebc2aaf764ac3be17
/MFCApplication1/Monster.cpp
e22898ac41e9c843e73553b976943b7a7cb02b10
[]
no_license
happyMH/MFCGame
14a04d90e5b24aee53a3dc1d5c4a3be5cf8d21fa
f2e610d647815e9652dde124f30290bf00339983
refs/heads/master
2021-01-21T18:25:01.707130
2017-05-23T08:35:05
2017-05-23T08:35:05
92,045,824
0
0
null
null
null
null
GB18030
C++
false
false
855
cpp
#include "stdafx.h" #include "Monster.h" //PNG 的pucColor[0], pucColor[1],pucColor[2], pucColor[3] 共同决定一个像素颜色 //将PNG背景变透明 void Monster::TransparentPNG() { for (int i = 0; i < monster.GetWidth(); i++) for (int j = 0; j < monster.GetHeight(); j++) { unsigned char * pucColor = reinterpret_cast<unsigned char *>(monster.GetPixelAddress(i, j)); pucColor[0] = pucColor[0] * pucColor[3] / 255; pucColor[1] = pucColor[1] * pucColor[3] / 255; pucColor[2] = pucColor[2] * pucColor[3] / 255; } } Monster::Monster() { } void Monster::Initialzation(CString name_file) { //加载人物--英雄 monster.Load(name_file); TransparentPNG(); //设置人物初始参数 max_frame = 2; frame = 0; direct = Left; x = 800; y = 500; width = 134; heigth = 131; speed = 40; } Monster::~Monster() { }
[ "吕明辉@DESKTOP-VM9I9DI" ]
吕明辉@DESKTOP-VM9I9DI
0a462e9f9c0c5a2affeed024d9c0d5bfa9c86a6a
846bba1948500d24db8a8bafb4625597cbfe2a31
/src/Commands/LimitSwitches.h
6abe48ed8bf31f9b3bc35e8ef471b501ad7af13d
[]
no_license
kearsleyroboticsmanagment/robotics-code
986ddf2f662e1f5002603356839c17fe64d4778c
d0beb6d8f3c99772cd2522d1e644110f04fecd7a
refs/heads/master
2016-09-06T01:09:04.202318
2015-02-28T02:00:02
2015-02-28T02:00:02
30,158,684
2
4
null
2015-10-19T19:59:07
2015-02-01T20:27:49
C++
UTF-8
C++
false
false
268
h
#ifndef LimitSwitches_H #define LimitSwitches_H #include "../CommandBase.h" #include "WPILib.h" class LimitSwitches: public CommandBase { public: LimitSwitches(); void Initialize(); void Execute(); bool IsFinished(); void End(); void Interrupted(); }; #endif
[ "dnofs@speednetllc.com" ]
dnofs@speednetllc.com
25a755c8502e942d62edb144259a9a1a08cd5b4c
7f3b840df69fcb5fd6bda7d1a454ea193adc250b
/external/cimgui/imgui/imgui.h
408095be186f1d36862abb0624c3b7ec57482938
[ "MIT" ]
permissive
canoi12/tinycoffee
a94c81b03b1132ed242b81da550fbaf1ae7bc23c
1711dac26586af4f873cc5fb45f213bfc1463ef5
refs/heads/master
2023-02-21T03:47:36.365293
2021-01-16T21:38:27
2021-01-16T21:38:27
266,420,480
70
7
MIT
2021-01-16T21:38:28
2020-05-23T21:13:16
C
UTF-8
C++
false
false
272,672
h
// dear imgui, v1.79 WIP // (headers) // Help: // - Read FAQ at http://dearimgui.org/faq // - Newcomers, read 'Programmer guide' in imgui.cpp for notes on how to setup Dear ImGui in your codebase. // - Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp. All applications in examples/ are doing that. // Read imgui.cpp for details, links and comments. // Resources: // - FAQ http://dearimgui.org/faq // - Homepage & latest https://github.com/ocornut/imgui // - Releases & changelog https://github.com/ocornut/imgui/releases // - Gallery https://github.com/ocornut/imgui/issues/3075 (please post your screenshots/video there!) // - Glossary https://github.com/ocornut/imgui/wiki/Glossary // - Wiki https://github.com/ocornut/imgui/wiki // - Issues & support https://github.com/ocornut/imgui/issues /* Index of this file: // Header mess // Forward declarations and basic types // ImGui API (Dear ImGui end-user API) // Flags & Enumerations // Memory allocations macros // ImVector<> // ImGuiStyle // ImGuiIO // Misc data structures (ImGuiInputTextCallbackData, ImGuiSizeCallbackData, ImGuiWindowClass, ImGuiPayload) // Obsolete functions // Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor) // Draw List API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData) // Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder, ImFontAtlasFlags, ImFontAtlas, ImFont) // Platform interface for multi-viewport support (ImGuiPlatformIO, ImGuiPlatformMonitor, ImGuiViewportFlags, ImGuiViewport) */ #pragma once // Configuration file with compile-time options (edit imconfig.h or #define IMGUI_USER_CONFIG to your own filename) #ifdef IMGUI_USER_CONFIG #include IMGUI_USER_CONFIG #endif #if !defined(IMGUI_DISABLE_INCLUDE_IMCONFIG_H) || defined(IMGUI_INCLUDE_IMCONFIG_H) #include "imconfig.h" #endif #ifndef IMGUI_DISABLE //----------------------------------------------------------------------------- // Header mess //----------------------------------------------------------------------------- // Includes #include <float.h> // FLT_MIN, FLT_MAX #include <stdarg.h> // va_list, va_start, va_end #include <stddef.h> // ptrdiff_t, NULL #include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp // Version // (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens) #define IMGUI_VERSION "1.79 WIP" #define IMGUI_VERSION_NUM 17803 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) #define IMGUI_HAS_VIEWPORT 1 // Viewport WIP branch #define IMGUI_HAS_DOCK 1 // Docking WIP branch // Define attributes of all API symbols declarations (e.g. for DLL under Windows) // IMGUI_API is used for core imgui functions, IMGUI_IMPL_API is used for the default bindings files (imgui_impl_xxx.h) // Using dear imgui via a shared library is not recommended, because we don't guarantee backward nor forward ABI compatibility (also function call overhead, as dear imgui is a call-heavy API) #ifndef IMGUI_API #define IMGUI_API #endif #ifndef IMGUI_IMPL_API #define IMGUI_IMPL_API IMGUI_API #endif // Helper Macros #ifndef IM_ASSERT #include <assert.h> #define IM_ASSERT(_EXPR) assert(_EXPR) // You can override the default assert handler by editing imconfig.h #endif #if !defined(IMGUI_USE_STB_SPRINTF) && (defined(__clang__) || defined(__GNUC__)) #define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1))) // To apply printf-style warnings to our functions. #define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0))) #else #define IM_FMTARGS(FMT) #define IM_FMTLIST(FMT) #endif #define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*(_ARR)))) // Size of a static C-style array. Don't use on pointers! #define IM_UNUSED(_VAR) ((void)(_VAR)) // Used to silence "unused variable warnings". Often useful as asserts may be stripped out from final builds. #if (__cplusplus >= 201100) #define IM_OFFSETOF(_TYPE,_MEMBER) offsetof(_TYPE, _MEMBER) // Offset of _MEMBER within _TYPE. Standardized as offsetof() in C++11 #else #define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) // Offset of _MEMBER within _TYPE. Old style macro. #endif // Warnings #if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wold-style-cast" #if __has_warning("-Wzero-as-null-pointer-constant") #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" #endif #elif defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind #pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead #endif //----------------------------------------------------------------------------- // Forward declarations and basic types //----------------------------------------------------------------------------- // Forward declarations struct ImDrawChannel; // Temporary storage to output draw commands out of order, used by ImDrawListSplitter and ImDrawList::ChannelsSplit() struct ImDrawCmd; // A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call, unless it is a callback) struct ImDrawData; // All draw command lists required to render the frame + pos/size coordinates to use for the projection matrix. struct ImDrawList; // A single draw command list (generally one per window, conceptually you may see this as a dynamic "mesh" builder) struct ImDrawListSharedData; // Data shared among multiple draw lists (typically owned by parent ImGui context, but you may create one yourself) struct ImDrawListSplitter; // Helper to split a draw list into different layers which can be drawn into out of order, then flattened back. struct ImDrawVert; // A single vertex (pos + uv + col = 20 bytes by default. Override layout with IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT) struct ImFont; // Runtime data for a single font within a parent ImFontAtlas struct ImFontAtlas; // Runtime data for multiple fonts, bake multiple fonts into a single texture, TTF/OTF font loader struct ImFontConfig; // Configuration data when adding a font or merging fonts struct ImFontGlyph; // A single font glyph (code point + coordinates within in ImFontAtlas + offset) struct ImFontGlyphRangesBuilder; // Helper to build glyph ranges from text/string data struct ImColor; // Helper functions to create a color that can be converted to either u32 or float4 (*OBSOLETE* please avoid using) struct ImGuiContext; // Dear ImGui context (opaque structure, unless including imgui_internal.h) struct ImGuiIO; // Main configuration and I/O between your application and ImGui struct ImGuiInputTextCallbackData; // Shared state of InputText() when using custom ImGuiInputTextCallback (rare/advanced use) struct ImGuiListClipper; // Helper to manually clip large list of items struct ImGuiOnceUponAFrame; // Helper for running a block of code not more than once a frame, used by IMGUI_ONCE_UPON_A_FRAME macro struct ImGuiPayload; // User data payload for drag and drop operations struct ImGuiPlatformIO; // Multi-viewport support: interface for Platform/Renderer back-ends + viewports to render struct ImGuiPlatformMonitor; // Multi-viewport support: user-provided bounds for each connected monitor/display. Used when positioning popups and tooltips to avoid them straddling monitors struct ImGuiSizeCallbackData; // Callback data when using SetNextWindowSizeConstraints() (rare/advanced use) struct ImGuiStorage; // Helper for key->value storage struct ImGuiStyle; // Runtime data for styling/colors struct ImGuiTextBuffer; // Helper to hold and append into a text buffer (~string builder) struct ImGuiTextFilter; // Helper to parse and apply text filters (e.g. "aaaaa[,bbbbb][,ccccc]") struct ImGuiViewport; // Viewport (generally ~1 per window to output to at the OS level. Need per-platform support to use multiple viewports) struct ImGuiWindowClass; // Window class (rare/advanced uses: provide hints to the platform back-end via altered viewport flags and parent/child info) // Enums/Flags (declared as int for compatibility with old C++, to allow using as flags and to not pollute the top of this file) // - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists! // In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. // With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments. typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color identifier for styling typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A condition for many Set*() functions typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type typedef int ImGuiDir; // -> enum ImGuiDir_ // Enum: A cardinal direction typedef int ImGuiKey; // -> enum ImGuiKey_ // Enum: A key identifier (ImGui-side enum) typedef int ImGuiNavInput; // -> enum ImGuiNavInput_ // Enum: An input identifier for navigation typedef int ImGuiMouseButton; // -> enum ImGuiMouseButton_ // Enum: A mouse button identifier (0=left, 1=right, 2=middle) typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse cursor identifier typedef int ImGuiStyleVar; // -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling typedef int ImDrawCornerFlags; // -> enum ImDrawCornerFlags_ // Flags: for ImDrawList::AddRect(), AddRectFilled() etc. typedef int ImDrawListFlags; // -> enum ImDrawListFlags_ // Flags: for ImDrawList typedef int ImFontAtlasFlags; // -> enum ImFontAtlasFlags_ // Flags: for ImFontAtlas build typedef int ImGuiBackendFlags; // -> enum ImGuiBackendFlags_ // Flags: for io.BackendFlags typedef int ImGuiButtonFlags; // -> enum ImGuiButtonFlags_ // Flags: for InvisibleButton() typedef int ImGuiColorEditFlags; // -> enum ImGuiColorEditFlags_ // Flags: for ColorEdit4(), ColorPicker4() etc. typedef int ImGuiConfigFlags; // -> enum ImGuiConfigFlags_ // Flags: for io.ConfigFlags typedef int ImGuiComboFlags; // -> enum ImGuiComboFlags_ // Flags: for BeginCombo() typedef int ImGuiDockNodeFlags; // -> enum ImGuiDockNodeFlags_ // Flags: for DockSpace() typedef int ImGuiDragDropFlags; // -> enum ImGuiDragDropFlags_ // Flags: for BeginDragDropSource(), AcceptDragDropPayload() typedef int ImGuiFocusedFlags; // -> enum ImGuiFocusedFlags_ // Flags: for IsWindowFocused() typedef int ImGuiHoveredFlags; // -> enum ImGuiHoveredFlags_ // Flags: for IsItemHovered(), IsWindowHovered() etc. typedef int ImGuiInputTextFlags; // -> enum ImGuiInputTextFlags_ // Flags: for InputText(), InputTextMultiline() typedef int ImGuiKeyModFlags; // -> enum ImGuiKeyModFlags_ // Flags: for io.KeyMods (Ctrl/Shift/Alt/Super) typedef int ImGuiPopupFlags; // -> enum ImGuiPopupFlags_ // Flags: for OpenPopup*(), BeginPopupContext*(), IsPopupOpen() typedef int ImGuiSelectableFlags; // -> enum ImGuiSelectableFlags_ // Flags: for Selectable() typedef int ImGuiSliderFlags; // -> enum ImGuiSliderFlags_ // Flags: for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc. typedef int ImGuiTabBarFlags; // -> enum ImGuiTabBarFlags_ // Flags: for BeginTabBar() typedef int ImGuiTabItemFlags; // -> enum ImGuiTabItemFlags_ // Flags: for BeginTabItem() typedef int ImGuiTreeNodeFlags; // -> enum ImGuiTreeNodeFlags_ // Flags: for TreeNode(), TreeNodeEx(), CollapsingHeader() typedef int ImGuiViewportFlags; // -> enum ImGuiViewportFlags_ // Flags: for ImGuiViewport typedef int ImGuiWindowFlags; // -> enum ImGuiWindowFlags_ // Flags: for Begin(), BeginChild() // Other types #ifndef ImTextureID // ImTextureID [configurable type: override in imconfig.h with '#define ImTextureID xxx'] typedef void* ImTextureID; // User data for rendering back-end to identify a texture. This is whatever to you want it to be! read the FAQ about ImTextureID for details. #endif typedef unsigned int ImGuiID; // A unique ID used by widgets, typically hashed from a stack of string. typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData* data); typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); // Decoded character types // (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display) typedef unsigned short ImWchar16; // A single decoded U16 character/code point. We encode them as multi bytes UTF-8 when used in strings. typedef unsigned int ImWchar32; // A single decoded U32 character/code point. We encode them as multi bytes UTF-8 when used in strings. #ifdef IMGUI_USE_WCHAR32 // ImWchar [configurable type: override in imconfig.h with '#define IMGUI_USE_WCHAR32' to support Unicode planes 1-16] typedef ImWchar32 ImWchar; #else typedef ImWchar16 ImWchar; #endif // Basic scalar data types typedef signed char ImS8; // 8-bit signed integer typedef unsigned char ImU8; // 8-bit unsigned integer typedef signed short ImS16; // 16-bit signed integer typedef unsigned short ImU16; // 16-bit unsigned integer typedef signed int ImS32; // 32-bit signed integer == int typedef unsigned int ImU32; // 32-bit unsigned integer (often used to store packed colors) #if defined(_MSC_VER) && !defined(__clang__) typedef signed __int64 ImS64; // 64-bit signed integer (pre and post C++11 with Visual Studio) typedef unsigned __int64 ImU64; // 64-bit unsigned integer (pre and post C++11 with Visual Studio) #elif (defined(__clang__) || defined(__GNUC__)) && (__cplusplus < 201100) #include <stdint.h> typedef int64_t ImS64; // 64-bit signed integer (pre C++11) typedef uint64_t ImU64; // 64-bit unsigned integer (pre C++11) #else typedef signed long long ImS64; // 64-bit signed integer (post C++11) typedef unsigned long long ImU64; // 64-bit unsigned integer (post C++11) #endif // 2D vector (often used to store positions or sizes) struct ImVec2 { float x, y; ImVec2() { x = y = 0.0f; } ImVec2(float _x, float _y) { x = _x; y = _y; } float operator[] (size_t idx) const { IM_ASSERT(idx <= 1); return (&x)[idx]; } // We very rarely use this [] operator, the assert overhead is fine. float& operator[] (size_t idx) { IM_ASSERT(idx <= 1); return (&x)[idx]; } // We very rarely use this [] operator, the assert overhead is fine. #ifdef IM_VEC2_CLASS_EXTRA IM_VEC2_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec2. #endif }; // 4D vector (often used to store floating-point colors) struct ImVec4 { float x, y, z, w; ImVec4() { x = y = z = w = 0.0f; } ImVec4(float _x, float _y, float _z, float _w) { x = _x; y = _y; z = _z; w = _w; } #ifdef IM_VEC4_CLASS_EXTRA IM_VEC4_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec4. #endif }; //----------------------------------------------------------------------------- // ImGui: Dear ImGui end-user API // (This is a namespace. You can add extra ImGui:: functions in your own separate file. Please don't modify imgui source files!) //----------------------------------------------------------------------------- namespace ImGui { // Context creation and access // Each context create its own ImFontAtlas by default. You may instance one yourself and pass it to CreateContext() to share a font atlas between imgui contexts. // None of those functions is reliant on the current context. IMGUI_API ImGuiContext* CreateContext(ImFontAtlas* shared_font_atlas = NULL); IMGUI_API void DestroyContext(ImGuiContext* ctx = NULL); // NULL = destroy current context IMGUI_API ImGuiContext* GetCurrentContext(); IMGUI_API void SetCurrentContext(ImGuiContext* ctx); // Main IMGUI_API ImGuiIO& GetIO(); // access the IO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags) IMGUI_API ImGuiStyle& GetStyle(); // access the Style structure (colors, sizes). Always use PushStyleCol(), PushStyleVar() to modify style mid-frame! IMGUI_API void NewFrame(); // start a new Dear ImGui frame, you can submit any command from this point until Render()/EndFrame(). IMGUI_API void EndFrame(); // ends the Dear ImGui frame. automatically called by Render(). If you don't need to render data (skipping rendering) you may call EndFrame() without Render()... but you'll have wasted CPU already! If you don't need to render, better to not create any windows and not call NewFrame() at all! IMGUI_API void Render(); // ends the Dear ImGui frame, finalize the draw data. You can get call GetDrawData() to obtain it and run your rendering function (up to v1.60, this used to call io.RenderDrawListsFn(). Nowadays, we allow and prefer calling your render function yourself.) IMGUI_API ImDrawData* GetDrawData(); // valid after Render() and until the next call to NewFrame(). this is what you have to render. // Demo, Debug, Information IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create Demo window (previously called ShowTestWindow). demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application! IMGUI_API void ShowAboutWindow(bool* p_open = NULL); // create About window. display Dear ImGui version, credits and build/system information. IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create Debug/Metrics window. display Dear ImGui internals: draw commands (with individual draw calls and vertices), window list, basic internal state, etc. IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style) IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles. IMGUI_API void ShowFontSelector(const char* label); // add font selector block (not a window), essentially a combo listing the loaded fonts. IMGUI_API void ShowUserGuide(); // add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls). IMGUI_API const char* GetVersion(); // get the compiled version string e.g. "1.23" (essentially the compiled value for IMGUI_VERSION) // Styles IMGUI_API void StyleColorsDark(ImGuiStyle* dst = NULL); // new, recommended style (default) IMGUI_API void StyleColorsClassic(ImGuiStyle* dst = NULL); // classic imgui style IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL); // best used with borders and a custom, thicker font // Windows // - Begin() = push window to the stack and start appending to it. End() = pop window from the stack. // - Passing 'bool* p_open != NULL' shows a window-closing widget in the upper-right corner of the window, // which clicking will set the boolean to false when clicked. // - You may append multiple times to the same window during the same frame by calling Begin()/End() pairs multiple times. // Some information such as 'flags' or 'p_open' will only be considered by the first call to Begin(). // - Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting // anything to the window. Always call a matching End() for each Begin() call, regardless of its return value! // [Important: due to legacy reason, this is inconsistent with most other functions such as BeginMenu/EndMenu, // BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function // returned true. Begin and BeginChild are the only odd ones out. Will be fixed in a future update.] // - Note that the bottom of window stack always contains a window called "Debug". IMGUI_API bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); IMGUI_API void End(); // Child Windows // - Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window. Child windows can embed their own child. // - For each independent axis of 'size': ==0.0f: use remaining host window size / >0.0f: fixed size / <0.0f: use remaining window size minus abs(size) / Each axis can use a different mode, e.g. ImVec2(0,400). // - BeginChild() returns false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window. // Always call a matching EndChild() for each BeginChild() call, regardless of its return value [as with Begin: this is due to legacy reason and inconsistent with most BeginXXX functions apart from the regular Begin() which behaves like BeginChild().] IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags flags = 0); IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags flags = 0); IMGUI_API void EndChild(); // Windows Utilities // - 'current window' = the window we are appending into while inside a Begin()/End() block. 'next window' = next window we will Begin() into. IMGUI_API bool IsWindowAppearing(); IMGUI_API bool IsWindowCollapsed(); IMGUI_API bool IsWindowFocused(ImGuiFocusedFlags flags=0); // is current window focused? or its root/child, depending on flags. see flags for options. IMGUI_API bool IsWindowHovered(ImGuiHoveredFlags flags=0); // is current window hovered (and typically: not blocked by a popup/modal)? see flags for options. NB: If you are trying to check whether your mouse should be dispatched to imgui or to your app, you should use the 'io.WantCaptureMouse' boolean for that! Please read the FAQ! IMGUI_API ImDrawList* GetWindowDrawList(); // get draw list associated to the current window, to append your own drawing primitives IMGUI_API float GetWindowDpiScale(); // get DPI scale currently associated to the current window's viewport. IMGUI_API ImGuiViewport*GetWindowViewport(); // get viewport currently associated to the current window. IMGUI_API ImVec2 GetWindowPos(); // get current window position in screen space (useful if you want to do your own drawing via the DrawList API) IMGUI_API ImVec2 GetWindowSize(); // get current window size IMGUI_API float GetWindowWidth(); // get current window width (shortcut for GetWindowSize().x) IMGUI_API float GetWindowHeight(); // get current window height (shortcut for GetWindowSize().y) // Prefer using SetNextXXX functions (before Begin) rather that SetXXX functions (after Begin). IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiCond cond = 0, const ImVec2& pivot = ImVec2(0, 0)); // set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc. IMGUI_API void SetNextWindowSize(const ImVec2& size, ImGuiCond cond = 0); // set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin() IMGUI_API void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback = NULL, void* custom_callback_data = NULL); // set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down. Use callback to apply non-trivial programmatic constraints. IMGUI_API void SetNextWindowContentSize(const ImVec2& size); // set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. set an axis to 0.0f to leave it automatic. call before Begin() IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // set next window collapsed state. call before Begin() IMGUI_API void SetNextWindowFocus(); // set next window to be focused / top-most. call before Begin() IMGUI_API void SetNextWindowBgAlpha(float alpha); // set next window background color alpha. helper to easily override the Alpha component of ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground. IMGUI_API void SetNextWindowViewport(ImGuiID viewport_id); // set next window viewport IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiCond cond = 0); // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects. IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0, 0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects. IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed(). IMGUI_API void SetWindowFocus(); // (not recommended) set current window to be focused / top-most. prefer using SetNextWindowFocus(). IMGUI_API void SetWindowFontScale(float scale); // set font scale. Adjust IO.FontGlobalScale if you want to scale all windows. This is an old API! For correct scaling, prefer to reload font + rebuild ImFontAtlas + call style.ScaleAllSizes(). IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiCond cond = 0); // set named window position. IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiCond cond = 0); // set named window size. set axis to 0.0f to force an auto-fit on this axis. IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond = 0); // set named window collapsed state IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / top-most. use NULL to remove focus. // Content region // - Those functions are bound to be redesigned soon (they are confusing, incomplete and return values in local window coordinates which increases confusion) IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates IMGUI_API ImVec2 GetContentRegionAvail(); // == GetContentRegionMax() - GetCursorPos() IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min (roughly (0,0)-Scroll), in window coordinates IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates IMGUI_API float GetWindowContentRegionWidth(); // // Windows Scrolling IMGUI_API float GetScrollX(); // get scrolling amount [0..GetScrollMaxX()] IMGUI_API float GetScrollY(); // get scrolling amount [0..GetScrollMaxY()] IMGUI_API float GetScrollMaxX(); // get maximum scrolling amount ~~ ContentSize.x - WindowSize.x IMGUI_API float GetScrollMaxY(); // get maximum scrolling amount ~~ ContentSize.y - WindowSize.y IMGUI_API void SetScrollX(float scroll_x); // set scrolling amount [0..GetScrollMaxX()] IMGUI_API void SetScrollY(float scroll_y); // set scrolling amount [0..GetScrollMaxY()] IMGUI_API void SetScrollHereX(float center_x_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_x_ratio=0.0: left, 0.5: center, 1.0: right. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead. IMGUI_API void SetScrollHereY(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead. IMGUI_API void SetScrollFromPosX(float local_x, float center_x_ratio = 0.5f); // adjust scrolling amount to make given position visible. Generally GetCursorStartPos() + offset to compute a valid position. IMGUI_API void SetScrollFromPosY(float local_y, float center_y_ratio = 0.5f); // adjust scrolling amount to make given position visible. Generally GetCursorStartPos() + offset to compute a valid position. // Parameters stacks (shared) IMGUI_API void PushFont(ImFont* font); // use NULL as a shortcut to push default font IMGUI_API void PopFont(); IMGUI_API void PushStyleColor(ImGuiCol idx, ImU32 col); IMGUI_API void PushStyleColor(ImGuiCol idx, const ImVec4& col); IMGUI_API void PopStyleColor(int count = 1); IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val); IMGUI_API void PushStyleVar(ImGuiStyleVar idx, const ImVec2& val); IMGUI_API void PopStyleVar(int count = 1); IMGUI_API const ImVec4& GetStyleColorVec4(ImGuiCol idx); // retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(), otherwise use GetColorU32() to get style color with style alpha baked in. IMGUI_API ImFont* GetFont(); // get current font IMGUI_API float GetFontSize(); // get current font size (= height in pixels) of current font with current scale applied IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f); // retrieve given style color with style alpha applied and optional extra alpha multiplier IMGUI_API ImU32 GetColorU32(const ImVec4& col); // retrieve given color with style alpha applied IMGUI_API ImU32 GetColorU32(ImU32 col); // retrieve given color with style alpha applied // Parameters stacks (current window) IMGUI_API void PushItemWidth(float item_width); // push width of items for common large "item+label" widgets. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -1.0f always align width to the right side). 0.0f = default to ~2/3 of windows width, IMGUI_API void PopItemWidth(); IMGUI_API void SetNextItemWidth(float item_width); // set width of the _next_ common large "item+label" widget. >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -1.0f always align width to the right side) IMGUI_API float CalcItemWidth(); // width of item given pushed settings and current cursor position. NOT necessarily the width of last item unlike most 'Item' functions. IMGUI_API void PushTextWrapPos(float wrap_local_pos_x = 0.0f); // push word-wrapping position for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space IMGUI_API void PopTextWrapPos(); IMGUI_API void PushAllowKeyboardFocus(bool allow_keyboard_focus); // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets IMGUI_API void PopAllowKeyboardFocus(); IMGUI_API void PushButtonRepeat(bool repeat); // in 'repeat' mode, Button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call IsItemActive() after any Button() to tell if the button is held in the current frame. IMGUI_API void PopButtonRepeat(); // Cursor / Layout // - By "cursor" we mean the current output position. // - The typical widget behavior is to output themselves at the current cursor position, then move the cursor one line down. // - You can call SameLine() between widgets to undo the last carriage return and output at the right of the preceding widget. // - Attention! We currently have inconsistencies between window-local and absolute positions we will aim to fix with future API: // Window-local coordinates: SameLine(), GetCursorPos(), SetCursorPos(), GetCursorStartPos(), GetContentRegionMax(), GetWindowContentRegion*(), PushTextWrapPos() // Absolute coordinate: GetCursorScreenPos(), SetCursorScreenPos(), all ImDrawList:: functions. IMGUI_API void Separator(); // separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator. IMGUI_API void SameLine(float offset_from_start_x=0.0f, float spacing=-1.0f); // call between widgets or groups to layout them horizontally. X position given in window coordinates. IMGUI_API void NewLine(); // undo a SameLine() or force a new line when in an horizontal-layout context. IMGUI_API void Spacing(); // add vertical spacing. IMGUI_API void Dummy(const ImVec2& size); // add a dummy item of given size. unlike InvisibleButton(), Dummy() won't take the mouse click or be navigable into. IMGUI_API void Indent(float indent_w = 0.0f); // move content position toward the right, by style.IndentSpacing or indent_w if != 0 IMGUI_API void Unindent(float indent_w = 0.0f); // move content position back to the left, by style.IndentSpacing or indent_w if != 0 IMGUI_API void BeginGroup(); // lock horizontal starting position IMGUI_API void EndGroup(); // unlock horizontal starting position + capture the whole group bounding box into one "item" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.) IMGUI_API ImVec2 GetCursorPos(); // cursor position in window coordinates (relative to window position) IMGUI_API float GetCursorPosX(); // (some functions are using window-relative coordinates, such as: GetCursorPos, GetCursorStartPos, GetContentRegionMax, GetWindowContentRegion* etc. IMGUI_API float GetCursorPosY(); // other functions such as GetCursorScreenPos or everything in ImDrawList:: IMGUI_API void SetCursorPos(const ImVec2& local_pos); // are using the main, absolute coordinate system. IMGUI_API void SetCursorPosX(float local_x); // GetWindowPos() + GetCursorPos() == GetCursorScreenPos() etc.) IMGUI_API void SetCursorPosY(float local_y); // IMGUI_API ImVec2 GetCursorStartPos(); // initial cursor position in window coordinates IMGUI_API ImVec2 GetCursorScreenPos(); // cursor position in absolute screen coordinates (0..io.DisplaySize) or natural OS coordinates when using multiple viewport. Useful to work with ImDrawList API. IMGUI_API void SetCursorScreenPos(const ImVec2& pos); // cursor position in absolute screen coordinates (0..io.DisplaySize) or natural OS coordinates when using multiple viewport. IMGUI_API void AlignTextToFramePadding(); // vertically align upcoming text baseline to FramePadding.y so that it will align properly to regularly framed items (call if you have text on a line before a framed item) IMGUI_API float GetTextLineHeight(); // ~ FontSize IMGUI_API float GetTextLineHeightWithSpacing(); // ~ FontSize + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of text) IMGUI_API float GetFrameHeight(); // ~ FontSize + style.FramePadding.y * 2 IMGUI_API float GetFrameHeightWithSpacing(); // ~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets) // ID stack/scopes // - Read the FAQ for more details about how ID are handled in dear imgui. If you are creating widgets in a loop you most // likely want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them. // - The resulting ID are hashes of the entire stack. // - You can also use the "Label##foobar" syntax within widget label to distinguish them from each others. // - In this header file we use the "label"/"name" terminology to denote a string that will be displayed and used as an ID, // whereas "str_id" denote a string that is only used as an ID and not normally displayed. IMGUI_API void PushID(const char* str_id); // push string into the ID stack (will hash string). IMGUI_API void PushID(const char* str_id_begin, const char* str_id_end); // push string into the ID stack (will hash string). IMGUI_API void PushID(const void* ptr_id); // push pointer into the ID stack (will hash pointer). IMGUI_API void PushID(int int_id); // push integer into the ID stack (will hash integer). IMGUI_API void PopID(); // pop from the ID stack. IMGUI_API ImGuiID GetID(const char* str_id); // calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself IMGUI_API ImGuiID GetID(const char* str_id_begin, const char* str_id_end); IMGUI_API ImGuiID GetID(const void* ptr_id); // Widgets: Text IMGUI_API void TextUnformatted(const char* text, const char* text_end = NULL); // raw text without formatting. Roughly equivalent to Text("%s", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text. IMGUI_API void Text(const char* fmt, ...) IM_FMTARGS(1); // formatted text IMGUI_API void TextV(const char* fmt, va_list args) IM_FMTLIST(1); IMGUI_API void TextColored(const ImVec4& col, const char* fmt, ...) IM_FMTARGS(2); // shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor(); IMGUI_API void TextColoredV(const ImVec4& col, const char* fmt, va_list args) IM_FMTLIST(2); IMGUI_API void TextDisabled(const char* fmt, ...) IM_FMTARGS(1); // shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); Text(fmt, ...); PopStyleColor(); IMGUI_API void TextDisabledV(const char* fmt, va_list args) IM_FMTLIST(1); IMGUI_API void TextWrapped(const char* fmt, ...) IM_FMTARGS(1); // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();. Note that this won't work on an auto-resizing window if there's no other widgets to extend the window width, yoy may need to set a size using SetNextWindowSize(). IMGUI_API void TextWrappedV(const char* fmt, va_list args) IM_FMTLIST(1); IMGUI_API void LabelText(const char* label, const char* fmt, ...) IM_FMTARGS(2); // display text+label aligned the same way as value+label widgets IMGUI_API void LabelTextV(const char* label, const char* fmt, va_list args) IM_FMTLIST(2); IMGUI_API void BulletText(const char* fmt, ...) IM_FMTARGS(1); // shortcut for Bullet()+Text() IMGUI_API void BulletTextV(const char* fmt, va_list args) IM_FMTLIST(1); // Widgets: Main // - Most widgets return true when the value has been changed or when pressed/selected // - You may also use one of the many IsItemXXX functions (e.g. IsItemActive, IsItemHovered, etc.) to query widget state. IMGUI_API bool Button(const char* label, const ImVec2& size = ImVec2(0, 0)); // button IMGUI_API bool SmallButton(const char* label); // button with FramePadding=(0,0) to easily embed within text IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size, ImGuiButtonFlags flags = 0); // flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.) IMGUI_API bool ArrowButton(const char* str_id, ImGuiDir dir); // square button with an arrow shape IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0)); IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,0), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no padding IMGUI_API bool Checkbox(const char* label, bool* v); IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value); IMGUI_API bool RadioButton(const char* label, bool active); // use with e.g. if (RadioButton("one", my_value==1)) { my_value = 1; } IMGUI_API bool RadioButton(const char* label, int* v, int v_button); // shortcut to handle the above pattern when value is an integer IMGUI_API void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-1, 0), const char* overlay = NULL); IMGUI_API void Bullet(); // draw a small circle + keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses // Widgets: Combo Box // - The BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items. // - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. IMGUI_API bool BeginCombo(const char* label, const char* preview_value, ImGuiComboFlags flags = 0); IMGUI_API void EndCombo(); // only call EndCombo() if BeginCombo() returns true! IMGUI_API bool Combo(const char* label, int* current_item, const char* const items[], int items_count, int popup_max_height_in_items = -1); IMGUI_API bool Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int popup_max_height_in_items = -1); // Separate items with \0 within a string, end item-list with \0\0. e.g. "One\0Two\0Three\0" IMGUI_API bool Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int popup_max_height_in_items = -1); // Widgets: Drag Sliders // - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped and can go off-bounds. // - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x // - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc. // - Format string may also be set to NULL or use the default format ("%f" or "%d"). // - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision). // - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits. // - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum. // - We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them. // - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument. // If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361 IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0); // If v_min >= v_max we have no bound IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0); IMGUI_API bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0); IMGUI_API bool DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0); IMGUI_API bool DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", const char* format_max = NULL, ImGuiSliderFlags flags = 0); IMGUI_API bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", ImGuiSliderFlags flags = 0); // If v_min >= v_max we have no bound IMGUI_API bool DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", ImGuiSliderFlags flags = 0); IMGUI_API bool DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", ImGuiSliderFlags flags = 0); IMGUI_API bool DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", ImGuiSliderFlags flags = 0); IMGUI_API bool DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", const char* format_max = NULL, ImGuiSliderFlags flags = 0); IMGUI_API bool DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiSliderFlags flags = 0); IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiSliderFlags flags = 0); // Widgets: Regular Sliders // - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped and can go off-bounds. // - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc. // - Format string may also be set to NULL or use the default format ("%f" or "%d"). // - Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument. // If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361 IMGUI_API bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0); // adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display. IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0); IMGUI_API bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0); IMGUI_API bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0); IMGUI_API bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f, const char* format = "%.0f deg", ImGuiSliderFlags flags = 0); IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0); IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0); IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0); IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0); IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format = NULL, ImGuiSliderFlags flags = 0); IMGUI_API bool SliderScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_min, const void* p_max, const char* format = NULL, ImGuiSliderFlags flags = 0); IMGUI_API bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0); IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0); IMGUI_API bool VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format = NULL, ImGuiSliderFlags flags = 0); // Widgets: Input with Keyboard // - If you want to use InputText() with std::string or any custom dynamic string type, see misc/cpp/imgui_stdlib.h and comments in imgui_demo.cpp. // - Most of the ImGuiInputTextFlags flags are only useful for InputText() and not for InputFloatX, InputIntX, InputDouble etc. IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); IMGUI_API bool InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); IMGUI_API bool InputTextWithHint(const char* label, const char* hint, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, const char* format = "%.3f", ImGuiInputTextFlags flags = 0); IMGUI_API bool InputFloat2(const char* label, float v[2], const char* format = "%.3f", ImGuiInputTextFlags flags = 0); IMGUI_API bool InputFloat3(const char* label, float v[3], const char* format = "%.3f", ImGuiInputTextFlags flags = 0); IMGUI_API bool InputFloat4(const char* label, float v[4], const char* format = "%.3f", ImGuiInputTextFlags flags = 0); IMGUI_API bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags flags = 0); IMGUI_API bool InputInt2(const char* label, int v[2], ImGuiInputTextFlags flags = 0); IMGUI_API bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags flags = 0); IMGUI_API bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags flags = 0); IMGUI_API bool InputDouble(const char* label, double* v, double step = 0.0, double step_fast = 0.0, const char* format = "%.6f", ImGuiInputTextFlags flags = 0); IMGUI_API bool InputScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_step = NULL, const void* p_step_fast = NULL, const char* format = NULL, ImGuiInputTextFlags flags = 0); IMGUI_API bool InputScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_step = NULL, const void* p_step_fast = NULL, const char* format = NULL, ImGuiInputTextFlags flags = 0); // Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little colored preview square that can be left-clicked to open a picker, and right-clicked to open an option menu.) // - Note that in C++ a 'float v[X]' function argument is the _same_ as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. // - You can pass the address of a first float element out of a contiguous structure, e.g. &myvector.x IMGUI_API bool ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flags = 0); IMGUI_API bool ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0); IMGUI_API bool ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags = 0); IMGUI_API bool ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags = 0, const float* ref_col = NULL); IMGUI_API bool ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0, 0)); // display a colored square/button, hover for details, return true when pressed. IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags); // initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls. // Widgets: Trees // - TreeNode functions return true when the node is open, in which case you need to also call TreePop() when you are finished displaying the tree node contents. IMGUI_API bool TreeNode(const char* label); IMGUI_API bool TreeNode(const char* str_id, const char* fmt, ...) IM_FMTARGS(2); // helper variation to easily decorelate the id from the displayed string. Read the FAQ about why and how to use ID. to align arbitrary text at the same level as a TreeNode() you can use Bullet(). IMGUI_API bool TreeNode(const void* ptr_id, const char* fmt, ...) IM_FMTARGS(2); // " IMGUI_API bool TreeNodeV(const char* str_id, const char* fmt, va_list args) IM_FMTLIST(2); IMGUI_API bool TreeNodeV(const void* ptr_id, const char* fmt, va_list args) IM_FMTLIST(2); IMGUI_API bool TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags = 0); IMGUI_API bool TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(3); IMGUI_API bool TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(3); IMGUI_API bool TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3); IMGUI_API bool TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3); IMGUI_API void TreePush(const char* str_id); // ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call TreePush/TreePop yourself if desired. IMGUI_API void TreePush(const void* ptr_id = NULL); // " IMGUI_API void TreePop(); // ~ Unindent()+PopId() IMGUI_API float GetTreeNodeToLabelSpacing(); // horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode IMGUI_API bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0); // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop(). IMGUI_API bool CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags = 0); // when 'p_open' isn't NULL, display an additional small close button on upper right of the header IMGUI_API void SetNextItemOpen(bool is_open, ImGuiCond cond = 0); // set next TreeNode/CollapsingHeader open state. // Widgets: Selectables // - A selectable highlights when hovered, and can display another color when selected. // - Neighbors selectable extend their highlight bounds in order to leave no gap between them. This is so a series of selected Selectable appear contiguous. IMGUI_API bool Selectable(const char* label, bool selected = false, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0)); // "bool selected" carry the selection state (read-only). Selectable() is clicked is returns true so you can modify your selection state. size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height IMGUI_API bool Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0)); // "bool* p_selected" point to the selection state (read-write), as a convenient helper. // Widgets: List Boxes // - FIXME: To be consistent with all the newer API, ListBoxHeader/ListBoxFooter should in reality be called BeginListBox/EndListBox. Will rename them. IMGUI_API bool ListBox(const char* label, int* current_item, const char* const items[], int items_count, int height_in_items = -1); IMGUI_API bool ListBox(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1); IMGUI_API bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0)); // use if you want to reimplement ListBox() will custom data or interactions. if the function return true, you can output elements then call ListBoxFooter() afterwards. IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // " IMGUI_API void ListBoxFooter(); // terminate the scrolling region. only call ListBoxFooter() if ListBoxHeader() returned true! // Widgets: Data Plotting IMGUI_API void PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float)); IMGUI_API void PlotLines(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0)); IMGUI_API void PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float)); IMGUI_API void PlotHistogram(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0)); // Widgets: Value() Helpers. // - Those are merely shortcut to calling Text() with a format string. Output single value in "name: value" format (tip: freely declare more in your code to handle your types. you can add functions to the ImGui namespace) IMGUI_API void Value(const char* prefix, bool b); IMGUI_API void Value(const char* prefix, int v); IMGUI_API void Value(const char* prefix, unsigned int v); IMGUI_API void Value(const char* prefix, float v, const char* float_format = NULL); // Widgets: Menus // - Use BeginMenuBar() on a window ImGuiWindowFlags_MenuBar to append to its menu bar. // - Use BeginMainMenuBar() to create a menu bar at the top of the screen and append to it. // - Use BeginMenu() to create a menu. You can call BeginMenu() multiple time with the same identifier to append more items to it. IMGUI_API bool BeginMenuBar(); // append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set on parent window). IMGUI_API void EndMenuBar(); // only call EndMenuBar() if BeginMenuBar() returns true! IMGUI_API bool BeginMainMenuBar(); // create and append to a full screen menu-bar. IMGUI_API void EndMainMenuBar(); // only call EndMainMenuBar() if BeginMainMenuBar() returns true! IMGUI_API bool BeginMenu(const char* label, bool enabled = true); // create a sub-menu entry. only call EndMenu() if this returns true! IMGUI_API void EndMenu(); // only call EndMenu() if BeginMenu() returns true! IMGUI_API bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true); // return true when activated. shortcuts are displayed for convenience but not processed by ImGui at the moment IMGUI_API bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true); // return true when activated + toggle (*p_selected) if p_selected != NULL // Tooltips // - Tooltip are windows following the mouse which do not take focus away. IMGUI_API void BeginTooltip(); // begin/append a tooltip window. to create full-featured tooltip (with any kind of items). IMGUI_API void EndTooltip(); IMGUI_API void SetTooltip(const char* fmt, ...) IM_FMTARGS(1); // set a text-only tooltip, typically use with ImGui::IsItemHovered(). override any previous call to SetTooltip(). IMGUI_API void SetTooltipV(const char* fmt, va_list args) IM_FMTLIST(1); // Popups, Modals // - They block normal mouse hovering detection (and therefore most mouse interactions) behind them. // - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE. // - Their visibility state (~bool) is held internally instead of being held by the programmer as we are used to with regular Begin*() calls. // - The 3 properties above are related: we need to retain popup visibility state in the library because popups may be closed as any time. // - You can bypass the hovering restriction by using ImGuiHoveredFlags_AllowWhenBlockedByPopup when calling IsItemHovered() or IsWindowHovered(). // - IMPORTANT: Popup identifiers are relative to the current ID stack, so OpenPopup and BeginPopup generally needs to be at the same level of the stack. // This is sometimes leading to confusing mistakes. May rework this in the future. // Popups: begin/end functions // - BeginPopup(): query popup state, if open start appending into the window. Call EndPopup() afterwards. ImGuiWindowFlags are forwarded to the window. // - BeginPopupModal(): block every interactions behind the window, cannot be closed by user, add a dimming background, has a title bar. IMGUI_API bool BeginPopup(const char* str_id, ImGuiWindowFlags flags = 0); // return true if the popup is open, and you can start outputting to it. IMGUI_API bool BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); // return true if the modal is open, and you can start outputting to it. IMGUI_API void EndPopup(); // only call EndPopup() if BeginPopupXXX() returns true! // Popups: open/close functions // - OpenPopup(): set popup state to open. ImGuiPopupFlags are available for opening options. // - If not modal: they can be closed by clicking anywhere outside them, or by pressing ESCAPE. // - CloseCurrentPopup(): use inside the BeginPopup()/EndPopup() scope to close manually. // - CloseCurrentPopup() is called by default by Selectable()/MenuItem() when activated (FIXME: need some options). // - Use ImGuiPopupFlags_NoOpenOverExistingPopup to avoid opening a popup if there's already one at the same level. This is equivalent to e.g. testing for !IsAnyPopupOpen() prior to OpenPopup(). IMGUI_API void OpenPopup(const char* str_id, ImGuiPopupFlags popup_flags = 0); // call to mark popup as open (don't call every frame!). IMGUI_API void OpenPopupOnItemClick(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1); // helper to open popup when clicked on last item. return true when just opened. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors) IMGUI_API void CloseCurrentPopup(); // manually close the popup we have begin-ed into. // Popups: open+begin combined functions helpers // - Helpers to do OpenPopup+BeginPopup where the Open action is triggered by e.g. hovering an item and right-clicking. // - They are convenient to easily create context menus, hence the name. // - IMPORTANT: Notice that BeginPopupContextXXX takes ImGuiPopupFlags just like OpenPopup() and unlike BeginPopup(). For full consistency, we may add ImGuiWindowFlags to the BeginPopupContextXXX functions in the future. // - IMPORTANT: we exceptionally default their flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter, so if you add other flags remember to re-add the ImGuiPopupFlags_MouseButtonRight. IMGUI_API bool BeginPopupContextItem(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1); // open+begin popup when clicked on last item. if you can pass a NULL str_id only if the previous item had an id. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp! IMGUI_API bool BeginPopupContextWindow(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1);// open+begin popup when clicked on current window. IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1); // open+begin popup when clicked in void (where there are no windows). // Popups: test function // - IsPopupOpen(): return true if the popup is open at the current BeginPopup() level of the popup stack. // - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId: return true if any popup is open at the current BeginPopup() level of the popup stack. // - IsPopupOpen() with ImGuiPopupFlags_AnyPopupId + ImGuiPopupFlags_AnyPopupLevel: return true if any popup is open. IMGUI_API bool IsPopupOpen(const char* str_id, ImGuiPopupFlags flags = 0); // return true if the popup is open. // Columns // - You can also use SameLine(pos_x) to mimic simplified columns. // - The columns API is work-in-progress and rather lacking (columns are arguably the worst part of dear imgui at the moment!) // - There is a maximum of 64 columns. // - Currently working on new 'Tables' api which will replace columns around Q2 2020 (see GitHub #2957). IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border = true); IMGUI_API void NextColumn(); // next column, defaults to current row or next row if the current row is finished IMGUI_API int GetColumnIndex(); // get current column index IMGUI_API float GetColumnWidth(int column_index = -1); // get column width (in pixels). pass -1 to use current column IMGUI_API void SetColumnWidth(int column_index, float width); // set column width (in pixels). pass -1 to use current column IMGUI_API float GetColumnOffset(int column_index = -1); // get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetColumnsCount() inclusive. column 0 is typically 0.0f IMGUI_API void SetColumnOffset(int column_index, float offset_x); // set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column IMGUI_API int GetColumnsCount(); // Tab Bars, Tabs // Note: Tabs are automatically created by the docking system. Use this to create tab bars/tabs yourself without docking being involved. IMGUI_API bool BeginTabBar(const char* str_id, ImGuiTabBarFlags flags = 0); // create and append into a TabBar IMGUI_API void EndTabBar(); // only call EndTabBar() if BeginTabBar() returns true! IMGUI_API bool BeginTabItem(const char* label, bool* p_open = NULL, ImGuiTabItemFlags flags = 0); // create a Tab. Returns true if the Tab is selected. IMGUI_API void EndTabItem(); // only call EndTabItem() if BeginTabItem() returns true! IMGUI_API bool TabItemButton(const char* label, ImGuiTabItemFlags flags = 0); // create a Tab behaving like a button. return true when clicked. cannot be selected in the tab bar. IMGUI_API void SetTabItemClosed(const char* tab_or_docked_window_label); // notify TabBar or Docking system of a closed tab/window ahead (useful to reduce visual flicker on reorderable tab bars). For tab-bar: call after BeginTabBar() and before Tab submissions. Otherwise call with a window name. // Docking // [BETA API] Enable with io.ConfigFlags |= ImGuiConfigFlags_DockingEnable. // Note: You can use most Docking facilities without calling any API. You DO NOT need to call DockSpace() to use Docking! // - To dock windows: if io.ConfigDockingWithShift == false (default) drag window from their title bar. // - To dock windows: if io.ConfigDockingWithShift == true: hold SHIFT anywhere while moving windows. // About DockSpace: // - Use DockSpace() to create an explicit dock node _within_ an existing window. See Docking demo for details. // - DockSpace() needs to be submitted _before_ any window they can host. If you use a dockspace, submit it early in your app. IMGUI_API void DockSpace(ImGuiID id, const ImVec2& size = ImVec2(0, 0), ImGuiDockNodeFlags flags = 0, const ImGuiWindowClass* window_class = NULL); IMGUI_API ImGuiID DockSpaceOverViewport(ImGuiViewport* viewport = NULL, ImGuiDockNodeFlags flags = 0, const ImGuiWindowClass* window_class = NULL); IMGUI_API void SetNextWindowDockID(ImGuiID dock_id, ImGuiCond cond = 0); // set next window dock id (FIXME-DOCK) IMGUI_API void SetNextWindowClass(const ImGuiWindowClass* window_class); // set next window class (rare/advanced uses: provide hints to the platform back-end via altered viewport flags and parent/child info) IMGUI_API ImGuiID GetWindowDockID(); IMGUI_API bool IsWindowDocked(); // is current window docked into another window? // Logging/Capture // - All text output from the interface can be captured into tty/file/clipboard. By default, tree nodes are automatically opened during logging. IMGUI_API void LogToTTY(int auto_open_depth = -1); // start logging to tty (stdout) IMGUI_API void LogToFile(int auto_open_depth = -1, const char* filename = NULL); // start logging to file IMGUI_API void LogToClipboard(int auto_open_depth = -1); // start logging to OS clipboard IMGUI_API void LogFinish(); // stop logging (close file, etc.) IMGUI_API void LogButtons(); // helper to display buttons for logging to tty/file/clipboard IMGUI_API void LogText(const char* fmt, ...) IM_FMTARGS(1); // pass text data straight to log (without being displayed) // Drag and Drop // - [BETA API] API may evolve! // - If you stop calling BeginDragDropSource() the payload is preserved however it won't have a preview tooltip (we currently display a fallback "..." tooltip as replacement) IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0); // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource() IMGUI_API bool SetDragDropPayload(const char* type, const void* data, size_t sz, ImGuiCond cond = 0); // type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui. IMGUI_API void EndDragDropSource(); // only call EndDragDropSource() if BeginDragDropSource() returns true! IMGUI_API bool BeginDragDropTarget(); // call after submitting an item that may receive a payload. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget() IMGUI_API const ImGuiPayload* AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags = 0); // accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released. IMGUI_API void EndDragDropTarget(); // only call EndDragDropTarget() if BeginDragDropTarget() returns true! IMGUI_API const ImGuiPayload* GetDragDropPayload(); // peek directly into the current payload from anywhere. may return NULL. use ImGuiPayload::IsDataType() to test for the payload type. // Clipping IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect); IMGUI_API void PopClipRect(); // Focus, Activation // - Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHereY()" when applicable to signify "this is the default item" IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window. IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget. // Item/Widgets Utilities // - Most of the functions are referring to the last/previous item we submitted. // - See Demo Window under "Widgets->Querying Status" for an interactive visualization of most of those functions. IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags = 0); // is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options. IMGUI_API bool IsItemActive(); // is the last item active? (e.g. button being held, text field being edited. This will continuously return true while holding mouse button on an item. Items that don't interact will always return false) IMGUI_API bool IsItemFocused(); // is the last item focused for keyboard/gamepad navigation? IMGUI_API bool IsItemClicked(ImGuiMouseButton mouse_button = 0); // is the last item clicked? (e.g. button/node just clicked on) == IsMouseClicked(mouse_button) && IsItemHovered() IMGUI_API bool IsItemVisible(); // is the last item visible? (items may be out of sight because of clipping/scrolling) IMGUI_API bool IsItemEdited(); // did the last item modify its underlying value this frame? or was pressed? This is generally the same as the "bool" return value of many widgets. IMGUI_API bool IsItemActivated(); // was the last item just made active (item was previously inactive). IMGUI_API bool IsItemDeactivated(); // was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that requires continuous editing. IMGUI_API bool IsItemDeactivatedAfterEdit(); // was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that requires continuous editing. Note that you may get false positives (some widgets such as Combo()/ListBox()/Selectable() will return true even when clicking an already selected item). IMGUI_API bool IsItemToggledOpen(); // was the last item open state toggled? set by TreeNode(). IMGUI_API bool IsAnyItemHovered(); // is any item hovered? IMGUI_API bool IsAnyItemActive(); // is any item active? IMGUI_API bool IsAnyItemFocused(); // is any item focused? IMGUI_API ImVec2 GetItemRectMin(); // get upper-left bounding rectangle of the last item (screen space) IMGUI_API ImVec2 GetItemRectMax(); // get lower-right bounding rectangle of the last item (screen space) IMGUI_API ImVec2 GetItemRectSize(); // get size of last item IMGUI_API void SetItemAllowOverlap(); // allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area. // Miscellaneous Utilities IMGUI_API bool IsRectVisible(const ImVec2& size); // test if rectangle (of given size, starting from cursor position) is visible / not clipped. IMGUI_API bool IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max); // test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side. IMGUI_API double GetTime(); // get global imgui time. incremented by io.DeltaTime every frame. IMGUI_API int GetFrameCount(); // get global imgui frame count. incremented by 1 every frame. IMGUI_API ImDrawList* GetBackgroundDrawList(); // get background draw list for the viewport associated to the current window. this draw list will be the first rendering one. Useful to quickly draw shapes/text behind dear imgui contents. IMGUI_API ImDrawList* GetForegroundDrawList(); // get foreground draw list for the viewport associated to the current window. this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents. IMGUI_API ImDrawList* GetBackgroundDrawList(ImGuiViewport* viewport); // get background draw list for the given viewport. this draw list will be the first rendering one. Useful to quickly draw shapes/text behind dear imgui contents. IMGUI_API ImDrawList* GetForegroundDrawList(ImGuiViewport* viewport); // get foreground draw list for the given viewport. this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents. IMGUI_API ImDrawListSharedData* GetDrawListSharedData(); // you may use this when creating your own ImDrawList instances. IMGUI_API const char* GetStyleColorName(ImGuiCol idx); // get a string corresponding to the enum value (for display, saving, etc.). IMGUI_API void SetStateStorage(ImGuiStorage* storage); // replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it) IMGUI_API ImGuiStorage* GetStateStorage(); IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // calculate coarse clipping for large list of evenly sized items. Prefer using the ImGuiListClipper higher-level helper if you can. IMGUI_API bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags flags = 0); // helper to create a child window / scrolling region that looks like a normal widget frame IMGUI_API void EndChildFrame(); // always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window) // Text Utilities IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f); // Color Utilities IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in); IMGUI_API ImU32 ColorConvertFloat4ToU32(const ImVec4& in); IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v); IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b); // Inputs Utilities: Keyboard // - For 'int user_key_index' you can use your own indices/enums according to how your back-end/engine stored them in io.KeysDown[]. // - We don't know the meaning of those value. You can use GetKeyIndex() to map a ImGuiKey_ value into the user index. IMGUI_API int GetKeyIndex(ImGuiKey imgui_key); // map ImGuiKey_* values into user's key index. == io.KeyMap[key] IMGUI_API bool IsKeyDown(int user_key_index); // is key being held. == io.KeysDown[user_key_index]. IMGUI_API bool IsKeyPressed(int user_key_index, bool repeat = true); // was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate IMGUI_API bool IsKeyReleased(int user_key_index); // was key released (went from Down to !Down)? IMGUI_API int GetKeyPressedAmount(int key_index, float repeat_delay, float rate); // uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate IMGUI_API void CaptureKeyboardFromApp(bool want_capture_keyboard_value = true); // attention: misleading name! manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application to handle). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard_value"; after the next NewFrame() call. // Inputs Utilities: Mouse // - To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right. // - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle. // - Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold') IMGUI_API bool IsMouseDown(ImGuiMouseButton button); // is mouse button held? IMGUI_API bool IsMouseClicked(ImGuiMouseButton button, bool repeat = false); // did mouse button clicked? (went from !Down to Down) IMGUI_API bool IsMouseReleased(ImGuiMouseButton button); // did mouse button released? (went from Down to !Down) IMGUI_API bool IsMouseDoubleClicked(ImGuiMouseButton button); // did mouse button double-clicked? (note that a double-click will also report IsMouseClicked() == true) IMGUI_API bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true);// is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block. IMGUI_API bool IsMousePosValid(const ImVec2* mouse_pos = NULL); // by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available IMGUI_API bool IsAnyMouseDown(); // is any mouse button held? IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup(); // retrieve mouse position at the time of opening popup we have BeginPopup() into (helper to avoid user backing that value themselves) IMGUI_API bool IsMouseDragging(ImGuiMouseButton button, float lock_threshold = -1.0f); // is mouse dragging? (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold) IMGUI_API ImVec2 GetMouseDragDelta(ImGuiMouseButton button = 0, float lock_threshold = -1.0f); // return the delta from the initial clicking position while the mouse button is pressed or was just released. This is locked and return 0.0f until the mouse moves past a distance threshold at least once (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold) IMGUI_API void ResetMouseDragDelta(ImGuiMouseButton button = 0); // IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you IMGUI_API void SetMouseCursor(ImGuiMouseCursor cursor_type); // set desired cursor type IMGUI_API void CaptureMouseFromApp(bool want_capture_mouse_value = true); // attention: misleading name! manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application to handle). This is equivalent to setting "io.WantCaptureMouse = want_capture_mouse_value;" after the next NewFrame() call. // Clipboard Utilities // - Also see the LogToClipboard() function to capture GUI into clipboard, or easily output text data to the clipboard. IMGUI_API const char* GetClipboardText(); IMGUI_API void SetClipboardText(const char* text); // Settings/.Ini Utilities // - The disk functions are automatically called if io.IniFilename != NULL (default is "imgui.ini"). // - Set io.IniFilename to NULL to load/save manually. Read io.WantSaveIniSettings description about handling .ini saving manually. IMGUI_API void LoadIniSettingsFromDisk(const char* ini_filename); // call after CreateContext() and before the first call to NewFrame(). NewFrame() automatically calls LoadIniSettingsFromDisk(io.IniFilename). IMGUI_API void LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size=0); // call after CreateContext() and before the first call to NewFrame() to provide .ini data from your own data source. IMGUI_API void SaveIniSettingsToDisk(const char* ini_filename); // this is automatically called (if io.IniFilename is not empty) a few seconds after any modification that should be reflected in the .ini file (and also by DestroyContext). IMGUI_API const char* SaveIniSettingsToMemory(size_t* out_ini_size = NULL); // return a zero-terminated string with the .ini data which you can save by your own mean. call when io.WantSaveIniSettings is set, then save data by your own mean and clear io.WantSaveIniSettings. // Debug Utilities IMGUI_API bool DebugCheckVersionAndDataLayout(const char* version_str, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_drawvert, size_t sz_drawidx); // This is called by IMGUI_CHECKVERSION() macro. // Memory Allocators // - All those functions are not reliant on the current context. // - If you reload the contents of imgui.cpp at runtime, you may need to call SetCurrentContext() + SetAllocatorFunctions() again because we use global storage for those. IMGUI_API void SetAllocatorFunctions(void* (*alloc_func)(size_t sz, void* user_data), void (*free_func)(void* ptr, void* user_data), void* user_data = NULL); IMGUI_API void* MemAlloc(size_t size); IMGUI_API void MemFree(void* ptr); // (Optional) Platform/OS interface for multi-viewport support // Read comments around the ImGuiPlatformIO structure for more details. // Note: You may use GetWindowViewport() to get the current viewport of the current window. IMGUI_API ImGuiPlatformIO& GetPlatformIO(); // platform/renderer functions, for back-end to setup + viewports list. IMGUI_API ImGuiViewport* GetMainViewport(); // main viewport. same as GetPlatformIO().MainViewport == GetPlatformIO().Viewports[0]. IMGUI_API void UpdatePlatformWindows(); // call in main loop. will call CreateWindow/ResizeWindow/etc. platform functions for each secondary viewport, and DestroyWindow for each inactive viewport. IMGUI_API void RenderPlatformWindowsDefault(void* platform_render_arg = NULL, void* renderer_render_arg = NULL); // call in main loop. will call RenderWindow/SwapBuffers platform functions for each secondary viewport which doesn't have the ImGuiViewportFlags_Minimized flag set. May be reimplemented by user for custom rendering needs. IMGUI_API void DestroyPlatformWindows(); // call DestroyWindow platform functions for all viewports. call from back-end Shutdown() if you need to close platform windows before imgui shutdown. otherwise will be called by DestroyContext(). IMGUI_API ImGuiViewport* FindViewportByID(ImGuiID id); // this is a helper for back-ends. IMGUI_API ImGuiViewport* FindViewportByPlatformHandle(void* platform_handle); // this is a helper for back-ends. the type platform_handle is decided by the back-end (e.g. HWND, MyWindow*, GLFWwindow* etc.) } // namespace ImGui //----------------------------------------------------------------------------- // Flags & Enumerations //----------------------------------------------------------------------------- // Flags for ImGui::Begin() enum ImGuiWindowFlags_ { ImGuiWindowFlags_None = 0, ImGuiWindowFlags_NoTitleBar = 1 << 0, // Disable title-bar ImGuiWindowFlags_NoResize = 1 << 1, // Disable user resizing with the lower-right grip ImGuiWindowFlags_NoMove = 1 << 2, // Disable user moving the window ImGuiWindowFlags_NoScrollbar = 1 << 3, // Disable scrollbars (window can still scroll with mouse or programmatically) ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set. ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it. Also referred to as "window menu button" within a docking node. ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame ImGuiWindowFlags_NoBackground = 1 << 7, // Disable drawing background color (WindowBg, etc.) and outside border. Similar as using SetNextWindowBgAlpha(0.0f). ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file ImGuiWindowFlags_NoMouseInputs = 1 << 9, // Disable catching mouse, hovering test with pass through. ImGuiWindowFlags_MenuBar = 1 << 10, // Has a menu-bar ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, // Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section. ImGuiWindowFlags_NoFocusOnAppearing = 1 << 12, // Disable taking focus when transitioning from hidden to visible state ImGuiWindowFlags_NoBringToFrontOnFocus = 1 << 13, // Disable bringing window to front when taking focus (e.g. clicking on it or programmatically giving it focus) ImGuiWindowFlags_AlwaysVerticalScrollbar= 1 << 14, // Always show vertical scrollbar (even if ContentSize.y < Size.y) ImGuiWindowFlags_AlwaysHorizontalScrollbar=1<< 15, // Always show horizontal scrollbar (even if ContentSize.x < Size.x) ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16, // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient) ImGuiWindowFlags_NoNavInputs = 1 << 18, // No gamepad/keyboard navigation within the window ImGuiWindowFlags_NoNavFocus = 1 << 19, // No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB) ImGuiWindowFlags_UnsavedDocument = 1 << 20, // Append '*' to title without affecting the ID, as a convenience to avoid using the ### operator. When used in a tab/docking context, tab is selected on closure and closure is deferred by one frame to allow code to cancel the closure (with a confirmation popup, etc.) without flicker. ImGuiWindowFlags_NoDocking = 1 << 21, // Disable docking of this window ImGuiWindowFlags_NoNav = ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus, ImGuiWindowFlags_NoDecoration = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse, ImGuiWindowFlags_NoInputs = ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus, // [Internal] ImGuiWindowFlags_NavFlattened = 1 << 23, // [BETA] Allow gamepad/keyboard navigation to cross over parent border to this child (only use on child that have no scrolling!) ImGuiWindowFlags_ChildWindow = 1 << 24, // Don't use! For internal use by BeginChild() ImGuiWindowFlags_Tooltip = 1 << 25, // Don't use! For internal use by BeginTooltip() ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For internal use by BeginPopup() ImGuiWindowFlags_Modal = 1 << 27, // Don't use! For internal use by BeginPopupModal() ImGuiWindowFlags_ChildMenu = 1 << 28, // Don't use! For internal use by BeginMenu() ImGuiWindowFlags_DockNodeHost = 1 << 29 // Don't use! For internal use by Begin()/NewFrame() // [Obsolete] //ImGuiWindowFlags_ShowBorders = 1 << 7, // --> Set style.FrameBorderSize=1.0f or style.WindowBorderSize=1.0f to enable borders around items or windows. //ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // --> Set io.ConfigWindowsResizeFromEdges=true and make sure mouse cursors are supported by back-end (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) }; // Flags for ImGui::InputText() enum ImGuiInputTextFlags_ { ImGuiInputTextFlags_None = 0, ImGuiInputTextFlags_CharsDecimal = 1 << 0, // Allow 0123456789.+-*/ ImGuiInputTextFlags_CharsHexadecimal = 1 << 1, // Allow 0123456789ABCDEFabcdef ImGuiInputTextFlags_CharsUppercase = 1 << 2, // Turn a..z into A..Z ImGuiInputTextFlags_CharsNoBlank = 1 << 3, // Filter out spaces, tabs ImGuiInputTextFlags_AutoSelectAll = 1 << 4, // Select entire text when first taking mouse focus ImGuiInputTextFlags_EnterReturnsTrue = 1 << 5, // Return 'true' when Enter is pressed (as opposed to every time the value was modified). Consider looking at the IsItemDeactivatedAfterEdit() function. ImGuiInputTextFlags_CallbackCompletion = 1 << 6, // Callback on pressing TAB (for completion handling) ImGuiInputTextFlags_CallbackHistory = 1 << 7, // Callback on pressing Up/Down arrows (for history handling) ImGuiInputTextFlags_CallbackAlways = 1 << 8, // Callback on each iteration. User code may query cursor position, modify text buffer. ImGuiInputTextFlags_CallbackCharFilter = 1 << 9, // Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard. ImGuiInputTextFlags_AllowTabInput = 1 << 10, // Pressing TAB input a '\t' character into the text field ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11, // In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter). ImGuiInputTextFlags_NoHorizontalScroll = 1 << 12, // Disable following the cursor horizontally ImGuiInputTextFlags_AlwaysInsertMode = 1 << 13, // Insert mode ImGuiInputTextFlags_ReadOnly = 1 << 14, // Read-only mode ImGuiInputTextFlags_Password = 1 << 15, // Password mode, display all characters as '*' ImGuiInputTextFlags_NoUndoRedo = 1 << 16, // Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID(). ImGuiInputTextFlags_CharsScientific = 1 << 17, // Allow 0123456789.+-*/eE (Scientific notation input) ImGuiInputTextFlags_CallbackResize = 1 << 18, // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this) ImGuiInputTextFlags_CallbackEdit = 1 << 19, // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active) // [Internal] ImGuiInputTextFlags_Multiline = 1 << 20, // For internal use by InputTextMultiline() ImGuiInputTextFlags_NoMarkEdited = 1 << 21 // For internal use by functions using InputText() before reformatting data }; // Flags for ImGui::TreeNodeEx(), ImGui::CollapsingHeader*() enum ImGuiTreeNodeFlags_ { ImGuiTreeNodeFlags_None = 0, ImGuiTreeNodeFlags_Selected = 1 << 0, // Draw as selected ImGuiTreeNodeFlags_Framed = 1 << 1, // Full colored frame (e.g. for CollapsingHeader) ImGuiTreeNodeFlags_AllowItemOverlap = 1 << 2, // Hit testing to allow subsequent widgets to overlap this one ImGuiTreeNodeFlags_NoTreePushOnOpen = 1 << 3, // Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack ImGuiTreeNodeFlags_NoAutoOpenOnLog = 1 << 4, // Don't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes) ImGuiTreeNodeFlags_DefaultOpen = 1 << 5, // Default node to be open ImGuiTreeNodeFlags_OpenOnDoubleClick = 1 << 6, // Need double-click to open node ImGuiTreeNodeFlags_OpenOnArrow = 1 << 7, // Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open. ImGuiTreeNodeFlags_Leaf = 1 << 8, // No collapsing, no arrow (use as a convenience for leaf nodes). ImGuiTreeNodeFlags_Bullet = 1 << 9, // Display a bullet instead of arrow ImGuiTreeNodeFlags_FramePadding = 1 << 10, // Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding(). ImGuiTreeNodeFlags_SpanAvailWidth = 1 << 11, // Extend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line. In the future we may refactor the hit system to be front-to-back, allowing natural overlaps and then this can become the default. ImGuiTreeNodeFlags_SpanFullWidth = 1 << 12, // Extend hit box to the left-most and right-most edges (bypass the indented area). ImGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 13, // (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop) //ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 14, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_NoAutoOpenOnLog }; // Flags for OpenPopup*(), BeginPopupContext*(), IsPopupOpen() functions. // - To be backward compatible with older API which took an 'int mouse_button = 1' argument, we need to treat // small flags values as a mouse button index, so we encode the mouse button in the first few bits of the flags. // It is therefore guaranteed to be legal to pass a mouse button index in ImGuiPopupFlags. // - For the same reason, we exceptionally default the ImGuiPopupFlags argument of BeginPopupContextXXX functions to 1 instead of 0. // IMPORTANT: because the default parameter is 1 (==ImGuiPopupFlags_MouseButtonRight), if you rely on the default parameter // and want to another another flag, you need to pass in the ImGuiPopupFlags_MouseButtonRight flag. // - Multiple buttons currently cannot be combined/or-ed in those functions (we could allow it later). enum ImGuiPopupFlags_ { ImGuiPopupFlags_None = 0, ImGuiPopupFlags_MouseButtonLeft = 0, // For BeginPopupContext*(): open on Left Mouse release. Guaranteed to always be == 0 (same as ImGuiMouseButton_Left) ImGuiPopupFlags_MouseButtonRight = 1, // For BeginPopupContext*(): open on Right Mouse release. Guaranteed to always be == 1 (same as ImGuiMouseButton_Right) ImGuiPopupFlags_MouseButtonMiddle = 2, // For BeginPopupContext*(): open on Middle Mouse release. Guaranteed to always be == 2 (same as ImGuiMouseButton_Middle) ImGuiPopupFlags_MouseButtonMask_ = 0x1F, ImGuiPopupFlags_MouseButtonDefault_ = 1, ImGuiPopupFlags_NoOpenOverExistingPopup = 1 << 5, // For OpenPopup*(), BeginPopupContext*(): don't open if there's already a popup at the same level of the popup stack ImGuiPopupFlags_NoOpenOverItems = 1 << 6, // For BeginPopupContextWindow(): don't return true when hovering items, only when hovering empty space ImGuiPopupFlags_AnyPopupId = 1 << 7, // For IsPopupOpen(): ignore the ImGuiID parameter and test for any popup. ImGuiPopupFlags_AnyPopupLevel = 1 << 8, // For IsPopupOpen(): search/test at any level of the popup stack (default test in the current level) ImGuiPopupFlags_AnyPopup = ImGuiPopupFlags_AnyPopupId | ImGuiPopupFlags_AnyPopupLevel }; // Flags for ImGui::Selectable() enum ImGuiSelectableFlags_ { ImGuiSelectableFlags_None = 0, ImGuiSelectableFlags_DontClosePopups = 1 << 0, // Clicking this don't close parent popup window ImGuiSelectableFlags_SpanAllColumns = 1 << 1, // Selectable frame can span all columns (text will still fit in current column) ImGuiSelectableFlags_AllowDoubleClick = 1 << 2, // Generate press events on double clicks too ImGuiSelectableFlags_Disabled = 1 << 3, // Cannot be selected, display grayed out text ImGuiSelectableFlags_AllowItemOverlap = 1 << 4 // (WIP) Hit testing to allow subsequent widgets to overlap this one }; // Flags for ImGui::BeginCombo() enum ImGuiComboFlags_ { ImGuiComboFlags_None = 0, ImGuiComboFlags_PopupAlignLeft = 1 << 0, // Align the popup toward the left by default ImGuiComboFlags_HeightSmall = 1 << 1, // Max ~4 items visible. Tip: If you want your combo popup to be a specific size you can use SetNextWindowSizeConstraints() prior to calling BeginCombo() ImGuiComboFlags_HeightRegular = 1 << 2, // Max ~8 items visible (default) ImGuiComboFlags_HeightLarge = 1 << 3, // Max ~20 items visible ImGuiComboFlags_HeightLargest = 1 << 4, // As many fitting items as possible ImGuiComboFlags_NoArrowButton = 1 << 5, // Display on the preview box without the square arrow button ImGuiComboFlags_NoPreview = 1 << 6, // Display only a square arrow button ImGuiComboFlags_HeightMask_ = ImGuiComboFlags_HeightSmall | ImGuiComboFlags_HeightRegular | ImGuiComboFlags_HeightLarge | ImGuiComboFlags_HeightLargest }; // Flags for ImGui::BeginTabBar() enum ImGuiTabBarFlags_ { ImGuiTabBarFlags_None = 0, ImGuiTabBarFlags_Reorderable = 1 << 0, // Allow manually dragging tabs to re-order them + New tabs are appended at the end of list ImGuiTabBarFlags_AutoSelectNewTabs = 1 << 1, // Automatically select new tabs when they appear ImGuiTabBarFlags_TabListPopupButton = 1 << 2, // Disable buttons to open the tab list popup ImGuiTabBarFlags_NoCloseWithMiddleMouseButton = 1 << 3, // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false. ImGuiTabBarFlags_NoTabListScrollingButtons = 1 << 4, // Disable scrolling buttons (apply when fitting policy is ImGuiTabBarFlags_FittingPolicyScroll) ImGuiTabBarFlags_NoTooltip = 1 << 5, // Disable tooltips when hovering a tab ImGuiTabBarFlags_FittingPolicyResizeDown = 1 << 6, // Resize tabs when they don't fit ImGuiTabBarFlags_FittingPolicyScroll = 1 << 7, // Add scroll buttons when tabs don't fit ImGuiTabBarFlags_FittingPolicyMask_ = ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_FittingPolicyScroll, ImGuiTabBarFlags_FittingPolicyDefault_ = ImGuiTabBarFlags_FittingPolicyResizeDown }; // Flags for ImGui::BeginTabItem() enum ImGuiTabItemFlags_ { ImGuiTabItemFlags_None = 0, ImGuiTabItemFlags_UnsavedDocument = 1 << 0, // Append '*' to title without affecting the ID, as a convenience to avoid using the ### operator. Also: tab is selected on closure and closure is deferred by one frame to allow code to undo it without flicker. ImGuiTabItemFlags_SetSelected = 1 << 1, // Trigger flag to programmatically make the tab selected when calling BeginTabItem() ImGuiTabItemFlags_NoCloseWithMiddleMouseButton = 1 << 2, // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false. ImGuiTabItemFlags_NoPushId = 1 << 3, // Don't call PushID(tab->ID)/PopID() on BeginTabItem()/EndTabItem() ImGuiTabItemFlags_NoTooltip = 1 << 4, // Disable tooltip for the given tab ImGuiTabItemFlags_NoReorder = 1 << 5, // Disable reordering this tab or having another tab cross over this tab ImGuiTabItemFlags_Leading = 1 << 6, // Enforce the tab position to the left of the tab bar (after the tab list popup button) ImGuiTabItemFlags_Trailing = 1 << 7 // Enforce the tab position to the right of the tab bar (before the scrolling buttons) }; // Flags for ImGui::IsWindowFocused() enum ImGuiFocusedFlags_ { ImGuiFocusedFlags_None = 0, ImGuiFocusedFlags_ChildWindows = 1 << 0, // IsWindowFocused(): Return true if any children of the window is focused ImGuiFocusedFlags_RootWindow = 1 << 1, // IsWindowFocused(): Test from root window (top most parent of the current hierarchy) ImGuiFocusedFlags_AnyWindow = 1 << 2, // IsWindowFocused(): Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ! ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows }; // Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered() // Note: if you are trying to check whether your mouse should be dispatched to Dear ImGui or to your app, you should use 'io.WantCaptureMouse' instead! Please read the FAQ! // Note: windows with the ImGuiWindowFlags_NoInputs flag are ignored by IsWindowHovered() calls. enum ImGuiHoveredFlags_ { ImGuiHoveredFlags_None = 0, // Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them. ImGuiHoveredFlags_ChildWindows = 1 << 0, // IsWindowHovered() only: Return true if any children of the window is hovered ImGuiHoveredFlags_RootWindow = 1 << 1, // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy) ImGuiHoveredFlags_AnyWindow = 1 << 2, // IsWindowHovered() only: Return true if any window is hovered ImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 3, // Return true even if a popup window is normally blocking access to this item/window //ImGuiHoveredFlags_AllowWhenBlockedByModal = 1 << 4, // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet. ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 5, // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns. ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 6, // Return true even if the position is obstructed or overlapped by another window ImGuiHoveredFlags_AllowWhenDisabled = 1 << 7, // Return true even if the item is disabled ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped, ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows }; // Flags for ImGui::DockSpace(), shared/inherited by child nodes. // (Some flags can be applied to individual nodes directly) // FIXME-DOCK: Also see ImGuiDockNodeFlagsPrivate_ which may involve using the WIP and internal DockBuilder api. enum ImGuiDockNodeFlags_ { ImGuiDockNodeFlags_None = 0, ImGuiDockNodeFlags_KeepAliveOnly = 1 << 0, // Shared // Don't display the dockspace node but keep it alive. Windows docked into this dockspace node won't be undocked. //ImGuiDockNodeFlags_NoCentralNode = 1 << 1, // Shared // Disable Central Node (the node which can stay empty) ImGuiDockNodeFlags_NoDockingInCentralNode = 1 << 2, // Shared // Disable docking inside the Central Node, which will be always kept empty. ImGuiDockNodeFlags_PassthruCentralNode = 1 << 3, // Shared // Enable passthru dockspace: 1) DockSpace() will render a ImGuiCol_WindowBg background covering everything excepted the Central Node when empty. Meaning the host window should probably use SetNextWindowBgAlpha(0.0f) prior to Begin() when using this. 2) When Central Node is empty: let inputs pass-through + won't display a DockingEmptyBg background. See demo for details. ImGuiDockNodeFlags_NoSplit = 1 << 4, // Shared/Local // Disable splitting the node into smaller nodes. Useful e.g. when embedding dockspaces into a main root one (the root one may have splitting disabled to reduce confusion). Note: when turned off, existing splits will be preserved. ImGuiDockNodeFlags_NoResize = 1 << 5, // Shared/Local // Disable resizing node using the splitter/separators. Useful with programatically setup dockspaces. ImGuiDockNodeFlags_AutoHideTabBar = 1 << 6 // Shared/Local // Tab bar will automatically hide when there is a single window in the dock node. }; // Flags for ImGui::BeginDragDropSource(), ImGui::AcceptDragDropPayload() enum ImGuiDragDropFlags_ { ImGuiDragDropFlags_None = 0, // BeginDragDropSource() flags ImGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0, // By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disable this behavior. ImGuiDragDropFlags_SourceNoDisableHover = 1 << 1, // By default, when dragging we clear data so that IsItemHovered() will return false, to avoid subsequent user code submitting tooltips. This flag disable this behavior so you can still call IsItemHovered() on the source item. ImGuiDragDropFlags_SourceNoHoldToOpenOthers = 1 << 2, // Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item. ImGuiDragDropFlags_SourceAllowNullID = 1 << 3, // Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit. ImGuiDragDropFlags_SourceExtern = 1 << 4, // External source (from outside of dear imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously. ImGuiDragDropFlags_SourceAutoExpirePayload = 1 << 5, // Automatically expire the payload if the source cease to be submitted (otherwise payloads are persisting while being dragged) // AcceptDragDropPayload() flags ImGuiDragDropFlags_AcceptBeforeDelivery = 1 << 10, // AcceptDragDropPayload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered. ImGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 11, // Do not draw the default highlight rectangle when hovering over target. ImGuiDragDropFlags_AcceptNoPreviewTooltip = 1 << 12, // Request hiding the BeginDragDropSource tooltip from the BeginDragDropTarget site. ImGuiDragDropFlags_AcceptPeekOnly = ImGuiDragDropFlags_AcceptBeforeDelivery | ImGuiDragDropFlags_AcceptNoDrawDefaultRect // For peeking ahead and inspecting the payload before delivery. }; // Standard Drag and Drop payload types. You can define you own payload types using short strings. Types starting with '_' are defined by Dear ImGui. #define IMGUI_PAYLOAD_TYPE_COLOR_3F "_COL3F" // float[3]: Standard type for colors, without alpha. User code may use this type. #define IMGUI_PAYLOAD_TYPE_COLOR_4F "_COL4F" // float[4]: Standard type for colors. User code may use this type. // A primary data type enum ImGuiDataType_ { ImGuiDataType_S8, // signed char / char (with sensible compilers) ImGuiDataType_U8, // unsigned char ImGuiDataType_S16, // short ImGuiDataType_U16, // unsigned short ImGuiDataType_S32, // int ImGuiDataType_U32, // unsigned int ImGuiDataType_S64, // long long / __int64 ImGuiDataType_U64, // unsigned long long / unsigned __int64 ImGuiDataType_Float, // float ImGuiDataType_Double, // double ImGuiDataType_COUNT }; // A cardinal direction enum ImGuiDir_ { ImGuiDir_None = -1, ImGuiDir_Left = 0, ImGuiDir_Right = 1, ImGuiDir_Up = 2, ImGuiDir_Down = 3, ImGuiDir_COUNT }; // User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array enum ImGuiKey_ { ImGuiKey_Tab, ImGuiKey_LeftArrow, ImGuiKey_RightArrow, ImGuiKey_UpArrow, ImGuiKey_DownArrow, ImGuiKey_PageUp, ImGuiKey_PageDown, ImGuiKey_Home, ImGuiKey_End, ImGuiKey_Insert, ImGuiKey_Delete, ImGuiKey_Backspace, ImGuiKey_Space, ImGuiKey_Enter, ImGuiKey_Escape, ImGuiKey_KeyPadEnter, ImGuiKey_A, // for text edit CTRL+A: select all ImGuiKey_C, // for text edit CTRL+C: copy ImGuiKey_V, // for text edit CTRL+V: paste ImGuiKey_X, // for text edit CTRL+X: cut ImGuiKey_Y, // for text edit CTRL+Y: redo ImGuiKey_Z, // for text edit CTRL+Z: undo ImGuiKey_COUNT }; // To test io.KeyMods (which is a combination of individual fields io.KeyCtrl, io.KeyShift, io.KeyAlt set by user/back-end) enum ImGuiKeyModFlags_ { ImGuiKeyModFlags_None = 0, ImGuiKeyModFlags_Ctrl = 1 << 0, ImGuiKeyModFlags_Shift = 1 << 1, ImGuiKeyModFlags_Alt = 1 << 2, ImGuiKeyModFlags_Super = 1 << 3 }; // Gamepad/Keyboard navigation // Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays. // Gamepad: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. Back-end: set ImGuiBackendFlags_HasGamepad and fill the io.NavInputs[] fields before calling NewFrame(). Note that io.NavInputs[] is cleared by EndFrame(). // Read instructions in imgui.cpp for more details. Download PNG/PSD at http://goo.gl/9LgVZW. enum ImGuiNavInput_ { // Gamepad Mapping ImGuiNavInput_Activate, // activate / open / toggle / tweak value // e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard) ImGuiNavInput_Cancel, // cancel / close / exit // e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard) ImGuiNavInput_Input, // text input / on-screen keyboard // e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard) ImGuiNavInput_Menu, // tap: toggle menu / hold: focus, move, resize // e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard) ImGuiNavInput_DpadLeft, // move / tweak / resize window (w/ PadMenu) // e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard) ImGuiNavInput_DpadRight, // ImGuiNavInput_DpadUp, // ImGuiNavInput_DpadDown, // ImGuiNavInput_LStickLeft, // scroll / move window (w/ PadMenu) // e.g. Left Analog Stick Left/Right/Up/Down ImGuiNavInput_LStickRight, // ImGuiNavInput_LStickUp, // ImGuiNavInput_LStickDown, // ImGuiNavInput_FocusPrev, // next window (w/ PadMenu) // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) ImGuiNavInput_FocusNext, // prev window (w/ PadMenu) // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) ImGuiNavInput_TweakSlow, // slower tweaks // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) ImGuiNavInput_TweakFast, // faster tweaks // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) // [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them. // Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) will be directly reading from io.KeysDown[] instead of io.NavInputs[]. ImGuiNavInput_KeyMenu_, // toggle menu // = io.KeyAlt ImGuiNavInput_KeyLeft_, // move left // = Arrow keys ImGuiNavInput_KeyRight_, // move right ImGuiNavInput_KeyUp_, // move up ImGuiNavInput_KeyDown_, // move down ImGuiNavInput_COUNT, ImGuiNavInput_InternalStart_ = ImGuiNavInput_KeyMenu_ }; // Configuration flags stored in io.ConfigFlags. Set by user/application. enum ImGuiConfigFlags_ { ImGuiConfigFlags_None = 0, ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.KeysDown[]. ImGuiConfigFlags_NavEnableGamepad = 1 << 1, // Master gamepad navigation enable flag. This is mostly to instruct your imgui back-end to fill io.NavInputs[]. Back-end also needs to set ImGuiBackendFlags_HasGamepad. ImGuiConfigFlags_NavEnableSetMousePos = 1 << 2, // Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you MUST honor io.WantSetMousePos requests in your binding, otherwise ImGui will react as if the mouse is jumping around back and forth. ImGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3, // Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set. ImGuiConfigFlags_NoMouse = 1 << 4, // Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information set by the back-end. ImGuiConfigFlags_NoMouseCursorChange = 1 << 5, // Instruct back-end to not alter mouse cursor shape and visibility. Use if the back-end cursor changes are interfering with yours and you don't want to use SetMouseCursor() to change mouse cursor. You may want to honor requests from imgui by reading GetMouseCursor() yourself instead. // [BETA] Docking ImGuiConfigFlags_DockingEnable = 1 << 6, // Docking enable flags. // [BETA] Viewports // When using viewports it is recommended that your default value for ImGuiCol_WindowBg is opaque (Alpha=1.0) so transition to a viewport won't be noticeable. ImGuiConfigFlags_ViewportsEnable = 1 << 10, // Viewport enable flags (require both ImGuiBackendFlags_PlatformHasViewports + ImGuiBackendFlags_RendererHasViewports set by the respective back-ends) ImGuiConfigFlags_DpiEnableScaleViewports= 1 << 14, // [BETA: Don't use] FIXME-DPI: Reposition and resize imgui windows when the DpiScale of a viewport changed (mostly useful for the main viewport hosting other window). Note that resizing the main window itself is up to your application. ImGuiConfigFlags_DpiEnableScaleFonts = 1 << 15, // [BETA: Don't use] FIXME-DPI: Request bitmap-scaled fonts to match DpiScale. This is a very low-quality workaround. The correct way to handle DPI is _currently_ to replace the atlas and/or fonts in the Platform_OnChangedViewport callback, but this is all early work in progress. // User storage (to allow your back-end/engine to communicate to code that may be shared between multiple projects. Those flags are not used by core Dear ImGui) ImGuiConfigFlags_IsSRGB = 1 << 20, // Application is SRGB-aware. ImGuiConfigFlags_IsTouchScreen = 1 << 21 // Application is using a touch screen instead of a mouse. }; // Back-end capabilities flags stored in io.BackendFlags. Set by imgui_impl_xxx or custom back-end. enum ImGuiBackendFlags_ { ImGuiBackendFlags_None = 0, ImGuiBackendFlags_HasGamepad = 1 << 0, // Back-end Platform supports gamepad and currently has one connected. ImGuiBackendFlags_HasMouseCursors = 1 << 1, // Back-end Platform supports honoring GetMouseCursor() value to change the OS cursor shape. ImGuiBackendFlags_HasSetMousePos = 1 << 2, // Back-end Platform supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set). ImGuiBackendFlags_RendererHasVtxOffset = 1 << 3, // Back-end Renderer supports ImDrawCmd::VtxOffset. This enables output of large meshes (64K+ vertices) while still using 16-bit indices. // [BETA] Viewports ImGuiBackendFlags_PlatformHasViewports = 1 << 10, // Back-end Platform supports multiple viewports. ImGuiBackendFlags_HasMouseHoveredViewport=1 << 11, // Back-end Platform supports setting io.MouseHoveredViewport to the viewport directly under the mouse _IGNORING_ viewports with the ImGuiViewportFlags_NoInputs flag and _REGARDLESS_ of whether another viewport is focused and may be capturing the mouse. This information is _NOT EASY_ to provide correctly with most high-level engines! Don't set this without studying how the examples/ back-end handle it! ImGuiBackendFlags_RendererHasViewports = 1 << 12 // Back-end Renderer supports multiple viewports. }; // Enumeration for PushStyleColor() / PopStyleColor() enum ImGuiCol_ { ImGuiCol_Text, ImGuiCol_TextDisabled, ImGuiCol_WindowBg, // Background of normal windows ImGuiCol_ChildBg, // Background of child windows ImGuiCol_PopupBg, // Background of popups, menus, tooltips windows ImGuiCol_Border, ImGuiCol_BorderShadow, ImGuiCol_FrameBg, // Background of checkbox, radio button, plot, slider, text input ImGuiCol_FrameBgHovered, ImGuiCol_FrameBgActive, ImGuiCol_TitleBg, ImGuiCol_TitleBgActive, ImGuiCol_TitleBgCollapsed, ImGuiCol_MenuBarBg, ImGuiCol_ScrollbarBg, ImGuiCol_ScrollbarGrab, ImGuiCol_ScrollbarGrabHovered, ImGuiCol_ScrollbarGrabActive, ImGuiCol_CheckMark, ImGuiCol_SliderGrab, ImGuiCol_SliderGrabActive, ImGuiCol_Button, ImGuiCol_ButtonHovered, ImGuiCol_ButtonActive, ImGuiCol_Header, // Header* colors are used for CollapsingHeader, TreeNode, Selectable, MenuItem ImGuiCol_HeaderHovered, ImGuiCol_HeaderActive, ImGuiCol_Separator, ImGuiCol_SeparatorHovered, ImGuiCol_SeparatorActive, ImGuiCol_ResizeGrip, ImGuiCol_ResizeGripHovered, ImGuiCol_ResizeGripActive, ImGuiCol_Tab, ImGuiCol_TabHovered, ImGuiCol_TabActive, ImGuiCol_TabUnfocused, ImGuiCol_TabUnfocusedActive, ImGuiCol_DockingPreview, // Preview overlay color when about to docking something ImGuiCol_DockingEmptyBg, // Background color for empty node (e.g. CentralNode with no window docked into it) ImGuiCol_PlotLines, ImGuiCol_PlotLinesHovered, ImGuiCol_PlotHistogram, ImGuiCol_PlotHistogramHovered, ImGuiCol_TextSelectedBg, ImGuiCol_DragDropTarget, ImGuiCol_NavHighlight, // Gamepad/keyboard: current highlighted item ImGuiCol_NavWindowingHighlight, // Highlight window when using CTRL+TAB ImGuiCol_NavWindowingDimBg, // Darken/colorize entire screen behind the CTRL+TAB window list, when active ImGuiCol_ModalWindowDimBg, // Darken/colorize entire screen behind a modal window, when one is active ImGuiCol_COUNT // Obsolete names (will be removed) #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS , ImGuiCol_ModalWindowDarkening = ImGuiCol_ModalWindowDimBg // [renamed in 1.63] //, ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered// [unused since 1.60+] the close button now uses regular button colors. #endif }; // Enumeration for PushStyleVar() / PopStyleVar() to temporarily modify the ImGuiStyle structure. // - The enum only refers to fields of ImGuiStyle which makes sense to be pushed/popped inside UI code. // During initialization or between frames, feel free to just poke into ImGuiStyle directly. // - Tip: Use your programming IDE navigation facilities on the names in the _second column_ below to find the actual members and their description. // In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. // With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments. // - When changing this enum, you need to update the associated internal table GStyleVarInfo[] accordingly. This is where we link enum values to members offset/type. enum ImGuiStyleVar_ { // Enum name --------------------- // Member in ImGuiStyle structure (see ImGuiStyle for descriptions) ImGuiStyleVar_Alpha, // float Alpha ImGuiStyleVar_WindowPadding, // ImVec2 WindowPadding ImGuiStyleVar_WindowRounding, // float WindowRounding ImGuiStyleVar_WindowBorderSize, // float WindowBorderSize ImGuiStyleVar_WindowMinSize, // ImVec2 WindowMinSize ImGuiStyleVar_WindowTitleAlign, // ImVec2 WindowTitleAlign ImGuiStyleVar_ChildRounding, // float ChildRounding ImGuiStyleVar_ChildBorderSize, // float ChildBorderSize ImGuiStyleVar_PopupRounding, // float PopupRounding ImGuiStyleVar_PopupBorderSize, // float PopupBorderSize ImGuiStyleVar_FramePadding, // ImVec2 FramePadding ImGuiStyleVar_FrameRounding, // float FrameRounding ImGuiStyleVar_FrameBorderSize, // float FrameBorderSize ImGuiStyleVar_ItemSpacing, // ImVec2 ItemSpacing ImGuiStyleVar_ItemInnerSpacing, // ImVec2 ItemInnerSpacing ImGuiStyleVar_IndentSpacing, // float IndentSpacing ImGuiStyleVar_ScrollbarSize, // float ScrollbarSize ImGuiStyleVar_ScrollbarRounding, // float ScrollbarRounding ImGuiStyleVar_GrabMinSize, // float GrabMinSize ImGuiStyleVar_GrabRounding, // float GrabRounding ImGuiStyleVar_TabRounding, // float TabRounding ImGuiStyleVar_ButtonTextAlign, // ImVec2 ButtonTextAlign ImGuiStyleVar_SelectableTextAlign, // ImVec2 SelectableTextAlign ImGuiStyleVar_COUNT // Obsolete names (will be removed) #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS , ImGuiStyleVar_Count_ = ImGuiStyleVar_COUNT // [renamed in 1.60] #endif }; // Flags for InvisibleButton() [extended in imgui_internal.h] enum ImGuiButtonFlags_ { ImGuiButtonFlags_None = 0, ImGuiButtonFlags_MouseButtonLeft = 1 << 0, // React on left mouse button (default) ImGuiButtonFlags_MouseButtonRight = 1 << 1, // React on right mouse button ImGuiButtonFlags_MouseButtonMiddle = 1 << 2, // React on center mouse button // [Internal] ImGuiButtonFlags_MouseButtonMask_ = ImGuiButtonFlags_MouseButtonLeft | ImGuiButtonFlags_MouseButtonRight | ImGuiButtonFlags_MouseButtonMiddle, ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft }; // Flags for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton() enum ImGuiColorEditFlags_ { ImGuiColorEditFlags_None = 0, ImGuiColorEditFlags_NoAlpha = 1 << 1, // // ColorEdit, ColorPicker, ColorButton: ignore Alpha component (will only read 3 components from the input pointer). ImGuiColorEditFlags_NoPicker = 1 << 2, // // ColorEdit: disable picker when clicking on colored square. ImGuiColorEditFlags_NoOptions = 1 << 3, // // ColorEdit: disable toggling options menu when right-clicking on inputs/small preview. ImGuiColorEditFlags_NoSmallPreview = 1 << 4, // // ColorEdit, ColorPicker: disable colored square preview next to the inputs. (e.g. to show only the inputs) ImGuiColorEditFlags_NoInputs = 1 << 5, // // ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview colored square). ImGuiColorEditFlags_NoTooltip = 1 << 6, // // ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview. ImGuiColorEditFlags_NoLabel = 1 << 7, // // ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker). ImGuiColorEditFlags_NoSidePreview = 1 << 8, // // ColorPicker: disable bigger color preview on right side of the picker, use small colored square preview instead. ImGuiColorEditFlags_NoDragDrop = 1 << 9, // // ColorEdit: disable drag and drop target. ColorButton: disable drag and drop source. ImGuiColorEditFlags_NoBorder = 1 << 10, // // ColorButton: disable border (which is enforced by default) // User Options (right-click on widget to change some of them). ImGuiColorEditFlags_AlphaBar = 1 << 16, // // ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker. ImGuiColorEditFlags_AlphaPreview = 1 << 17, // // ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque. ImGuiColorEditFlags_AlphaPreviewHalf= 1 << 18, // // ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque. ImGuiColorEditFlags_HDR = 1 << 19, // // (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well). ImGuiColorEditFlags_DisplayRGB = 1 << 20, // [Display] // ColorEdit: override _display_ type among RGB/HSV/Hex. ColorPicker: select any combination using one or more of RGB/HSV/Hex. ImGuiColorEditFlags_DisplayHSV = 1 << 21, // [Display] // " ImGuiColorEditFlags_DisplayHex = 1 << 22, // [Display] // " ImGuiColorEditFlags_Uint8 = 1 << 23, // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255. ImGuiColorEditFlags_Float = 1 << 24, // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers. ImGuiColorEditFlags_PickerHueBar = 1 << 25, // [Picker] // ColorPicker: bar for Hue, rectangle for Sat/Value. ImGuiColorEditFlags_PickerHueWheel = 1 << 26, // [Picker] // ColorPicker: wheel for Hue, triangle for Sat/Value. ImGuiColorEditFlags_InputRGB = 1 << 27, // [Input] // ColorEdit, ColorPicker: input and output data in RGB format. ImGuiColorEditFlags_InputHSV = 1 << 28, // [Input] // ColorEdit, ColorPicker: input and output data in HSV format. // Defaults Options. You can set application defaults using SetColorEditOptions(). The intent is that you probably don't want to // override them in most of your calls. Let the user choose via the option menu and/or call SetColorEditOptions() once during startup. ImGuiColorEditFlags__OptionsDefault = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_PickerHueBar, // [Internal] Masks ImGuiColorEditFlags__DisplayMask = ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_DisplayHex, ImGuiColorEditFlags__DataTypeMask = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_Float, ImGuiColorEditFlags__PickerMask = ImGuiColorEditFlags_PickerHueWheel | ImGuiColorEditFlags_PickerHueBar, ImGuiColorEditFlags__InputMask = ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_InputHSV // Obsolete names (will be removed) #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS , ImGuiColorEditFlags_RGB = ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFlags_HSV = ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_HEX = ImGuiColorEditFlags_DisplayHex // [renamed in 1.69] #endif }; // Flags for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc. // We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them. enum ImGuiSliderFlags_ { ImGuiSliderFlags_None = 0, ImGuiSliderFlags_ClampOnInput = 1 << 4, // Clamp value to min/max bounds when input manually with CTRL+Click. By default CTRL+Click allows going out of bounds. ImGuiSliderFlags_Logarithmic = 1 << 5, // Make the widget logarithmic (linear otherwise). Consider using ImGuiSliderFlags_NoRoundToFormat with this if using a format-string with small amount of digits. ImGuiSliderFlags_NoRoundToFormat = 1 << 6, // Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits) ImGuiSliderFlags_NoInput = 1 << 7, // Disable CTRL+Click or Enter key allowing to input text directly into the widget ImGuiSliderFlags_InvalidMask_ = 0x7000000F // [Internal] We treat using those bits as being potentially a 'float power' argument from the previous API that has got miscast to this enum, and will trigger an assert if needed. }; // Identify a mouse button. // Those values are guaranteed to be stable and we frequently use 0/1 directly. Named enums provided for convenience. enum ImGuiMouseButton_ { ImGuiMouseButton_Left = 0, ImGuiMouseButton_Right = 1, ImGuiMouseButton_Middle = 2, ImGuiMouseButton_COUNT = 5 }; // Enumeration for GetMouseCursor() // User code may request binding to display given cursor by calling SetMouseCursor(), which is why we have some cursors that are marked unused here enum ImGuiMouseCursor_ { ImGuiMouseCursor_None = -1, ImGuiMouseCursor_Arrow = 0, ImGuiMouseCursor_TextInput, // When hovering over InputText, etc. ImGuiMouseCursor_ResizeAll, // (Unused by Dear ImGui functions) ImGuiMouseCursor_ResizeNS, // When hovering over an horizontal border ImGuiMouseCursor_ResizeEW, // When hovering over a vertical border or a column ImGuiMouseCursor_ResizeNESW, // When hovering over the bottom-left corner of a window ImGuiMouseCursor_ResizeNWSE, // When hovering over the bottom-right corner of a window ImGuiMouseCursor_Hand, // (Unused by Dear ImGui functions. Use for e.g. hyperlinks) ImGuiMouseCursor_NotAllowed, // When hovering something with disallowed interaction. Usually a crossed circle. ImGuiMouseCursor_COUNT // Obsolete names (will be removed) #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS , ImGuiMouseCursor_Count_ = ImGuiMouseCursor_COUNT // [renamed in 1.60] #endif }; // Enumeration for ImGui::SetWindow***(), SetNextWindow***(), SetNextItem***() functions // Represent a condition. // Important: Treat as a regular enum! Do NOT combine multiple values using binary operators! All the functions above treat 0 as a shortcut to ImGuiCond_Always. enum ImGuiCond_ { ImGuiCond_None = 0, // No condition (always set the variable), same as _Always ImGuiCond_Always = 1 << 0, // No condition (always set the variable) ImGuiCond_Once = 1 << 1, // Set the variable once per runtime session (only the first call will succeed) ImGuiCond_FirstUseEver = 1 << 2, // Set the variable if the object/window has no persistently saved data (no entry in .ini file) ImGuiCond_Appearing = 1 << 3 // Set the variable if the object/window is appearing after being hidden/inactive (or the first time) }; //----------------------------------------------------------------------------- // Helpers: Memory allocations macros // IM_MALLOC(), IM_FREE(), IM_NEW(), IM_PLACEMENT_NEW(), IM_DELETE() // We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax. // Defining a custom placement new() with a custom parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions. //----------------------------------------------------------------------------- struct ImNewWrapper {}; inline void* operator new(size_t, ImNewWrapper, void* ptr) { return ptr; } inline void operator delete(void*, ImNewWrapper, void*) {} // This is only required so we can use the symmetrical new() #define IM_ALLOC(_SIZE) ImGui::MemAlloc(_SIZE) #define IM_FREE(_PTR) ImGui::MemFree(_PTR) #define IM_PLACEMENT_NEW(_PTR) new(ImNewWrapper(), _PTR) #define IM_NEW(_TYPE) new(ImNewWrapper(), ImGui::MemAlloc(sizeof(_TYPE))) _TYPE template<typename T> void IM_DELETE(T* p) { if (p) { p->~T(); ImGui::MemFree(p); } } //----------------------------------------------------------------------------- // Helper: ImVector<> // Lightweight std::vector<>-like class to avoid dragging dependencies (also, some implementations of STL with debug enabled are absurdly slow, we bypass it so our code runs fast in debug). //----------------------------------------------------------------------------- // - You generally do NOT need to care or use this ever. But we need to make it available in imgui.h because some of our public structures are relying on it. // - We use std-like naming convention here, which is a little unusual for this codebase. // - Important: clear() frees memory, resize(0) keep the allocated buffer. We use resize(0) a lot to intentionally recycle allocated buffers across frames and amortize our costs. // - Important: our implementation does NOT call C++ constructors/destructors, we treat everything as raw data! This is intentional but be extra mindful of that, // Do NOT use this class as a std::vector replacement in your own code! Many of the structures used by dear imgui can be safely initialized by a zero-memset. //----------------------------------------------------------------------------- template<typename T> struct ImVector { int Size; int Capacity; T* Data; // Provide standard typedefs but we don't use them ourselves. typedef T value_type; typedef value_type* iterator; typedef const value_type* const_iterator; // Constructors, destructor inline ImVector() { Size = Capacity = 0; Data = NULL; } inline ImVector(const ImVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); } inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; } inline ~ImVector() { if (Data) IM_FREE(Data); } inline bool empty() const { return Size == 0; } inline int size() const { return Size; } inline int size_in_bytes() const { return Size * (int)sizeof(T); } inline int max_size() const { return 0x7FFFFFFF / (int)sizeof(T); } inline int capacity() const { return Capacity; } inline T& operator[](int i) { IM_ASSERT(i < Size); return Data[i]; } inline const T& operator[](int i) const { IM_ASSERT(i < Size); return Data[i]; } inline void clear() { if (Data) { Size = Capacity = 0; IM_FREE(Data); Data = NULL; } } inline T* begin() { return Data; } inline const T* begin() const { return Data; } inline T* end() { return Data + Size; } inline const T* end() const { return Data + Size; } inline T& front() { IM_ASSERT(Size > 0); return Data[0]; } inline const T& front() const { IM_ASSERT(Size > 0); return Data[0]; } inline T& back() { IM_ASSERT(Size > 0); return Data[Size - 1]; } inline const T& back() const { IM_ASSERT(Size > 0); return Data[Size - 1]; } inline void swap(ImVector<T>& rhs) { int rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; int rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; T* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; } inline int _grow_capacity(int sz) const { int new_capacity = Capacity ? (Capacity + Capacity / 2) : 8; return new_capacity > sz ? new_capacity : sz; } inline void resize(int new_size) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; } inline void resize(int new_size, const T& v) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); if (new_size > Size) for (int n = Size; n < new_size; n++) memcpy(&Data[n], &v, sizeof(v)); Size = new_size; } inline void shrink(int new_size) { IM_ASSERT(new_size <= Size); Size = new_size; } // Resize a vector to a smaller size, guaranteed not to cause a reallocation inline void reserve(int new_capacity) { if (new_capacity <= Capacity) return; T* new_data = (T*)IM_ALLOC((size_t)new_capacity * sizeof(T)); if (Data) { memcpy(new_data, Data, (size_t)Size * sizeof(T)); IM_FREE(Data); } Data = new_data; Capacity = new_capacity; } // NB: It is illegal to call push_back/push_front/insert with a reference pointing inside the ImVector data itself! e.g. v.push_back(v[10]) is forbidden. inline void push_back(const T& v) { if (Size == Capacity) reserve(_grow_capacity(Size + 1)); memcpy(&Data[Size], &v, sizeof(v)); Size++; } inline void pop_back() { IM_ASSERT(Size > 0); Size--; } inline void push_front(const T& v) { if (Size == 0) push_back(v); else insert(Data, v); } inline T* erase(const T* it) { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(T)); Size--; return Data + off; } inline T* erase(const T* it, const T* it_last){ IM_ASSERT(it >= Data && it < Data + Size && it_last > it && it_last <= Data + Size); const ptrdiff_t count = it_last - it; const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((size_t)Size - (size_t)off - count) * sizeof(T)); Size -= (int)count; return Data + off; } inline T* erase_unsorted(const T* it) { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; if (it < Data + Size - 1) memcpy(Data + off, Data + Size - 1, sizeof(T)); Size--; return Data + off; } inline T* insert(const T* it, const T& v) { IM_ASSERT(it >= Data && it <= Data + Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(T)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; } inline bool contains(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; } inline T* find(const T& v) { T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data == v) break; else ++data; return data; } inline const T* find(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data == v) break; else ++data; return data; } inline bool find_erase(const T& v) { const T* it = find(v); if (it < Data + Size) { erase(it); return true; } return false; } inline bool find_erase_unsorted(const T& v) { const T* it = find(v); if (it < Data + Size) { erase_unsorted(it); return true; } return false; } inline int index_from_ptr(const T* it) const { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; return (int)off; } }; //----------------------------------------------------------------------------- // ImGuiStyle // You may modify the ImGui::GetStyle() main instance during initialization and before NewFrame(). // During the frame, use ImGui::PushStyleVar(ImGuiStyleVar_XXXX)/PopStyleVar() to alter the main style values, // and ImGui::PushStyleColor(ImGuiCol_XXX)/PopStyleColor() for colors. //----------------------------------------------------------------------------- struct ImGuiStyle { float Alpha; // Global alpha applies to everything in Dear ImGui. ImVec2 WindowPadding; // Padding within a window. float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows. Large values tend to lead to variety of artifacts and are not recommended. float WindowBorderSize; // Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). ImVec2 WindowMinSize; // Minimum window size. This is a global setting. If you want to constraint individual windows, use SetNextWindowSizeConstraints(). ImVec2 WindowTitleAlign; // Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered. ImGuiDir WindowMenuButtonPosition; // Side of the collapsing/docking button in the title bar (None/Left/Right). Defaults to ImGuiDir_Left. float ChildRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows. float ChildBorderSize; // Thickness of border around child windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). float PopupRounding; // Radius of popup window corners rounding. (Note that tooltip windows use WindowRounding) float PopupBorderSize; // Thickness of border around popup/tooltip windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). ImVec2 FramePadding; // Padding within a framed rectangle (used by most widgets). float FrameRounding; // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets). float FrameBorderSize; // Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). ImVec2 ItemSpacing; // Horizontal and vertical spacing between widgets/lines. ImVec2 ItemInnerSpacing; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label). ImVec2 TouchExtraPadding; // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much! float IndentSpacing; // Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). float ColumnsMinSpacing; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1). float ScrollbarSize; // Width of the vertical scrollbar, Height of the horizontal scrollbar. float ScrollbarRounding; // Radius of grab corners for scrollbar. float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar. float GrabRounding; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. float LogSliderDeadzone; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero. float TabRounding; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs. float TabBorderSize; // Thickness of border around tabs. float TabMinWidthForUnselectedCloseButton; // Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected. ImGuiDir ColorButtonPosition; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right. ImVec2 ButtonTextAlign; // Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered). ImVec2 SelectableTextAlign; // Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line. ImVec2 DisplayWindowPadding; // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows. ImVec2 DisplaySafeAreaPadding; // If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly! float MouseCursorScale; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). We apply per-monitor DPI scaling over this scale. May be removed later. bool AntiAliasedLines; // Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList). bool AntiAliasedLinesUseTex; // Enable anti-aliased lines/borders using textures where possible. Require back-end to render with bilinear filtering. Latched at the beginning of the frame (copied to ImDrawList). bool AntiAliasedFill; // Enable anti-aliased edges around filled shapes (rounded rectangles, circles, etc.). Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList). float CurveTessellationTol; // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. float CircleSegmentMaxError; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry. ImVec4 Colors[ImGuiCol_COUNT]; IMGUI_API ImGuiStyle(); IMGUI_API void ScaleAllSizes(float scale_factor); }; //----------------------------------------------------------------------------- // ImGuiIO // Communicate most settings and inputs/outputs to Dear ImGui using this structure. // Access via ImGui::GetIO(). Read 'Programmer guide' section in .cpp file for general usage. //----------------------------------------------------------------------------- struct ImGuiIO { //------------------------------------------------------------------ // Configuration (fill once) // Default value //------------------------------------------------------------------ ImGuiConfigFlags ConfigFlags; // = 0 // See ImGuiConfigFlags_ enum. Set by user/application. Gamepad/keyboard navigation options, etc. ImGuiBackendFlags BackendFlags; // = 0 // See ImGuiBackendFlags_ enum. Set by back-end (imgui_impl_xxx files or custom back-end) to communicate features supported by the back-end. ImVec2 DisplaySize; // <unset> // Main display size, in pixels. This is for the default viewport. float DeltaTime; // = 1.0f/60.0f // Time elapsed since last frame, in seconds. float IniSavingRate; // = 5.0f // Minimum time between saving positions/sizes to .ini file, in seconds. const char* IniFilename; // = "imgui.ini" // Path to .ini file. Set NULL to disable automatic .ini loading/saving, if e.g. you want to manually load/save from memory. const char* LogFilename; // = "imgui_log.txt"// Path to .log file (default parameter to ImGui::LogToFile when no file is specified). float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds. float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels. float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging. int KeyMap[ImGuiKey_COUNT]; // <unset> // Map of indices into the KeysDown[512] entries array which represent your "native" keyboard state. float KeyRepeatDelay; // = 0.250f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.). float KeyRepeatRate; // = 0.050f // When holding a key/button, rate at which it repeats, in seconds. void* UserData; // = NULL // Store your own data for retrieval by callbacks. ImFontAtlas*Fonts; // <auto> // Font atlas: load, rasterize and pack one or more fonts into a single texture. float FontGlobalScale; // = 1.0f // Global scale all fonts bool FontAllowUserScaling; // = false // Allow user scaling text of individual window with CTRL+Wheel. ImFont* FontDefault; // = NULL // Font to use on NewFrame(). Use NULL to uses Fonts->Fonts[0]. ImVec2 DisplayFramebufferScale; // = (1, 1) // For retina display or other situations where window coordinates are different from framebuffer coordinates. This generally ends up in ImDrawData::FramebufferScale. // Docking options (when ImGuiConfigFlags_DockingEnable is set) bool ConfigDockingNoSplit; // = false // Simplified docking mode: disable window splitting, so docking is limited to merging multiple windows together into tab-bars. bool ConfigDockingWithShift; // = false // Enable docking with holding Shift key (reduce visual noise, allows dropping in wider space) bool ConfigDockingAlwaysTabBar; // = false // [BETA] [FIXME: This currently creates regression with auto-sizing and general overhead] Make every single floating window display within a docking node. bool ConfigDockingTransparentPayload;// = false // [BETA] Make window or viewport transparent when docking and only display docking boxes on the target viewport. Useful if rendering of multiple viewport cannot be synced. Best used with ConfigViewportsNoAutoMerge. // Viewport options (when ImGuiConfigFlags_ViewportsEnable is set) bool ConfigViewportsNoAutoMerge; // = false; // Set to make all floating imgui windows always create their own viewport. Otherwise, they are merged into the main host viewports when overlapping it. May also set ImGuiViewportFlags_NoAutoMerge on individual viewport. bool ConfigViewportsNoTaskBarIcon; // = false // Disable default OS task bar icon flag for secondary viewports. When a viewport doesn't want a task bar icon, ImGuiViewportFlags_NoTaskBarIcon will be set on it. bool ConfigViewportsNoDecoration; // = true // [BETA] Disable default OS window decoration flag for secondary viewports. When a viewport doesn't want window decorations, ImGuiViewportFlags_NoDecoration will be set on it. Enabling decoration can create subsequent issues at OS levels (e.g. minimum window size). bool ConfigViewportsNoDefaultParent; // = false // Disable default OS parenting to main viewport for secondary viewports. By default, viewports are marked with ParentViewportId = <main_viewport>, expecting the platform back-end to setup a parent/child relationship between the OS windows (some back-end may ignore this). Set to true if you want the default to be 0, then all viewports will be top-level OS windows. // Miscellaneous options bool MouseDrawCursor; // = false // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by back-end implementations. bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl (was called io.OptMacOSXBehaviors prior to 1.63) bool ConfigInputTextCursorBlink; // = true // Set to false to disable blinking cursor, for users who consider it distracting. (was called: io.OptCursorBlink prior to 1.63) bool ConfigWindowsResizeFromEdges; // = true // Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag) bool ConfigWindowsMoveFromTitleBarOnly; // = false // [BETA] Set to true to only allow moving windows when clicked+dragged from the title bar. Windows without a title bar are not affected. float ConfigWindowsMemoryCompactTimer;// = 60.0f // [BETA] Compact window memory usage when unused. Set to -1.0f to disable. //------------------------------------------------------------------ // Platform Functions // (the imgui_impl_xxxx back-end files are setting those up for you) //------------------------------------------------------------------ // Optional: Platform/Renderer back-end name (informational only! will be displayed in About Window) + User data for back-end/wrappers to store their own stuff. const char* BackendPlatformName; // = NULL const char* BackendRendererName; // = NULL void* BackendPlatformUserData; // = NULL // User data for platform back-end void* BackendRendererUserData; // = NULL // User data for renderer back-end void* BackendLanguageUserData; // = NULL // User data for non C++ programming language back-end // Optional: Access OS clipboard // (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures) const char* (*GetClipboardTextFn)(void* user_data); void (*SetClipboardTextFn)(void* user_data, const char* text); void* ClipboardUserData; #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS // [OBSOLETE since 1.60+] Rendering function, will be automatically called in Render(). Please call your rendering function yourself now! // You can obtain the ImDrawData* by calling ImGui::GetDrawData() after Render(). See example applications if you are unsure of how to implement this. void (*RenderDrawListsFn)(ImDrawData* data); #else // This is only here to keep ImGuiIO the same size/layout, so that IMGUI_DISABLE_OBSOLETE_FUNCTIONS can exceptionally be used outside of imconfig.h. void* RenderDrawListsFnUnused; #endif //------------------------------------------------------------------ // Input - Fill before calling NewFrame() //------------------------------------------------------------------ ImVec2 MousePos; // Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.) bool MouseDown[5]; // Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons. Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API. float MouseWheel; // Mouse wheel Vertical: 1 unit scrolls about 5 lines text. float MouseWheelH; // Mouse wheel Horizontal. Most users don't have a mouse with an horizontal wheel, may not be filled by all back-ends. ImGuiID MouseHoveredViewport; // (Optional) When using multiple viewports: viewport the OS mouse cursor is hovering _IGNORING_ viewports with the ImGuiViewportFlags_NoInputs flag, and _REGARDLESS_ of whether another viewport is focused. Set io.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport if you can provide this info. If you don't imgui will infer the value using the rectangles and last focused time of the viewports it knows about (ignoring other OS windows). bool KeyCtrl; // Keyboard modifier pressed: Control bool KeyShift; // Keyboard modifier pressed: Shift bool KeyAlt; // Keyboard modifier pressed: Alt bool KeySuper; // Keyboard modifier pressed: Cmd/Super/Windows bool KeysDown[512]; // Keyboard keys that are pressed (ideally left in the "native" order your engine has access to keyboard keys, so you can use your own defines/enums for keys). float NavInputs[ImGuiNavInput_COUNT]; // Gamepad inputs. Cleared back to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by NewFrame(). // Functions IMGUI_API void AddInputCharacter(unsigned int c); // Queue new character input IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue new character input from an UTF-16 character, it can be a surrogate IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue new characters input from an UTF-8 string IMGUI_API void ClearInputCharacters(); // Clear the text input buffer manually //------------------------------------------------------------------ // Output - Updated by NewFrame() or EndFrame()/Render() // (when reading from the io.WantCaptureMouse, io.WantCaptureKeyboard flags to dispatch your inputs, it is // generally easier and more correct to use their state BEFORE calling NewFrame(). See FAQ for details!) //------------------------------------------------------------------ bool WantCaptureMouse; // Set when Dear ImGui will use mouse inputs, in this case do not dispatch them to your main game/application (either way, always pass on mouse inputs to imgui). (e.g. unclicked mouse is hovering over an imgui window, widget is active, mouse was clicked over an imgui window, etc.). bool WantCaptureKeyboard; // Set when Dear ImGui will use keyboard inputs, in this case do not dispatch them to your main game/application (either way, always pass keyboard inputs to imgui). (e.g. InputText active, or an imgui window is focused and navigation is enabled, etc.). bool WantTextInput; // Mobile/console: when set, you may display an on-screen keyboard. This is set by Dear ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active). bool WantSetMousePos; // MousePos has been altered, back-end should reposition mouse on next frame. Rarely used! Set only when ImGuiConfigFlags_NavEnableSetMousePos flag is enabled. bool WantSaveIniSettings; // When manual .ini load/save is active (io.IniFilename == NULL), this will be set to notify your application that you can call SaveIniSettingsToMemory() and save yourself. Important: clear io.WantSaveIniSettings yourself after saving! bool NavActive; // Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag. bool NavVisible; // Keyboard/Gamepad navigation is visible and allowed (will handle ImGuiKey_NavXXX events). float Framerate; // Application framerate estimate, in frame per second. Solely for convenience. Rolling average estimation based on io.DeltaTime over 120 frames. int MetricsRenderVertices; // Vertices output during last call to Render() int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3 int MetricsRenderWindows; // Number of visible windows int MetricsActiveWindows; // Number of active windows int MetricsActiveAllocations; // Number of active allocations, updated by MemAlloc/MemFree based on current context. May be off if you have multiple imgui contexts. ImVec2 MouseDelta; // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta. //------------------------------------------------------------------ // [Internal] Dear ImGui will maintain those fields. Forward compatibility not guaranteed! //------------------------------------------------------------------ ImGuiKeyModFlags KeyMods; // Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame() ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid) ImVec2 MouseClickedPos[5]; // Position at time of clicking double MouseClickedTime[5]; // Time of last click (used to figure out double-click) bool MouseClicked[5]; // Mouse button went from !Down to Down bool MouseDoubleClicked[5]; // Has mouse button been double-clicked? bool MouseReleased[5]; // Mouse button went from Down to !Down bool MouseDownOwned[5]; // Track if button was clicked inside a dear imgui window. We don't request mouse capture from the application if click started outside ImGui bounds. bool MouseDownWasDoubleClick[5]; // Track if button down was a double-click float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked) float MouseDownDurationPrev[5]; // Previous time the mouse button has been down ImVec2 MouseDragMaxDistanceAbs[5]; // Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the clicking point float KeysDownDuration[512]; // Duration the keyboard key has been down (0.0f == just pressed) float KeysDownDurationPrev[512]; // Previous duration the key has been down float NavInputsDownDuration[ImGuiNavInput_COUNT]; float NavInputsDownDurationPrev[ImGuiNavInput_COUNT]; float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui. ImWchar16 InputQueueSurrogate; // For AddInputCharacterUTF16 ImVector<ImWchar> InputQueueCharacters; // Queue of _characters_ input (obtained by platform back-end). Fill using AddInputCharacter() helper. IMGUI_API ImGuiIO(); }; //----------------------------------------------------------------------------- // Misc data structures //----------------------------------------------------------------------------- // Shared state of InputText(), passed as an argument to your callback when a ImGuiInputTextFlags_Callback* flag is used. // The callback function should return 0 by default. // Callbacks (follow a flag name and see comments in ImGuiInputTextFlags_ declarations for more details) // - ImGuiInputTextFlags_CallbackEdit: Callback on buffer edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active) // - ImGuiInputTextFlags_CallbackAlways: Callback on each iteration // - ImGuiInputTextFlags_CallbackCompletion: Callback on pressing TAB // - ImGuiInputTextFlags_CallbackHistory: Callback on pressing Up/Down arrows // - ImGuiInputTextFlags_CallbackCharFilter: Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard. // - ImGuiInputTextFlags_CallbackResize: Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. struct ImGuiInputTextCallbackData { ImGuiInputTextFlags EventFlag; // One ImGuiInputTextFlags_Callback* // Read-only ImGuiInputTextFlags Flags; // What user passed to InputText() // Read-only void* UserData; // What user passed to InputText() // Read-only // Arguments for the different callback events // - To modify the text buffer in a callback, prefer using the InsertChars() / DeleteChars() function. InsertChars() will take care of calling the resize callback if necessary. // - If you know your edits are not going to resize the underlying buffer allocation, you may modify the contents of 'Buf[]' directly. You need to update 'BufTextLen' accordingly (0 <= BufTextLen < BufSize) and set 'BufDirty'' to true so InputText can update its internal state. ImWchar EventChar; // Character input // Read-write // [CharFilter] Replace character with another one, or set to zero to drop. return 1 is equivalent to setting EventChar=0; ImGuiKey EventKey; // Key pressed (Up/Down/TAB) // Read-only // [Completion,History] char* Buf; // Text buffer // Read-write // [Resize] Can replace pointer / [Completion,History,Always] Only write to pointed data, don't replace the actual pointer! int BufTextLen; // Text length (in bytes) // Read-write // [Resize,Completion,History,Always] Exclude zero-terminator storage. In C land: == strlen(some_text), in C++ land: string.length() int BufSize; // Buffer size (in bytes) = capacity+1 // Read-only // [Resize,Completion,History,Always] Include zero-terminator storage. In C land == ARRAYSIZE(my_char_array), in C++ land: string.capacity()+1 bool BufDirty; // Set if you modify Buf/BufTextLen! // Write // [Completion,History,Always] int CursorPos; // // Read-write // [Completion,History,Always] int SelectionStart; // // Read-write // [Completion,History,Always] == to SelectionEnd when no selection) int SelectionEnd; // // Read-write // [Completion,History,Always] // Helper functions for text manipulation. // Use those function to benefit from the CallbackResize behaviors. Calling those function reset the selection. IMGUI_API ImGuiInputTextCallbackData(); IMGUI_API void DeleteChars(int pos, int bytes_count); IMGUI_API void InsertChars(int pos, const char* text, const char* text_end = NULL); void SelectAll() { SelectionStart = 0; SelectionEnd = BufTextLen; } void ClearSelection() { SelectionStart = SelectionEnd = BufTextLen; } bool HasSelection() const { return SelectionStart != SelectionEnd; } }; // Resizing callback data to apply custom constraint. As enabled by SetNextWindowSizeConstraints(). Callback is called during the next Begin(). // NB: For basic min/max size constraint on each axis you don't need to use the callback! The SetNextWindowSizeConstraints() parameters are enough. struct ImGuiSizeCallbackData { void* UserData; // Read-only. What user passed to SetNextWindowSizeConstraints() ImVec2 Pos; // Read-only. Window position, for reference. ImVec2 CurrentSize; // Read-only. Current window size. ImVec2 DesiredSize; // Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing. }; // [ALPHA] Rarely used / very advanced uses only. Use with SetNextWindowClass() and DockSpace() functions. // Important: the content of this class is still highly WIP and likely to change and be refactored // before we stabilize Docking features. Please be mindful if using this. // Provide hints: // - To the platform back-end via altered viewport flags (enable/disable OS decoration, OS task bar icons, etc.) // - To the platform back-end for OS level parent/child relationships of viewport. // - To the docking system for various options and filtering. struct ImGuiWindowClass { ImGuiID ClassId; // User data. 0 = Default class (unclassed). Windows of different classes cannot be docked with each others. ImGuiID ParentViewportId; // Hint for the platform back-end. If non-zero, the platform back-end can create a parent<>child relationship between the platform windows. Not conforming back-ends are free to e.g. parent every viewport to the main viewport or not. ImGuiViewportFlags ViewportFlagsOverrideSet; // Viewport flags to set when a window of this class owns a viewport. This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis. ImGuiViewportFlags ViewportFlagsOverrideClear; // Viewport flags to clear when a window of this class owns a viewport. This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis. ImGuiDockNodeFlags DockNodeFlagsOverrideSet; // [EXPERIMENTAL] Dock node flags to set when a window of this class is hosted by a dock node (it doesn't have to be selected!) ImGuiDockNodeFlags DockNodeFlagsOverrideClear; // [EXPERIMENTAL] bool DockingAlwaysTabBar; // Set to true to enforce single floating windows of this class always having their own docking node (equivalent of setting the global io.ConfigDockingAlwaysTabBar) bool DockingAllowUnclassed; // Set to true to allow windows of this class to be docked/merged with an unclassed window. // FIXME-DOCK: Move to DockNodeFlags override? ImGuiWindowClass() { ClassId = 0; ParentViewportId = 0; ViewportFlagsOverrideSet = ViewportFlagsOverrideClear = 0x00; DockNodeFlagsOverrideSet = DockNodeFlagsOverrideClear = 0x00; DockingAlwaysTabBar = false; DockingAllowUnclassed = true; } }; // Data payload for Drag and Drop operations: AcceptDragDropPayload(), GetDragDropPayload() struct ImGuiPayload { // Members void* Data; // Data (copied and owned by dear imgui) int DataSize; // Data size // [Internal] ImGuiID SourceId; // Source item id ImGuiID SourceParentId; // Source parent id (if available) int DataFrameCount; // Data timestamp char DataType[32 + 1]; // Data type tag (short user-supplied string, 32 characters max) bool Preview; // Set when AcceptDragDropPayload() was called and mouse has been hovering the target item (nb: handle overlapping drag targets) bool Delivery; // Set when AcceptDragDropPayload() was called and mouse button is released over the target item. ImGuiPayload() { Clear(); } void Clear() { SourceId = SourceParentId = 0; Data = NULL; DataSize = 0; memset(DataType, 0, sizeof(DataType)); DataFrameCount = -1; Preview = Delivery = false; } bool IsDataType(const char* type) const { return DataFrameCount != -1 && strcmp(type, DataType) == 0; } bool IsPreview() const { return Preview; } bool IsDelivery() const { return Delivery; } }; //----------------------------------------------------------------------------- // Obsolete functions (Will be removed! Read 'API BREAKING CHANGES' section in imgui.cpp for details) // Please keep your copy of dear imgui up to date! Occasionally set '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' in imconfig.h to stay ahead. //----------------------------------------------------------------------------- #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS namespace ImGui { // OBSOLETED in 1.79 (from August 2020) static inline void OpenPopupContextItem(const char* str_id = NULL, ImGuiMouseButton mb = 1) { OpenPopupOnItemClick(str_id, mb); } // Bool return value removed. Use IsWindowAppearing() in BeginPopup() instead. Renamed in 1.77, renamed back in 1.79. Sorry! // OBSOLETED in 1.78 (from June 2020) // Old drag/sliders functions that took a 'float power = 1.0' argument instead of flags. // For shared code, you can version check at compile-time with `#if IMGUI_VERSION_NUM >= 17704`. IMGUI_API bool DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min, const void* p_max, const char* format, float power); IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min, const void* p_max, const char* format, float power); static inline bool DragFloat(const char* label, float* v, float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalar(label, ImGuiDataType_Float, v, v_speed, &v_min, &v_max, format, power); } static inline bool DragFloat2(const char* label, float v[2], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 2, v_speed, &v_min, &v_max, format, power); } static inline bool DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, power); } static inline bool DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, power); } IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, float power); IMGUI_API bool SliderScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_min, const void* p_max, const char* format, float power); static inline bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format, float power) { return SliderScalar(label, ImGuiDataType_Float, v, &v_min, &v_max, format, power); } static inline bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format, float power) { return SliderScalarN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, power); } static inline bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format, float power) { return SliderScalarN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, power); } static inline bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format, float power) { return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power); } // OBSOLETED in 1.77 (from June 2020) static inline bool BeginPopupContextWindow(const char* str_id, ImGuiMouseButton mb, bool over_items) { return BeginPopupContextWindow(str_id, mb | (over_items ? 0 : ImGuiPopupFlags_NoOpenOverItems)); } // OBSOLETED in 1.72 (from April 2019) static inline void TreeAdvanceToLabelPos() { SetCursorPosX(GetCursorPosX() + GetTreeNodeToLabelSpacing()); } // OBSOLETED in 1.71 (from June 2019) static inline void SetNextTreeNodeOpen(bool open, ImGuiCond cond = 0) { SetNextItemOpen(open, cond); } // OBSOLETED in 1.70 (from May 2019) static inline float GetContentRegionAvailWidth() { return GetContentRegionAvail().x; } // OBSOLETED in 1.69 (from Mar 2019) static inline ImDrawList* GetOverlayDrawList() { return GetForegroundDrawList(); } // OBSOLETED in 1.66 (from Sep 2018) static inline void SetScrollHere(float center_ratio=0.5f){ SetScrollHereY(center_ratio); } // OBSOLETED in 1.63 (between Aug 2018 and Sept 2018) static inline bool IsItemDeactivatedAfterChange() { return IsItemDeactivatedAfterEdit(); } // OBSOLETED in 1.61 (between Apr 2018 and Aug 2018) IMGUI_API bool InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags flags = 0); // Use the 'const char* format' version instead of 'decimal_precision'! IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags flags = 0); IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags flags = 0); IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags flags = 0); // OBSOLETED in 1.60 (between Dec 2017 and Apr 2018) static inline bool IsAnyWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); } static inline bool IsAnyWindowHovered() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } } typedef ImGuiInputTextCallback ImGuiTextEditCallback; // OBSOLETED in 1.63 (from Aug 2018): made the names consistent typedef ImGuiInputTextCallbackData ImGuiTextEditCallbackData; #endif //----------------------------------------------------------------------------- // Helpers //----------------------------------------------------------------------------- // Helper: Unicode defines #define IM_UNICODE_CODEPOINT_INVALID 0xFFFD // Invalid Unicode code point (standard value). #ifdef IMGUI_USE_WCHAR32 #define IM_UNICODE_CODEPOINT_MAX 0x10FFFF // Maximum Unicode code point supported by this build. #else #define IM_UNICODE_CODEPOINT_MAX 0xFFFF // Maximum Unicode code point supported by this build. #endif // Helper: Execute a block of code at maximum once a frame. Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame. // Usage: static ImGuiOnceUponAFrame oaf; if (oaf) ImGui::Text("This will be called only once per frame"); struct ImGuiOnceUponAFrame { ImGuiOnceUponAFrame() { RefFrame = -1; } mutable int RefFrame; operator bool() const { int current_frame = ImGui::GetFrameCount(); if (RefFrame == current_frame) return false; RefFrame = current_frame; return true; } }; // Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" struct ImGuiTextFilter { IMGUI_API ImGuiTextFilter(const char* default_filter = ""); IMGUI_API bool Draw(const char* label = "Filter (inc,-exc)", float width = 0.0f); // Helper calling InputText+Build IMGUI_API bool PassFilter(const char* text, const char* text_end = NULL) const; IMGUI_API void Build(); void Clear() { InputBuf[0] = 0; Build(); } bool IsActive() const { return !Filters.empty(); } // [Internal] struct ImGuiTextRange { const char* b; const char* e; ImGuiTextRange() { b = e = NULL; } ImGuiTextRange(const char* _b, const char* _e) { b = _b; e = _e; } bool empty() const { return b == e; } IMGUI_API void split(char separator, ImVector<ImGuiTextRange>* out) const; }; char InputBuf[256]; ImVector<ImGuiTextRange>Filters; int CountGrep; }; // Helper: Growable text buffer for logging/accumulating text // (this could be called 'ImGuiTextBuilder' / 'ImGuiStringBuilder') struct ImGuiTextBuffer { ImVector<char> Buf; IMGUI_API static char EmptyString[1]; ImGuiTextBuffer() { } inline char operator[](int i) const { IM_ASSERT(Buf.Data != NULL); return Buf.Data[i]; } const char* begin() const { return Buf.Data ? &Buf.front() : EmptyString; } const char* end() const { return Buf.Data ? &Buf.back() : EmptyString; } // Buf is zero-terminated, so end() will point on the zero-terminator int size() const { return Buf.Size ? Buf.Size - 1 : 0; } bool empty() const { return Buf.Size <= 1; } void clear() { Buf.clear(); } void reserve(int capacity) { Buf.reserve(capacity); } const char* c_str() const { return Buf.Data ? Buf.Data : EmptyString; } IMGUI_API void append(const char* str, const char* str_end = NULL); IMGUI_API void appendf(const char* fmt, ...) IM_FMTARGS(2); IMGUI_API void appendfv(const char* fmt, va_list args) IM_FMTLIST(2); }; // Helper: Key->Value storage // Typically you don't have to worry about this since a storage is held within each Window. // We use it to e.g. store collapse state for a tree (Int 0/1) // This is optimized for efficient lookup (dichotomy into a contiguous buffer) and rare insertion (typically tied to user interactions aka max once a frame) // You can use it as custom user storage for temporary values. Declare your own storage if, for example: // - You want to manipulate the open/close state of a particular sub-tree in your interface (tree node uses Int 0/1 to store their state). // - You want to store custom debug data easily without adding or editing structures in your code (probably not efficient, but convenient) // Types are NOT stored, so it is up to you to make sure your Key don't collide with different types. struct ImGuiStorage { // [Internal] struct ImGuiStoragePair { ImGuiID key; union { int val_i; float val_f; void* val_p; }; ImGuiStoragePair(ImGuiID _key, int _val_i) { key = _key; val_i = _val_i; } ImGuiStoragePair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; } ImGuiStoragePair(ImGuiID _key, void* _val_p) { key = _key; val_p = _val_p; } }; ImVector<ImGuiStoragePair> Data; // - Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N) // - Set***() functions find pair, insertion on demand if missing. // - Sorted insertion is costly, paid once. A typical frame shouldn't need to insert any new pair. void Clear() { Data.clear(); } IMGUI_API int GetInt(ImGuiID key, int default_val = 0) const; IMGUI_API void SetInt(ImGuiID key, int val); IMGUI_API bool GetBool(ImGuiID key, bool default_val = false) const; IMGUI_API void SetBool(ImGuiID key, bool val); IMGUI_API float GetFloat(ImGuiID key, float default_val = 0.0f) const; IMGUI_API void SetFloat(ImGuiID key, float val); IMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL IMGUI_API void SetVoidPtr(ImGuiID key, void* val); // - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set. // - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer. // - A typical use case where this is convenient for quick hacking (e.g. add storage during a live Edit&Continue session if you can't modify existing struct) // float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar; IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0); IMGUI_API bool* GetBoolRef(ImGuiID key, bool default_val = false); IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0.0f); IMGUI_API void** GetVoidPtrRef(ImGuiID key, void* default_val = NULL); // Use on your own storage if you know only integer are being stored (open/close all tree nodes) IMGUI_API void SetAllInt(int val); // For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once. IMGUI_API void BuildSortByKey(); }; // Helper: Manually clip large list of items. // If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse clipping based on visibility to save yourself from processing those items at all. // The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped. // ImGui already clip items based on their bounds but it needs to measure text size to do so. Coarse clipping before submission makes this cost and your own data fetching/submission cost null. // Usage: // ImGuiListClipper clipper(1000); // we have 1000 elements, evenly spaced. // while (clipper.Step()) // for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) // ImGui::Text("line number %d", i); // - Step 0: the clipper let you process the first element, regardless of it being visible or not, so we can measure the element height (step skipped if we passed a known height as second arg to constructor). // - Step 1: the clipper infer height from first element, calculate the actual range of elements to display, and position the cursor before the first element. // - (Step 2: empty step only required if an explicit items_height was passed to constructor or Begin() and user call Step(). Does nothing and switch to Step 3.) // - Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns 'false' to end the loop. struct ImGuiListClipper { int DisplayStart, DisplayEnd; int ItemsCount; // [Internal] int StepNo; float ItemsHeight; float StartPosY; // items_count: Use -1 to ignore (you can call Begin later). Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step). // items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing(). // If you don't specify an items_height, you NEED to call Step(). If you specify items_height you may call the old Begin()/End() api directly, but prefer calling Step(). ImGuiListClipper(int items_count = -1, float items_height = -1.0f) { Begin(items_count, items_height); } // NB: Begin() initialize every fields (as we allow user to call Begin/End multiple times on a same instance if they want). ~ImGuiListClipper() { IM_ASSERT(ItemsCount == -1); } // Assert if user forgot to call End() or Step() until false. IMGUI_API bool Step(); // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items. IMGUI_API void Begin(int items_count, float items_height = -1.0f); // Automatically called by constructor if you passed 'items_count' or by Step() in Step 1. IMGUI_API void End(); // Automatically called on the last call of Step() that returns false. }; // Helpers macros to generate 32-bit encoded colors #ifdef IMGUI_USE_BGRA_PACKED_COLOR #define IM_COL32_R_SHIFT 16 #define IM_COL32_G_SHIFT 8 #define IM_COL32_B_SHIFT 0 #define IM_COL32_A_SHIFT 24 #define IM_COL32_A_MASK 0xFF000000 #else #define IM_COL32_R_SHIFT 0 #define IM_COL32_G_SHIFT 8 #define IM_COL32_B_SHIFT 16 #define IM_COL32_A_SHIFT 24 #define IM_COL32_A_MASK 0xFF000000 #endif #define IM_COL32(R,G,B,A) (((ImU32)(A)<<IM_COL32_A_SHIFT) | ((ImU32)(B)<<IM_COL32_B_SHIFT) | ((ImU32)(G)<<IM_COL32_G_SHIFT) | ((ImU32)(R)<<IM_COL32_R_SHIFT)) #define IM_COL32_WHITE IM_COL32(255,255,255,255) // Opaque white = 0xFFFFFFFF #define IM_COL32_BLACK IM_COL32(0,0,0,255) // Opaque black #define IM_COL32_BLACK_TRANS IM_COL32(0,0,0,0) // Transparent black = 0x00000000 // Helper: ImColor() implicitly converts colors to either ImU32 (packed 4x1 byte) or ImVec4 (4x1 float) // Prefer using IM_COL32() macros if you want a guaranteed compile-time ImU32 for usage with ImDrawList API. // **Avoid storing ImColor! Store either u32 of ImVec4. This is not a full-featured color class. MAY OBSOLETE. // **None of the ImGui API are using ImColor directly but you can use it as a convenience to pass colors in either ImU32 or ImVec4 formats. Explicitly cast to ImU32 or ImVec4 if needed. struct ImColor { ImVec4 Value; ImColor() { Value.x = Value.y = Value.z = Value.w = 0.0f; } ImColor(int r, int g, int b, int a = 255) { float sc = 1.0f / 255.0f; Value.x = (float)r * sc; Value.y = (float)g * sc; Value.z = (float)b * sc; Value.w = (float)a * sc; } ImColor(ImU32 rgba) { float sc = 1.0f / 255.0f; Value.x = (float)((rgba >> IM_COL32_R_SHIFT) & 0xFF) * sc; Value.y = (float)((rgba >> IM_COL32_G_SHIFT) & 0xFF) * sc; Value.z = (float)((rgba >> IM_COL32_B_SHIFT) & 0xFF) * sc; Value.w = (float)((rgba >> IM_COL32_A_SHIFT) & 0xFF) * sc; } ImColor(float r, float g, float b, float a = 1.0f) { Value.x = r; Value.y = g; Value.z = b; Value.w = a; } ImColor(const ImVec4& col) { Value = col; } inline operator ImU32() const { return ImGui::ColorConvertFloat4ToU32(Value); } inline operator ImVec4() const { return Value; } // FIXME-OBSOLETE: May need to obsolete/cleanup those helpers. inline void SetHSV(float h, float s, float v, float a = 1.0f){ ImGui::ColorConvertHSVtoRGB(h, s, v, Value.x, Value.y, Value.z); Value.w = a; } static ImColor HSV(float h, float s, float v, float a = 1.0f) { float r, g, b; ImGui::ColorConvertHSVtoRGB(h, s, v, r, g, b); return ImColor(r, g, b, a); } }; //----------------------------------------------------------------------------- // Draw List API (ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData) // Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList. //----------------------------------------------------------------------------- // The maximum line width to bake anti-aliased textures for. Build atlas with ImFontAtlasFlags_NoBakedLines to disable baking. #ifndef IM_DRAWLIST_TEX_LINES_WIDTH_MAX #define IM_DRAWLIST_TEX_LINES_WIDTH_MAX (63) #endif // ImDrawCallback: Draw callbacks for advanced uses [configurable type: override in imconfig.h] // NB: You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering, // you can poke into the draw list for that! Draw callback may be useful for example to: // A) Change your GPU render state, // B) render a complex 3D scene inside a UI element without an intermediate texture/render target, etc. // The expected behavior from your rendering function is 'if (cmd.UserCallback != NULL) { cmd.UserCallback(parent_list, cmd); } else { RenderTriangles() }' // If you want to override the signature of ImDrawCallback, you can simply use e.g. '#define ImDrawCallback MyDrawCallback' (in imconfig.h) + update rendering back-end accordingly. #ifndef ImDrawCallback typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd); #endif // Special Draw callback value to request renderer back-end to reset the graphics/render state. // The renderer back-end needs to handle this special value, otherwise it will crash trying to call a function at this address. // This is useful for example if you submitted callbacks which you know have altered the render state and you want it to be restored. // It is not done by default because they are many perfectly useful way of altering render state for imgui contents (e.g. changing shader/blending settings before an Image call). #define ImDrawCallback_ResetRenderState (ImDrawCallback)(-1) // Typically, 1 command = 1 GPU draw call (unless command is a callback) // - VtxOffset/IdxOffset: When 'io.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset' is enabled, // those fields allow us to render meshes larger than 64K vertices while keeping 16-bit indices. // Pre-1.71 back-ends will typically ignore the VtxOffset/IdxOffset fields. // - The ClipRect/TextureId/VtxOffset fields must be contiguous as we memcmp() them together (this is asserted for). struct ImDrawCmd { ImVec4 ClipRect; // 4*4 // Clipping rectangle (x1, y1, x2, y2). Subtract ImDrawData->DisplayPos to get clipping rectangle in "viewport" coordinates ImTextureID TextureId; // 4-8 // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas. unsigned int VtxOffset; // 4 // Start offset in vertex buffer. ImGuiBackendFlags_RendererHasVtxOffset: always 0, otherwise may be >0 to support meshes larger than 64K vertices with 16-bit indices. unsigned int IdxOffset; // 4 // Start offset in index buffer. Always equal to sum of ElemCount drawn so far. unsigned int ElemCount; // 4 // Number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[]. ImDrawCallback UserCallback; // 4-8 // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally. void* UserCallbackData; // 4-8 // The draw callback code can access this. ImDrawCmd() { memset(this, 0, sizeof(*this)); } // Also ensure our padding fields are zeroed }; // Vertex index, default to 16-bit // To allow large meshes with 16-bit indices: set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset' and handle ImDrawCmd::VtxOffset in the renderer back-end (recommended). // To use 32-bit indices: override with '#define ImDrawIdx unsigned int' in imconfig.h. #ifndef ImDrawIdx typedef unsigned short ImDrawIdx; #endif // Vertex layout #ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT struct ImDrawVert { ImVec2 pos; ImVec2 uv; ImU32 col; }; #else // You can override the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h // The code expect ImVec2 pos (8 bytes), ImVec2 uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields as needed to simplify integration in your engine. // The type has to be described within the macro (you can either declare the struct or use a typedef). This is because ImVec2/ImU32 are likely not declared a the time you'd want to set your type up. // NOTE: IMGUI DOESN'T CLEAR THE STRUCTURE AND DOESN'T CALL A CONSTRUCTOR SO ANY CUSTOM FIELD WILL BE UNINITIALIZED. IF YOU ADD EXTRA FIELDS (SUCH AS A 'Z' COORDINATES) YOU WILL NEED TO CLEAR THEM DURING RENDER OR TO IGNORE THEM. IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT; #endif // For use by ImDrawListSplitter. struct ImDrawChannel { ImVector<ImDrawCmd> _CmdBuffer; ImVector<ImDrawIdx> _IdxBuffer; }; // Split/Merge functions are used to split the draw list into different layers which can be drawn into out of order. // This is used by the Columns api, so items of each column can be batched together in a same draw call. struct ImDrawListSplitter { int _Current; // Current channel number (0) int _Count; // Number of active channels (1+) ImVector<ImDrawChannel> _Channels; // Draw channels (not resized down so _Count might be < Channels.Size) inline ImDrawListSplitter() { Clear(); } inline ~ImDrawListSplitter() { ClearFreeMemory(); } inline void Clear() { _Current = 0; _Count = 1; } // Do not clear Channels[] so our allocations are reused next frame IMGUI_API void ClearFreeMemory(); IMGUI_API void Split(ImDrawList* draw_list, int count); IMGUI_API void Merge(ImDrawList* draw_list); IMGUI_API void SetCurrentChannel(ImDrawList* draw_list, int channel_idx); }; enum ImDrawCornerFlags_ { ImDrawCornerFlags_None = 0, ImDrawCornerFlags_TopLeft = 1 << 0, // 0x1 ImDrawCornerFlags_TopRight = 1 << 1, // 0x2 ImDrawCornerFlags_BotLeft = 1 << 2, // 0x4 ImDrawCornerFlags_BotRight = 1 << 3, // 0x8 ImDrawCornerFlags_Top = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_TopRight, // 0x3 ImDrawCornerFlags_Bot = ImDrawCornerFlags_BotLeft | ImDrawCornerFlags_BotRight, // 0xC ImDrawCornerFlags_Left = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_BotLeft, // 0x5 ImDrawCornerFlags_Right = ImDrawCornerFlags_TopRight | ImDrawCornerFlags_BotRight, // 0xA ImDrawCornerFlags_All = 0xF // In your function calls you may use ~0 (= all bits sets) instead of ImDrawCornerFlags_All, as a convenience }; // Flags for ImDrawList. Those are set automatically by ImGui:: functions from ImGuiIO settings, and generally not manipulated directly. // It is however possible to temporarily alter flags between calls to ImDrawList:: functions. enum ImDrawListFlags_ { ImDrawListFlags_None = 0, ImDrawListFlags_AntiAliasedLines = 1 << 0, // Enable anti-aliased lines/borders (*2 the number of triangles for 1.0f wide line or lines thin enough to be drawn using textures, otherwise *3 the number of triangles) ImDrawListFlags_AntiAliasedLinesUseTex = 1 << 1, // Enable anti-aliased lines/borders using textures when possible. Require back-end to render with bilinear filtering. ImDrawListFlags_AntiAliasedFill = 1 << 2, // Enable anti-aliased edge around filled shapes (rounded rectangles, circles). ImDrawListFlags_AllowVtxOffset = 1 << 3 // Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled. }; // Draw command list // This is the low-level list of polygons that ImGui:: functions are filling. At the end of the frame, // all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering. // Each dear imgui window contains its own ImDrawList. You can use ImGui::GetWindowDrawList() to // access the current window draw list and draw custom primitives. // You can interleave normal ImGui:: calls and adding primitives to the current draw list. // All positions are generally in pixel coordinates (generally top-left at 0,0, bottom-right at io.DisplaySize, unless multiple viewports are used), but you are totally free to apply whatever transformation matrix to want to the data (if you apply such transformation you'll want to apply it to ClipRect as well) // Important: Primitives are always added to the list and not culled (culling is done at higher-level by ImGui:: functions), if you use this API a lot consider coarse culling your drawn objects. struct ImDrawList { // This is what you have to render ImVector<ImDrawCmd> CmdBuffer; // Draw commands. Typically 1 command = 1 GPU draw call, unless the command is a callback. ImVector<ImDrawIdx> IdxBuffer; // Index buffer. Each command consume ImDrawCmd::ElemCount of those ImVector<ImDrawVert> VtxBuffer; // Vertex buffer. ImDrawListFlags Flags; // Flags, you may poke into these to adjust anti-aliasing settings per-primitive. // [Internal, used while building lists] const ImDrawListSharedData* _Data; // Pointer to shared draw data (you can use ImGui::GetDrawListSharedData() to get the one from current ImGui context) const char* _OwnerName; // Pointer to owner window's name for debugging unsigned int _VtxCurrentIdx; // [Internal] Generally == VtxBuffer.Size unless we are past 64K vertices, in which case this gets reset to 0. ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much) ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much) ImVector<ImVec4> _ClipRectStack; // [Internal] ImVector<ImTextureID> _TextureIdStack; // [Internal] ImVector<ImVec2> _Path; // [Internal] current path building ImDrawCmd _CmdHeader; // [Internal] Template of active commands. Fields should match those of CmdBuffer.back(). ImDrawListSplitter _Splitter; // [Internal] for channels api (note: prefer using your own persistent instance of ImDrawListSplitter!) // If you want to create ImDrawList instances, pass them ImGui::GetDrawListSharedData() or create and use your own ImDrawListSharedData (so you can use ImDrawList without ImGui) ImDrawList(const ImDrawListSharedData* shared_data) { _Data = shared_data; Flags = ImDrawListFlags_None; _VtxCurrentIdx = 0; _VtxWritePtr = NULL; _IdxWritePtr = NULL; _OwnerName = NULL; } ~ImDrawList() { _ClearFreeMemory(); } IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect = false); // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling) IMGUI_API void PushClipRectFullScreen(); IMGUI_API void PopClipRect(); IMGUI_API void PushTextureID(ImTextureID texture_id); IMGUI_API void PopTextureID(); inline ImVec2 GetClipRectMin() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.x, cr.y); } inline ImVec2 GetClipRectMax() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.z, cr.w); } // Primitives // - For rectangular primitives, "p_min" and "p_max" represent the upper-left and lower-right corners. // - For circle primitives, use "num_segments == 0" to automatically calculate tessellation (preferred). // In older versions (until Dear ImGui 1.77) the AddCircle functions defaulted to num_segments == 12. // In future versions we will use textures to provide cheaper and higher-quality circles. // Use AddNgon() and AddNgonFilled() functions if you need to guaranteed a specific number of sides. IMGUI_API void AddLine(const ImVec2& p1, const ImVec2& p2, ImU32 col, float thickness = 1.0f); IMGUI_API void AddRect(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding = 0.0f, ImDrawCornerFlags rounding_corners = ImDrawCornerFlags_All, float thickness = 1.0f); // a: upper-left, b: lower-right (== upper-left + size), rounding_corners_flags: 4 bits corresponding to which corner to round IMGUI_API void AddRectFilled(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding = 0.0f, ImDrawCornerFlags rounding_corners = ImDrawCornerFlags_All); // a: upper-left, b: lower-right (== upper-left + size) IMGUI_API void AddRectFilledMultiColor(const ImVec2& p_min, const ImVec2& p_max, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left); IMGUI_API void AddQuad(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness = 1.0f); IMGUI_API void AddQuadFilled(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col); IMGUI_API void AddTriangle(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col, float thickness = 1.0f); IMGUI_API void AddTriangleFilled(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col); IMGUI_API void AddCircle(const ImVec2& center, float radius, ImU32 col, int num_segments = 0, float thickness = 1.0f); IMGUI_API void AddCircleFilled(const ImVec2& center, float radius, ImU32 col, int num_segments = 0); IMGUI_API void AddNgon(const ImVec2& center, float radius, ImU32 col, int num_segments, float thickness = 1.0f); IMGUI_API void AddNgonFilled(const ImVec2& center, float radius, ImU32 col, int num_segments); IMGUI_API void AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL); IMGUI_API void AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL); IMGUI_API void AddPolyline(const ImVec2* points, int num_points, ImU32 col, bool closed, float thickness); IMGUI_API void AddConvexPolyFilled(const ImVec2* points, int num_points, ImU32 col); // Note: Anti-aliased filling requires points to be in clockwise order. IMGUI_API void AddBezierCurve(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0); // Image primitives // - Read FAQ to understand what ImTextureID is. // - "p_min" and "p_max" represent the upper-left and lower-right corners of the rectangle. // - "uv_min" and "uv_max" represent the normalized texture coordinates to use for those corners. Using (0,0)->(1,1) texture coordinates will generally display the entire texture. IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min = ImVec2(0, 0), const ImVec2& uv_max = ImVec2(1, 1), ImU32 col = IM_COL32_WHITE); IMGUI_API void AddImageQuad(ImTextureID user_texture_id, const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, const ImVec2& uv1 = ImVec2(0, 0), const ImVec2& uv2 = ImVec2(1, 0), const ImVec2& uv3 = ImVec2(1, 1), const ImVec2& uv4 = ImVec2(0, 1), ImU32 col = IM_COL32_WHITE); IMGUI_API void AddImageRounded(ImTextureID user_texture_id, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min, const ImVec2& uv_max, ImU32 col, float rounding, ImDrawCornerFlags rounding_corners = ImDrawCornerFlags_All); // Stateful path API, add points then finish with PathFillConvex() or PathStroke() inline void PathClear() { _Path.Size = 0; } inline void PathLineTo(const ImVec2& pos) { _Path.push_back(pos); } inline void PathLineToMergeDuplicate(const ImVec2& pos) { if (_Path.Size == 0 || memcmp(&_Path.Data[_Path.Size - 1], &pos, 8) != 0) _Path.push_back(pos); } inline void PathFillConvex(ImU32 col) { AddConvexPolyFilled(_Path.Data, _Path.Size, col); _Path.Size = 0; } // Note: Anti-aliased filling requires points to be in clockwise order. inline void PathStroke(ImU32 col, bool closed, float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, closed, thickness); _Path.Size = 0; } IMGUI_API void PathArcTo(const ImVec2& center, float radius, float a_min, float a_max, int num_segments = 10); IMGUI_API void PathArcToFast(const ImVec2& center, float radius, int a_min_of_12, int a_max_of_12); // Use precomputed angles for a 12 steps circle IMGUI_API void PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments = 0); IMGUI_API void PathRect(const ImVec2& rect_min, const ImVec2& rect_max, float rounding = 0.0f, ImDrawCornerFlags rounding_corners = ImDrawCornerFlags_All); // Advanced IMGUI_API void AddCallback(ImDrawCallback callback, void* callback_data); // Your rendering function must check for 'UserCallback' in ImDrawCmd and call the function instead of rendering triangles. IMGUI_API void AddDrawCmd(); // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible IMGUI_API ImDrawList* CloneOutput() const; // Create a clone of the CmdBuffer/IdxBuffer/VtxBuffer. // Advanced: Channels // - Use to split render into layers. By switching channels to can render out-of-order (e.g. submit FG primitives before BG primitives) // - Use to minimize draw calls (e.g. if going back-and-forth between multiple clipping rectangles, prefer to append into separate channels then merge at the end) // - FIXME-OBSOLETE: This API shouldn't have been in ImDrawList in the first place! // Prefer using your own persistent instance of ImDrawListSplitter as you can stack them. // Using the ImDrawList::ChannelsXXXX you cannot stack a split over another. inline void ChannelsSplit(int count) { _Splitter.Split(this, count); } inline void ChannelsMerge() { _Splitter.Merge(this); } inline void ChannelsSetCurrent(int n) { _Splitter.SetCurrentChannel(this, n); } // Advanced: Primitives allocations // - We render triangles (three vertices) // - All primitives needs to be reserved via PrimReserve() beforehand. IMGUI_API void PrimReserve(int idx_count, int vtx_count); IMGUI_API void PrimUnreserve(int idx_count, int vtx_count); IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col); // Axis aligned rectangle (composed of two triangles) IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col); IMGUI_API void PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col); inline void PrimWriteVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; } inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; } inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } // Write vertex with unique index // [Internal helpers] IMGUI_API void _ResetForNewFrame(); IMGUI_API void _ClearFreeMemory(); IMGUI_API void _PopUnusedDrawCmd(); IMGUI_API void _OnChangedClipRect(); IMGUI_API void _OnChangedTextureID(); IMGUI_API void _OnChangedVtxOffset(); }; // All draw data to render a Dear ImGui frame // (NB: the style and the naming convention here is a little inconsistent, we currently preserve them for backward compatibility purpose, // as this is one of the oldest structure exposed by the library! Basically, ImDrawList == CmdList) struct ImDrawData { bool Valid; // Only valid after Render() is called and before the next NewFrame() is called. ImDrawList** CmdLists; // Array of ImDrawList* to render. The ImDrawList are owned by ImGuiContext and only pointed to from here. int CmdListsCount; // Number of ImDrawList* to render int TotalIdxCount; // For convenience, sum of all ImDrawList's IdxBuffer.Size int TotalVtxCount; // For convenience, sum of all ImDrawList's VtxBuffer.Size ImVec2 DisplayPos; // Upper-left position of the viewport to render (== upper-left of the orthogonal projection matrix to use) ImVec2 DisplaySize; // Size of the viewport to render (== io.DisplaySize for the main viewport) (DisplayPos + DisplaySize == lower-right of the orthogonal projection matrix to use) ImVec2 FramebufferScale; // Amount of pixels for each unit of DisplaySize. Based on io.DisplayFramebufferScale. Generally (1,1) on normal display, (2,2) on OSX with Retina display. ImGuiViewport* OwnerViewport; // Viewport carrying the ImDrawData instance, might be of use to the renderer (generally not). // Functions ImDrawData() { Valid = false; Clear(); } ~ImDrawData() { Clear(); } void Clear() { Valid = false; CmdLists = NULL; CmdListsCount = TotalVtxCount = TotalIdxCount = 0; DisplayPos = DisplaySize = FramebufferScale = ImVec2(0.f, 0.f); OwnerViewport = NULL; } // The ImDrawList are owned by ImGuiContext! IMGUI_API void DeIndexAllBuffers(); // Helper to convert all buffers from indexed to non-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering! IMGUI_API void ScaleClipRects(const ImVec2& fb_scale); // Helper to scale the ClipRect field of each ImDrawCmd. Use if your final output buffer is at a different scale than Dear ImGui expects, or if there is a difference between your window resolution and framebuffer resolution. }; //----------------------------------------------------------------------------- // Font API (ImFontConfig, ImFontGlyph, ImFontAtlasFlags, ImFontAtlas, ImFontGlyphRangesBuilder, ImFont) //----------------------------------------------------------------------------- struct ImFontConfig { void* FontData; // // TTF/OTF data int FontDataSize; // // TTF/OTF data size bool FontDataOwnedByAtlas; // true // TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself). int FontNo; // 0 // Index of font within TTF/OTF file float SizePixels; // // Size in pixels for rasterizer (more or less maps to the resulting font height). int OversampleH; // 3 // Rasterize at higher quality for sub-pixel positioning. Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details. int OversampleV; // 1 // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis. bool PixelSnapH; // false // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1. ImVec2 GlyphExtraSpacing; // 0, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now. ImVec2 GlyphOffset; // 0, 0 // Offset all glyphs from this font input. const ImWchar* GlyphRanges; // NULL // Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. float GlyphMinAdvanceX; // 0 // Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font float GlyphMaxAdvanceX; // FLT_MAX // Maximum AdvanceX for glyphs bool MergeMode; // false // Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights. unsigned int RasterizerFlags; // 0x00 // Settings for custom font rasterizer (e.g. ImGuiFreeType). Leave as zero if you aren't using one. float RasterizerMultiply; // 1.0f // Brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable. ImWchar EllipsisChar; // -1 // Explicitly specify unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used. // [Internal] char Name[40]; // Name (strictly to ease debugging) ImFont* DstFont; IMGUI_API ImFontConfig(); }; // Hold rendering data for one glyph. // (Note: some language parsers may fail to convert the 31+1 bitfield members, in this case maybe drop store a single u32 or we can rework this) struct ImFontGlyph { unsigned int Codepoint : 31; // 0x0000..0xFFFF unsigned int Visible : 1; // Flag to allow early out when rendering float AdvanceX; // Distance to next character (= data from font + ImFontConfig::GlyphExtraSpacing.x baked in) float X0, Y0, X1, Y1; // Glyph corners float U0, V0, U1, V1; // Texture coordinates }; // Helper to build glyph ranges from text/string data. Feed your application strings/characters to it then call BuildRanges(). // This is essentially a tightly packed of vector of 64k booleans = 8KB storage. struct ImFontGlyphRangesBuilder { ImVector<ImU32> UsedChars; // Store 1-bit per Unicode code point (0=unused, 1=used) ImFontGlyphRangesBuilder() { Clear(); } inline void Clear() { int size_in_bytes = (IM_UNICODE_CODEPOINT_MAX + 1) / 8; UsedChars.resize(size_in_bytes / (int)sizeof(ImU32)); memset(UsedChars.Data, 0, (size_t)size_in_bytes); } inline bool GetBit(size_t n) const { int off = (int)(n >> 5); ImU32 mask = 1u << (n & 31); return (UsedChars[off] & mask) != 0; } // Get bit n in the array inline void SetBit(size_t n) { int off = (int)(n >> 5); ImU32 mask = 1u << (n & 31); UsedChars[off] |= mask; } // Set bit n in the array inline void AddChar(ImWchar c) { SetBit(c); } // Add character IMGUI_API void AddText(const char* text, const char* text_end = NULL); // Add string (each character of the UTF-8 string are added) IMGUI_API void AddRanges(const ImWchar* ranges); // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault()) to force add all of ASCII/Latin+Ext IMGUI_API void BuildRanges(ImVector<ImWchar>* out_ranges); // Output new ranges }; // See ImFontAtlas::AddCustomRectXXX functions. struct ImFontAtlasCustomRect { unsigned short Width, Height; // Input // Desired rectangle dimension unsigned short X, Y; // Output // Packed position in Atlas unsigned int GlyphID; // Input // For custom font glyphs only (ID < 0x110000) float GlyphAdvanceX; // Input // For custom font glyphs only: glyph xadvance ImVec2 GlyphOffset; // Input // For custom font glyphs only: glyph display offset ImFont* Font; // Input // For custom font glyphs only: target font ImFontAtlasCustomRect() { Width = Height = 0; X = Y = 0xFFFF; GlyphID = 0; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0, 0); Font = NULL; } bool IsPacked() const { return X != 0xFFFF; } }; // Flags for ImFontAtlas build enum ImFontAtlasFlags_ { ImFontAtlasFlags_None = 0, ImFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0, // Don't round the height to next power of two ImFontAtlasFlags_NoMouseCursors = 1 << 1, // Don't build software mouse cursors into the atlas (save a little texture memory) ImFontAtlasFlags_NoBakedLines = 1 << 2 // Don't build thick line textures into the atlas (save a little texture memory). The AntiAliasedLinesUseTex features uses them, otherwise they will be rendered using polygons (more expensive for CPU/GPU). }; // Load and rasterize multiple TTF/OTF fonts into a same texture. The font atlas will build a single texture holding: // - One or more fonts. // - Custom graphics data needed to render the shapes needed by Dear ImGui. // - Mouse cursor shapes for software cursor rendering (unless setting 'Flags |= ImFontAtlasFlags_NoMouseCursors' in the font atlas). // It is the user-code responsibility to setup/build the atlas, then upload the pixel data into a texture accessible by your graphics api. // - Optionally, call any of the AddFont*** functions. If you don't call any, the default font embedded in the code will be loaded for you. // - Call GetTexDataAsAlpha8() or GetTexDataAsRGBA32() to build and retrieve pixels data. // - Upload the pixels data into a texture within your graphics system (see imgui_impl_xxxx.cpp examples) // - Call SetTexID(my_tex_id); and pass the pointer/identifier to your texture in a format natural to your graphics API. // This value will be passed back to you during rendering to identify the texture. Read FAQ entry about ImTextureID for more details. // Common pitfalls: // - If you pass a 'glyph_ranges' array to AddFont*** functions, you need to make sure that your array persist up until the // atlas is build (when calling GetTexData*** or Build()). We only copy the pointer, not the data. // - Important: By default, AddFontFromMemoryTTF() takes ownership of the data. Even though we are not writing to it, we will free the pointer on destruction. // You can set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed, // - Even though many functions are suffixed with "TTF", OTF data is supported just as well. // - This is an old API and it is currently awkward for those and and various other reasons! We will address them in the future! struct ImFontAtlas { IMGUI_API ImFontAtlas(); IMGUI_API ~ImFontAtlas(); IMGUI_API ImFont* AddFont(const ImFontConfig* font_cfg); IMGUI_API ImFont* AddFontDefault(const ImFontConfig* font_cfg = NULL); IMGUI_API ImFont* AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); IMGUI_API ImFont* AddFontFromMemoryTTF(void* font_data, int font_size, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // Note: Transfer ownership of 'ttf_data' to ImFontAtlas! Will be deleted after destruction of the atlas. Set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed. IMGUI_API ImFont* AddFontFromMemoryCompressedTTF(const void* compressed_font_data, int compressed_font_size, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp. IMGUI_API ImFont* AddFontFromMemoryCompressedBase85TTF(const char* compressed_font_data_base85, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter. IMGUI_API void ClearInputData(); // Clear input data (all ImFontConfig structures including sizes, TTF data, glyph ranges, etc.) = all the data used to build the texture and fonts. IMGUI_API void ClearTexData(); // Clear output texture data (CPU side). Saves RAM once the texture has been copied to graphics memory. IMGUI_API void ClearFonts(); // Clear output font data (glyphs storage, UV coordinates). IMGUI_API void Clear(); // Clear all input and output. // Build atlas, retrieve pixel data. // User is in charge of copying the pixels into graphics memory (e.g. create a texture with your engine). Then store your texture handle with SetTexID(). // The pitch is always = Width * BytesPerPixels (1 or 4) // Building in RGBA32 format is provided for convenience and compatibility, but note that unless you manually manipulate or copy color data into // the texture (e.g. when using the AddCustomRect*** api), then the RGB pixels emitted will always be white (~75% of memory/bandwidth waste. IMGUI_API bool Build(); // Build pixels data. This is called automatically for you by the GetTexData*** functions. IMGUI_API void GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 1 byte per-pixel IMGUI_API void GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 4 bytes-per-pixel bool IsBuilt() const { return Fonts.Size > 0 && (TexPixelsAlpha8 != NULL || TexPixelsRGBA32 != NULL); } void SetTexID(ImTextureID id) { TexID = id; } //------------------------------------------- // Glyph Ranges //------------------------------------------- // Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list) // NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8"Hello world" syntax. See FAQ for details. // NB: Consider using ImFontGlyphRangesBuilder to build glyph ranges from textual data. IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin IMGUI_API const ImWchar* GetGlyphRangesKorean(); // Default + Korean characters IMGUI_API const ImWchar* GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs IMGUI_API const ImWchar* GetGlyphRangesChineseFull(); // Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs IMGUI_API const ImWchar* GetGlyphRangesChineseSimplifiedCommon();// Default + Half-Width + Japanese Hiragana/Katakana + set of 2500 CJK Unified Ideographs for common simplified Chinese IMGUI_API const ImWchar* GetGlyphRangesCyrillic(); // Default + about 400 Cyrillic characters IMGUI_API const ImWchar* GetGlyphRangesThai(); // Default + Thai characters IMGUI_API const ImWchar* GetGlyphRangesVietnamese(); // Default + Vietnamese characters //------------------------------------------- // [BETA] Custom Rectangles/Glyphs API //------------------------------------------- // You can request arbitrary rectangles to be packed into the atlas, for your own purposes. // After calling Build(), you can query the rectangle position and render your pixels. // You can also request your rectangles to be mapped as font glyph (given a font + Unicode point), // so you can render e.g. custom colorful icons and use them as regular glyphs. // Read docs/FONTS.md for more details about using colorful icons. // Note: this API may be redesigned later in order to support multi-monitor varying DPI settings. IMGUI_API int AddCustomRectRegular(int width, int height); IMGUI_API int AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0, 0)); ImFontAtlasCustomRect* GetCustomRectByIndex(int index) { IM_ASSERT(index >= 0); return &CustomRects[index]; } // [Internal] IMGUI_API void CalcCustomRectUV(const ImFontAtlasCustomRect* rect, ImVec2* out_uv_min, ImVec2* out_uv_max) const; IMGUI_API bool GetMouseCursorTexData(ImGuiMouseCursor cursor, ImVec2* out_offset, ImVec2* out_size, ImVec2 out_uv_border[2], ImVec2 out_uv_fill[2]); //------------------------------------------- // Members //------------------------------------------- bool Locked; // Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert. ImFontAtlasFlags Flags; // Build flags (see ImFontAtlasFlags_) ImTextureID TexID; // User data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the ImDrawCmd structure. int TexDesiredWidth; // Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height. int TexGlyphPadding; // Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method doesn't rely on bilinear filtering you may set this to 0. // [Internal] // NB: Access texture data via GetTexData*() calls! Which will setup a default font for you. unsigned char* TexPixelsAlpha8; // 1 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight unsigned int* TexPixelsRGBA32; // 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4 int TexWidth; // Texture width calculated during Build(). int TexHeight; // Texture height calculated during Build(). ImVec2 TexUvScale; // = (1.0f/TexWidth, 1.0f/TexHeight) ImVec2 TexUvWhitePixel; // Texture coordinates to a white pixel ImVector<ImFont*> Fonts; // Hold all the fonts returned by AddFont*. Fonts[0] is the default font upon calling ImGui::NewFrame(), use ImGui::PushFont()/PopFont() to change the current font. ImVector<ImFontAtlasCustomRect> CustomRects; // Rectangles for packing custom texture data into the atlas. ImVector<ImFontConfig> ConfigData; // Configuration data ImVec4 TexUvLines[IM_DRAWLIST_TEX_LINES_WIDTH_MAX + 1]; // UVs for baked anti-aliased lines // [Internal] Packing data int PackIdMouseCursors; // Custom texture rectangle ID for white pixel and mouse cursors int PackIdLines; // Custom texture rectangle ID for baked anti-aliased lines #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS typedef ImFontAtlasCustomRect CustomRect; // OBSOLETED in 1.72+ typedef ImFontGlyphRangesBuilder GlyphRangesBuilder; // OBSOLETED in 1.67+ #endif }; // Font runtime data and rendering // ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32(). struct ImFont { // Members: Hot ~20/24 bytes (for CalcTextSize) ImVector<float> IndexAdvanceX; // 12-16 // out // // Sparse. Glyphs->AdvanceX in a directly indexable way (cache-friendly for CalcTextSize functions which only this this info, and are often bottleneck in large UI). float FallbackAdvanceX; // 4 // out // = FallbackGlyph->AdvanceX float FontSize; // 4 // in // // Height of characters/line, set during loading (don't change after loading) // Members: Hot ~28/40 bytes (for CalcTextSize + render loop) ImVector<ImWchar> IndexLookup; // 12-16 // out // // Sparse. Index glyphs by Unicode code-point. ImVector<ImFontGlyph> Glyphs; // 12-16 // out // // All glyphs. const ImFontGlyph* FallbackGlyph; // 4-8 // out // = FindGlyph(FontFallbackChar) // Members: Cold ~32/40 bytes ImFontAtlas* ContainerAtlas; // 4-8 // out // // What we has been loaded into const ImFontConfig* ConfigData; // 4-8 // in // // Pointer within ContainerAtlas->ConfigData short ConfigDataCount; // 2 // in // ~ 1 // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont. ImWchar FallbackChar; // 2 // in // = '?' // Replacement character if a glyph isn't found. Only set via SetFallbackChar() ImWchar EllipsisChar; // 2 // out // = -1 // Character used for ellipsis rendering. bool DirtyLookupTables; // 1 // out // float Scale; // 4 // in // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale() float Ascent, Descent; // 4+4 // out // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize] int MetricsTotalSurface;// 4 // out // // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs) ImU8 Used4kPagesMap[(IM_UNICODE_CODEPOINT_MAX+1)/4096/8]; // 2 bytes if ImWchar=ImWchar16, 34 bytes if ImWchar==ImWchar32. Store 1-bit for each block of 4K codepoints that has one active glyph. This is mainly used to facilitate iterations across all used codepoints. // Methods IMGUI_API ImFont(); IMGUI_API ~ImFont(); IMGUI_API const ImFontGlyph*FindGlyph(ImWchar c) const; IMGUI_API const ImFontGlyph*FindGlyphNoFallback(ImWchar c) const; float GetCharAdvance(ImWchar c) const { return ((int)c < IndexAdvanceX.Size) ? IndexAdvanceX[(int)c] : FallbackAdvanceX; } bool IsLoaded() const { return ContainerAtlas != NULL; } const char* GetDebugName() const { return ConfigData ? ConfigData->Name : "<unknown>"; } // 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable. // 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable. IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL) const; // utf8 IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const; IMGUI_API void RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const; IMGUI_API void RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) const; // [Internal] Don't use! IMGUI_API void BuildLookupTable(); IMGUI_API void ClearOutputData(); IMGUI_API void GrowIndex(int new_size); IMGUI_API void AddGlyph(const ImFontConfig* src_cfg, ImWchar c, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x); IMGUI_API void AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst = true); // Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built. IMGUI_API void SetGlyphVisible(ImWchar c, bool visible); IMGUI_API void SetFallbackChar(ImWchar c); IMGUI_API bool IsGlyphRangeUnused(unsigned int c_begin, unsigned int c_last); }; //----------------------------------------------------------------------------- // [BETA] Platform interface for multi-viewport support //----------------------------------------------------------------------------- // (Optional) This is completely optional, for advanced users! // If you are new to Dear ImGui and trying to integrate it into your engine, you can probably ignore this for now. // // This feature allows you to seamlessly drag Dear ImGui windows outside of your application viewport. // This is achieved by creating new Platform/OS windows on the fly, and rendering into them. // Dear ImGui manages the viewport structures, and the back-end create and maintain one Platform/OS window for each of those viewports. // // See Glossary https://github.com/ocornut/imgui/wiki/Glossary for details about some of the terminology. // See Thread https://github.com/ocornut/imgui/issues/1542 for gifs, news and questions about this evolving feature. // // About the coordinates system: // - When multi-viewports are enabled, all Dear ImGui coordinates become absolute coordinates (same as OS coordinates!) // - So e.g. ImGui::SetNextWindowPos(ImVec2(0,0)) will position a window relative to your primary monitor! // - If you want to position windows relative to your main application viewport, use ImGui::GetMainViewport()->Pos as a base position. // // Steps to use multi-viewports in your application, when using a default back-end from the examples/ folder: // - Application: Enable feature with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. // - Back-end: The back-end initialization will setup all necessary ImGuiPlatformIO's functions and update monitors info every frame. // - Application: In your main loop, call ImGui::UpdatePlatformWindows(), ImGui::RenderPlatformWindowsDefault() after EndFrame() or Render(). // - Application: Fix absolute coordinates used in ImGui::SetWindowPos() or ImGui::SetNextWindowPos() calls. // // Steps to use multi-viewports in your application, when using a custom back-end: // - Important: THIS IS NOT EASY TO DO and comes with many subtleties not described here! // It's also an experimental feature, so some of the requirements may evolve. // Consider using default back-ends if you can. Either way, carefully follow and refer to examples/ back-ends for details. // - Application: Enable feature with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. // - Back-end: Hook ImGuiPlatformIO's Platform_* and Renderer_* callbacks (see below). // Set 'io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports' and 'io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports'. // Update ImGuiPlatformIO's Monitors list every frame. // Update MousePos every frame, in absolute coordinates. // - Application: In your main loop, call ImGui::UpdatePlatformWindows(), ImGui::RenderPlatformWindowsDefault() after EndFrame() or Render(). // You may skip calling RenderPlatformWindowsDefault() if its API is not convenient for your needs. Read comments below. // - Application: Fix absolute coordinates used in ImGui::SetWindowPos() or ImGui::SetNextWindowPos() calls. // // About ImGui::RenderPlatformWindowsDefault(): // - This function is a mostly a _helper_ for the common-most cases, and to facilitate using default back-ends. // - You can check its simple source code to understand what it does. // It basically iterates secondary viewports and call 4 functions that are setup in ImGuiPlatformIO, if available: // Platform_RenderWindow(), Renderer_RenderWindow(), Platform_SwapBuffers(), Renderer_SwapBuffers() // Those functions pointers exists only for the benefit of RenderPlatformWindowsDefault(). // - If you have very specific rendering needs (e.g. flipping multiple swap-chain simultaneously, unusual sync/threading issues, etc.), // you may be tempted to ignore RenderPlatformWindowsDefault() and write customized code to perform your renderingg. // You may decide to setup the platform_io's *RenderWindow and *SwapBuffers pointers and call your functions through those pointers, // or you may decide to never setup those pointers and call your code directly. They are a convenience, not an obligatory interface. //----------------------------------------------------------------------------- // (Optional) Access via ImGui::GetPlatformIO() struct ImGuiPlatformIO { //------------------------------------------------------------------ // Input - Back-end interface/functions + Monitor List //------------------------------------------------------------------ // (Optional) Platform functions (e.g. Win32, GLFW, SDL2) // For reference, the second column shows which function are generally calling the Platform Functions: // N = ImGui::NewFrame() ~ beginning of the dear imgui frame: read info from platform/OS windows (latest size/position) // F = ImGui::Begin(), ImGui::EndFrame() ~ during the dear imgui frame // U = ImGui::UpdatePlatformWindows() ~ after the dear imgui frame: create and update all platform/OS windows // R = ImGui::RenderPlatformWindowsDefault() ~ render // D = ImGui::DestroyPlatformWindows() ~ shutdown // The general idea is that NewFrame() we will read the current Platform/OS state, and UpdatePlatformWindows() will write to it. // // The functions are designed so we can mix and match 2 imgui_impl_xxxx files, one for the Platform (~window/input handling), one for Renderer. // Custom engine back-ends will often provide both Platform and Renderer interfaces and so may not need to use all functions. // Platform functions are typically called before their Renderer counterpart, apart from Destroy which are called the other way. // Platform function --------------------------------------------------- Called by ----- void (*Platform_CreateWindow)(ImGuiViewport* vp); // . . U . . // Create a new platform window for the given viewport void (*Platform_DestroyWindow)(ImGuiViewport* vp); // N . U . D // void (*Platform_ShowWindow)(ImGuiViewport* vp); // . . U . . // Newly created windows are initially hidden so SetWindowPos/Size/Title can be called on them before showing the window void (*Platform_SetWindowPos)(ImGuiViewport* vp, ImVec2 pos); // . . U . . // Set platform window position (given the upper-left corner of client area) ImVec2 (*Platform_GetWindowPos)(ImGuiViewport* vp); // N . . . . // void (*Platform_SetWindowSize)(ImGuiViewport* vp, ImVec2 size); // . . U . . // Set platform window client area size (ignoring OS decorations such as OS title bar etc.) ImVec2 (*Platform_GetWindowSize)(ImGuiViewport* vp); // N . . . . // Get platform window client area size void (*Platform_SetWindowFocus)(ImGuiViewport* vp); // N . . . . // Move window to front and set input focus bool (*Platform_GetWindowFocus)(ImGuiViewport* vp); // . . U . . // bool (*Platform_GetWindowMinimized)(ImGuiViewport* vp); // N . . . . // Get platform window minimized state. When minimized, we generally won't attempt to get/set size and contents will be culled more easily void (*Platform_SetWindowTitle)(ImGuiViewport* vp, const char* str); // . . U . . // Set platform window title (given an UTF-8 string) void (*Platform_SetWindowAlpha)(ImGuiViewport* vp, float alpha); // . . U . . // (Optional) Setup window transparency void (*Platform_UpdateWindow)(ImGuiViewport* vp); // . . U . . // (Optional) Called by UpdatePlatformWindows(). Optional hook to allow the platform back-end from doing general book-keeping every frame. void (*Platform_RenderWindow)(ImGuiViewport* vp, void* render_arg); // . . . R . // (Optional) Main rendering (platform side! This is often unused, or just setting a "current" context for OpenGL bindings). 'render_arg' is the value passed to RenderPlatformWindowsDefault(). void (*Platform_SwapBuffers)(ImGuiViewport* vp, void* render_arg); // . . . R . // (Optional) Call Present/SwapBuffers (platform side! This is often unused!). 'render_arg' is the value passed to RenderPlatformWindowsDefault(). float (*Platform_GetWindowDpiScale)(ImGuiViewport* vp); // N . . . . // (Optional) [BETA] FIXME-DPI: DPI handling: Return DPI scale for this viewport. 1.0f = 96 DPI. void (*Platform_OnChangedViewport)(ImGuiViewport* vp); // . F . . . // (Optional) [BETA] FIXME-DPI: DPI handling: Called during Begin() every time the viewport we are outputting into changes, so back-end has a chance to swap fonts to adjust style. void (*Platform_SetImeInputPos)(ImGuiViewport* vp, ImVec2 pos); // . F . . . // (Optional) Set IME (Input Method Editor, e.g. for Asian languages) input position, so text preview appears over the imgui input box. FIXME: The call timing of this is inconsistent because we want to support without multi-viewports. int (*Platform_CreateVkSurface)(ImGuiViewport* vp, ImU64 vk_inst, const void* vk_allocators, ImU64* out_vk_surface); // (Optional) For a Vulkan Renderer to call into Platform code (since the surface creation needs to tie them both). // (Optional) Renderer functions (e.g. DirectX, OpenGL, Vulkan) void (*Renderer_CreateWindow)(ImGuiViewport* vp); // . . U . . // Create swap chain, frame buffers etc. (called after Platform_CreateWindow) void (*Renderer_DestroyWindow)(ImGuiViewport* vp); // N . U . D // Destroy swap chain, frame buffers etc. (called before Platform_DestroyWindow) void (*Renderer_SetWindowSize)(ImGuiViewport* vp, ImVec2 size); // . . U . . // Resize swap chain, frame buffers etc. (called after Platform_SetWindowSize) void (*Renderer_RenderWindow)(ImGuiViewport* vp, void* render_arg); // . . . R . // (Optional) Clear framebuffer, setup render target, then render the viewport->DrawData. 'render_arg' is the value passed to RenderPlatformWindowsDefault(). void (*Renderer_SwapBuffers)(ImGuiViewport* vp, void* render_arg); // . . . R . // (Optional) Call Present/SwapBuffers. 'render_arg' is the value passed to RenderPlatformWindowsDefault(). // (Optional) Monitor list // - Updated by: app/back-end. Update every frame to dynamically support changing monitor or DPI configuration. // - Used by: dear imgui to query DPI info, clamp popups/tooltips within same monitor and not have them straddle monitors. ImVector<ImGuiPlatformMonitor> Monitors; //------------------------------------------------------------------ // Output - List of viewports to render into platform windows //------------------------------------------------------------------ // Viewports list (the list is updated by calling ImGui::EndFrame or ImGui::Render) // (in the future we will attempt to organize this feature to remove the need for a "main viewport") ImGuiViewport* MainViewport; // Guaranteed to be == Viewports[0] ImVector<ImGuiViewport*> Viewports; // Main viewports, followed by all secondary viewports. ImGuiPlatformIO() { memset(this, 0, sizeof(*this)); } // Zero clear }; // (Optional) This is required when enabling multi-viewport. Represent the bounds of each connected monitor/display and their DPI. // We use this information for multiple DPI support + clamping the position of popups and tooltips so they don't straddle multiple monitors. struct ImGuiPlatformMonitor { ImVec2 MainPos, MainSize; // Coordinates of the area displayed on this monitor (Min = upper left, Max = bottom right) ImVec2 WorkPos, WorkSize; // Coordinates without task bars / side bars / menu bars. Used to avoid positioning popups/tooltips inside this region. If you don't have this info, please copy the value for MainPos/MainSize. float DpiScale; // 1.0f = 96 DPI ImGuiPlatformMonitor() { MainPos = MainSize = WorkPos = WorkSize = ImVec2(0, 0); DpiScale = 1.0f; } }; // Flags stored in ImGuiViewport::Flags, giving indications to the platform back-ends. enum ImGuiViewportFlags_ { ImGuiViewportFlags_None = 0, ImGuiViewportFlags_NoDecoration = 1 << 0, // Platform Window: Disable platform decorations: title bar, borders, etc. (generally set all windows, but if ImGuiConfigFlags_ViewportsDecoration is set we only set this on popups/tooltips) ImGuiViewportFlags_NoTaskBarIcon = 1 << 1, // Platform Window: Disable platform task bar icon (generally set on popups/tooltips, or all windows if ImGuiConfigFlags_ViewportsNoTaskBarIcon is set) ImGuiViewportFlags_NoFocusOnAppearing = 1 << 2, // Platform Window: Don't take focus when created. ImGuiViewportFlags_NoFocusOnClick = 1 << 3, // Platform Window: Don't take focus when clicked on. ImGuiViewportFlags_NoInputs = 1 << 4, // Platform Window: Make mouse pass through so we can drag this window while peaking behind it. ImGuiViewportFlags_NoRendererClear = 1 << 5, // Platform Window: Renderer doesn't need to clear the framebuffer ahead (because we will fill it entirely). ImGuiViewportFlags_TopMost = 1 << 6, // Platform Window: Display on top (for tooltips only). ImGuiViewportFlags_Minimized = 1 << 7, // Platform Window: Window is minimized, can skip render. When minimized we tend to avoid using the viewport pos/size for clipping window or testing if they are contained in the viewport. ImGuiViewportFlags_NoAutoMerge = 1 << 8, // Platform Window: Avoid merging this window into another host window. This can only be set via ImGuiWindowClass viewport flags override (because we need to now ahead if we are going to create a viewport in the first place!). ImGuiViewportFlags_CanHostOtherWindows = 1 << 9 // Main viewport: can host multiple imgui windows (secondary viewports are associated to a single window). }; // The viewports created and managed by Dear ImGui. The role of the platform back-end is to create the platform/OS windows corresponding to each viewport. // - Main Area = entire viewport. // - Work Area = entire viewport minus sections optionally used by menu bars, status bars. Some positioning code will prefer to use this. Window are also trying to stay within this area. struct ImGuiViewport { ImGuiID ID; // Unique identifier for the viewport ImGuiViewportFlags Flags; // See ImGuiViewportFlags_ ImVec2 Pos; // Main Area: Position of the viewport (the imgui coordinates are the same as OS desktop/native coordinates) ImVec2 Size; // Main Area: Size of the viewport. ImVec2 WorkOffsetMin; // Work Area: Offset from Pos to top-left corner of Work Area. Generally (0,0) or (0,+main_menu_bar_height). Work Area is Full Area but without menu-bars/status-bars (so WorkArea always fit inside Pos/Size!) ImVec2 WorkOffsetMax; // Work Area: Offset from Pos+Size to bottom-right corner of Work Area. Generally (0,0) or (0,-status_bar_height). float DpiScale; // 1.0f = 96 DPI = No extra scale. ImDrawData* DrawData; // The ImDrawData corresponding to this viewport. Valid after Render() and until the next call to NewFrame(). ImGuiID ParentViewportId; // (Advanced) 0: no parent. Instruct the platform back-end to setup a parent/child relationship between platform windows. // Our design separate the Renderer and Platform back-ends to facilitate combining default back-ends with each others. // When our create your own back-end for a custom engine, it is possible that both Renderer and Platform will be handled // by the same system and you may not need to use all the UserData/Handle fields. // The library never uses those fields, they are merely storage to facilitate back-end implementation. void* RendererUserData; // void* to hold custom data structure for the renderer (e.g. swap chain, framebuffers etc.). generally set by your Renderer_CreateWindow function. void* PlatformUserData; // void* to hold custom data structure for the OS / platform (e.g. windowing info, render context). generally set by your Platform_CreateWindow function. void* PlatformHandle; // void* for FindViewportByPlatformHandle(). (e.g. suggested to use natural platform handle such as HWND, GLFWWindow*, SDL_Window*) void* PlatformHandleRaw; // void* to hold lower-level, platform-native window handle (e.g. the HWND) when using an abstraction layer like GLFW or SDL (where PlatformHandle would be a SDL_Window*) bool PlatformRequestMove; // Platform window requested move (e.g. window was moved by the OS / host window manager, authoritative position will be OS window position) bool PlatformRequestResize; // Platform window requested resize (e.g. window was resized by the OS / host window manager, authoritative size will be OS window size) bool PlatformRequestClose; // Platform window requested closure (e.g. window was moved by the OS / host window manager, e.g. pressing ALT-F4) ImGuiViewport() { ID = 0; Flags = 0; DpiScale = 0.0f; DrawData = NULL; ParentViewportId = 0; RendererUserData = PlatformUserData = PlatformHandle = PlatformHandleRaw = NULL; PlatformRequestMove = PlatformRequestResize = PlatformRequestClose = false; } ~ImGuiViewport() { IM_ASSERT(PlatformUserData == NULL && RendererUserData == NULL); } // Access work-area rectangle with GetWorkXXX functions (see comments above) ImVec2 GetCenter() { return ImVec2(Pos.x + Size.x * 0.5f, Pos.y + Size.y * 0.5f); } ImVec2 GetWorkPos() { return ImVec2(Pos.x + WorkOffsetMin.x, Pos.y + WorkOffsetMin.y); } ImVec2 GetWorkSize() { return ImVec2(Size.x - WorkOffsetMin.x + WorkOffsetMax.x, Size.y - WorkOffsetMin.y + WorkOffsetMax.y); } // This not clamped }; #if defined(__clang__) #pragma clang diagnostic pop #elif defined(__GNUC__) #pragma GCC diagnostic pop #endif // Include imgui_user.h at the end of imgui.h (convenient for user to only explicitly include vanilla imgui.h) #ifdef IMGUI_INCLUDE_IMGUI_USER_H #include "imgui_user.h" #endif #endif // #ifndef IMGUI_DISABLE
[ "canoimaster@gmail.com" ]
canoimaster@gmail.com
d304274f98b3dac88ce6fe2048e61b288ff42038
2cf838b54b556987cfc49f42935f8aa7563ea1f4
/aws-cpp-sdk-ec2/include/aws/ec2/model/LaunchTemplateLicenseConfiguration.h
3afb1f3cf11f004c8bb2ff9e80aef4545d03cc6e
[ "MIT", "Apache-2.0", "JSON" ]
permissive
QPC-database/aws-sdk-cpp
d11e9f0ff6958c64e793c87a49f1e034813dac32
9f83105f7e07fe04380232981ab073c247d6fc85
refs/heads/main
2023-06-14T17:41:04.817304
2021-07-09T20:28:20
2021-07-09T20:28:20
384,714,703
1
0
Apache-2.0
2021-07-10T14:16:41
2021-07-10T14:16:41
null
UTF-8
C++
false
false
3,159
h
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/ec2/EC2_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSStreamFwd.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace Utils { namespace Xml { class XmlNode; } // namespace Xml } // namespace Utils namespace EC2 { namespace Model { /** * <p>Describes a license configuration.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/LaunchTemplateLicenseConfiguration">AWS * API Reference</a></p> */ class AWS_EC2_API LaunchTemplateLicenseConfiguration { public: LaunchTemplateLicenseConfiguration(); LaunchTemplateLicenseConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode); LaunchTemplateLicenseConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const; void OutputToStream(Aws::OStream& oStream, const char* location) const; /** * <p>The Amazon Resource Name (ARN) of the license configuration.</p> */ inline const Aws::String& GetLicenseConfigurationArn() const{ return m_licenseConfigurationArn; } /** * <p>The Amazon Resource Name (ARN) of the license configuration.</p> */ inline bool LicenseConfigurationArnHasBeenSet() const { return m_licenseConfigurationArnHasBeenSet; } /** * <p>The Amazon Resource Name (ARN) of the license configuration.</p> */ inline void SetLicenseConfigurationArn(const Aws::String& value) { m_licenseConfigurationArnHasBeenSet = true; m_licenseConfigurationArn = value; } /** * <p>The Amazon Resource Name (ARN) of the license configuration.</p> */ inline void SetLicenseConfigurationArn(Aws::String&& value) { m_licenseConfigurationArnHasBeenSet = true; m_licenseConfigurationArn = std::move(value); } /** * <p>The Amazon Resource Name (ARN) of the license configuration.</p> */ inline void SetLicenseConfigurationArn(const char* value) { m_licenseConfigurationArnHasBeenSet = true; m_licenseConfigurationArn.assign(value); } /** * <p>The Amazon Resource Name (ARN) of the license configuration.</p> */ inline LaunchTemplateLicenseConfiguration& WithLicenseConfigurationArn(const Aws::String& value) { SetLicenseConfigurationArn(value); return *this;} /** * <p>The Amazon Resource Name (ARN) of the license configuration.</p> */ inline LaunchTemplateLicenseConfiguration& WithLicenseConfigurationArn(Aws::String&& value) { SetLicenseConfigurationArn(std::move(value)); return *this;} /** * <p>The Amazon Resource Name (ARN) of the license configuration.</p> */ inline LaunchTemplateLicenseConfiguration& WithLicenseConfigurationArn(const char* value) { SetLicenseConfigurationArn(value); return *this;} private: Aws::String m_licenseConfigurationArn; bool m_licenseConfigurationArnHasBeenSet; }; } // namespace Model } // namespace EC2 } // namespace Aws
[ "aws-sdk-cpp-automation@github.com" ]
aws-sdk-cpp-automation@github.com
88769140d3a25bdbc2542516b44a5b57d1c6f3a8
0f41a29c058702401fbbb2d0e8b128bc60726ad7
/Armstrong/main.cpp
c2163107f839206081617f31203c6922c8217e42
[]
no_license
anirudhrathore/OOP
1d966c56acdb8562e3c4510511a48d033c62efa1
3049f63c8b8ac90badb244b81d40a4d88fc1447b
refs/heads/master
2020-07-14T03:08:20.548957
2019-12-25T12:20:39
2019-12-25T12:20:39
205,221,866
0
0
null
null
null
null
UTF-8
C++
false
false
637
cpp
// // main.cpp // Armstrong // // Created by Anirudh Singh Rathore on 29/08/19. // Copyright © 2019 Anirudh Singh Rathore. All rights reserved. // #include <iostream> #include <cmath> using namespace std; int main() { int num; int f,rem,sum=0,temp,a=0; cout<<"Enter any number : "; cin>>num; temp=num; while(temp != 0) { temp=temp/10; a=a+1; } f=num; while(f!=0) { rem=f%10; sum = sum + pow(rem,a); f=f/10; } if( sum == num ) cout<<"The number is Armstrong \n"; else cout<<"The number is not an Armstrong \n"; }
[ "anirudhsinghrathore@Anirudh-MacBook-Air-4.local" ]
anirudhsinghrathore@Anirudh-MacBook-Air-4.local
a8c51aaefad58ecb92ae6121e95e33df896bbf20
01f537061ec8477d217f0db5e0531095014039cc
/Exercise/Motor2D/j1Gui.h
b03b7bbefecb4e58203118a834e8f90b161ca3a8
[]
no_license
Hugo-Bo-Diaz/Buff-Manager-Research
944f319179ff6b98435e1cbe7c1d5af1ced5a5f0
4ebcabfb258fa1beb43d3e7541fa67f65aac0207
refs/heads/master
2020-03-09T02:32:41.595405
2018-04-04T20:16:30
2018-04-04T20:16:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,279
h
#ifndef __j1GUI_H__ #define __j1GUI_H__ #include "p2List.h" #include "p2Log.h" #include "j1Module.h" #include "p2DynArray.h" #define CURSOR_WIDTH 2 class SDL_Texture; class SDL_Rect; class UIElements; enum UIElementType; class _TTF_Font; enum UIEvents { MOUSE_ENTER, MOUSE_LEAVE, MOUSE_CLICK, MOUSE_STOP_CLICK }; class j1Gui : public j1Module { public: j1Gui(); // Destructor virtual ~j1Gui(); // Called when before render is available bool Awake(pugi::xml_node&); // Call before first frame bool Start(); // Called before all Updates bool PreUpdate(); // Called after all Updates bool PostUpdate(); // Called before quitting bool CleanUp(); bool GUIEvent(UIEvents eventType, UIElements* element) { return true; } // Gui creation functions void AddBackground(int x, int y, UIElementType type, j1Module* modul); UIElements* AddElementText(int x, int y, UIElementType type, uint font, int _r, int _g, int _b, j1Module* modul, const char* text = nullptr,bool actualize=false, bool show=true); UIElements* AddElementTextBox(int x, int y, UIElementType type, j1Module* modul, const char* text = nullptr); void AddElementImage(int x, int y, UIElementType type, SDL_Rect* rect, j1Module* modul); UIElements* AddElementButton(int x, int y, UIElementType type, SDL_Rect* RecTex, j1Module* modul, const char* text = nullptr, bool show = true); UIElements* AddElementWindow(int x, int y, UIElementType type, j1Module* modul, p2List<UIElements*>* elementslist, SDL_Rect rect,bool show=true); UIElements* AddElementSlider(int x, int y, UIElementType type, SDL_Rect* slider, SDL_Rect* button, j1Module* modul, int id, bool show = false); void DeleteElements(UIElements* element); SDL_Texture* GetAtlas() const; SDL_Texture* GetBackground() const; public: p2List<UIElements*> elements; SDL_Texture* background = nullptr; SDL_Texture* window = nullptr; SDL_Texture* textbox = nullptr; p2DynArray<_TTF_Font*> fonts; p2DynArray<SDL_Texture*> buttons; bool startgame = false; private: SDL_Texture* atlas = nullptr; p2SString atlas_file_name; p2List_item<UIElements*>* tab_element=nullptr; p2List_item<UIElements*>* last_tab_element = nullptr; uint tab_num=-1; uint last_tab = -1; bool tabing = false; }; #endif // __j1GUI_H__
[ "ivandrofiak@hotmail.com" ]
ivandrofiak@hotmail.com
e18a2d2d7c4c322682aee3ba02989ea7576ec99a
4b499e598d2536b5d4877eb21b9aab0d707bcf65
/codejam/smarket.cpp
fc8a777a8baf7eca1e1ea8fac515215becee92ae
[]
no_license
rachit173/sport
9338f36c9b315f91ee29766a97ad731228b8460d
75720f7e7d6fc11e6fcc4eff2a7c040cc89e8073
refs/heads/master
2021-08-31T15:08:17.469369
2017-12-21T20:46:53
2017-12-21T20:46:53
115,045,439
0
0
null
null
null
null
UTF-8
C++
false
false
1,674
cpp
#include<bits/stdc++.h> using namespace std; typedef pair<int,int> ii; typedef vector<ii> vii; typedef vector <int> vi; int main(){ int T; scanf("%d",&T); while(T--){ int n,q; scanf("%d %d",&n,&q); int t,p; int start_index=0; int tmpcount=0; vi marker; vi len; //bitset <n> v; //v[0]=1 scanf("%d",&p); tmpcount++; for(int i=1;i<n;i++) { scanf("%d",&t); if(t==p){ //v[i]=v[i-1]; tmpcount++; } else{ marker.push_back(start_index); len.push_back(tmpcount); start_index=i; tmpcount=1; //v[i]=v[i-1]^1; p=t; } } marker.push_back(start_index); len.push_back(tmpcount); //preprocessing for(int i=0;i<marker.size();i++) cout<<marker[i]<<" "; //query answering int k,l,r; for(int x=0;x<q;x++){ scanf("%d %d %d",&l,&r,&k); int count=0; l--;r--; vi::iterator low=lower_bound(marker.begin(),marker.end(),l); vi::iterator high=upper_bound(marker.begin(),marker.end(),r); int lowpos=low-marker.begin(); int highpos=high-marker.begin(); cout<<lowpos<<" "<<highpos<<endl; if(highpos==lowpos+1){ if(r-l+1>=k) count++; printf("%d\n",count); continue; } if((marker[lowpos+1]-l)>=k) count++; if((r-marker[highpos-1]+1)>=k) count++; if(highpos!=lowpos+2){ for(int i=lowpos+1;i<highpos;i++){ if(len[i]>k)count++; } } printf("%d\n",count); } } return 0; }
[ "rachittibrewal@gmail.com" ]
rachittibrewal@gmail.com
ebd9ef632f240a49551054c8041fa9a77bf1530d
cf3675199b905dd1992b6243e93c6b32921d9928
/TinyHTTPServer/TinyHTTPServer/request.cpp
f963b5e5ed912bec62d90c44e6cf20aed7d9d985
[]
no_license
dhbloo/NetworkLab
dcd1dd19185b9812fdf9550933bb18d8b8acbd21
ce5035b54abb6681bff6d8b13cf6987933217f34
refs/heads/master
2020-08-03T08:14:24.082462
2019-12-24T08:33:58
2019-12-24T08:33:58
211,680,494
3
0
null
null
null
null
GB18030
C++
false
false
3,353
cpp
#include "request.h" #include "requestExcept.h" #include "util.h" #include <map> #include <sstream> #include <vector> static const std::map<std::string, Request::Method> MethodMap = {{"GET", Request::GET}, {"HEAD", Request::HEAD}, {"POST", Request::POST}, {"PUT", Request::PUT}, {"DELETE", Request::DEL}, {"OPTIONS", Request::OPTIONS}}; static const std::vector<std::string> UnImpMethods = {"TRACE", "CONNECT", "LINK", "UNLINK"}; std::string Request::lowerHeader(std::string key) { auto it = headers.find(key); return it != headers.end() ? ToLower(it->second) : ""; } Request Request::parse(std::stringstream &ss) { Request request; // 解析请求行 ss >> request.methodStr >> request.url >> request.version; // 解码URL request.url = UrlDecode(request.url); // 解析HTTP方法 auto methodIt = MethodMap.find(request.methodStr); if (methodIt != MethodMap.end()) { request.method = methodIt->second; } else if (std::find(UnImpMethods.begin(), UnImpMethods.end(), request.methodStr) != UnImpMethods.end()) { request.method = Request::UNSUPPORTED; return request; } else { throw Abort(400, "Not a http request"); } // 解析URL中的查询请求 size_t questMarkPos = request.url.find_first_of('?'); if (questMarkPos != std::string::npos) { std::string queryStr = request.url.substr(questMarkPos + 1); request.url = request.url.substr(0, questMarkPos); size_t delimPos, lastPos = 0; do { delimPos = queryStr.find_first_of('&', lastPos); std::string kvStr = queryStr.substr(lastPos, delimPos - lastPos); lastPos = delimPos + 1; size_t equalPos = kvStr.find_first_of('='); if (equalPos == std::string::npos) { throw Abort(400, "Error when parsing request query url"); } request.querys[kvStr.substr(0, equalPos)] = kvStr.substr(equalPos + 1); } while (delimPos != std::string::npos); } // 解析Headers std::string buf = ss.str(); ss.seekg(0, ss.end); size_t lineStartPos; size_t lineEndPos = buf.find("\r\n"); do { lineStartPos = lineEndPos + 2; lineEndPos = buf.find("\r\n", lineStartPos); if (lineEndPos > lineStartPos) { std::string_view line(buf.data() + lineStartPos, lineEndPos - lineStartPos); size_t delimPos = line.find_first_of(':'); if (delimPos == std::string::npos) throw Abort(400, "Error when parsing request header"); request.headers[std::string(line.substr(0, delimPos))] = line.substr(delimPos + 2); } } while (lineEndPos > lineStartPos); // 剩余的部分为主体 std::string_view body(buf); request.body = buf.substr(lineEndPos + 2); return request; }
[ "1084714805@qq.com" ]
1084714805@qq.com
0eb2592900dc27d6912f6fd7c538a95ad489e0a9
f5fa3ba8e58485fd20a4c111ae3fd487af64efc9
/main.cpp
adaac2fb8ca6ccc27400588f75632251c8c0dc63
[]
no_license
akustareva/proxy-server
93b1e2a87ac90d5bd87a08a7c2739629d03c2882
483bea91751dbd895dcb15319aef23463678a523
refs/heads/master
2020-05-26T06:27:14.159457
2017-04-15T06:20:43
2017-04-15T06:20:43
82,466,904
0
0
null
null
null
null
UTF-8
C++
false
false
160
cpp
#include <iostream> #include "proxy_server.h" int main() { proxy_server proxy(ipv4_endpoint(3339, ipv4_endpoint::any())); proxy.run(); return 0; }
[ "kustaryova2012@yandex.ru" ]
kustaryova2012@yandex.ru
f36b143a50c2ebfb6615e0de62b6081bd1db7ffc
1e182929f9164ebc40f9307064c18ce1c4b2f16b
/MainApp_Daemon/SmartGateway/fas/FasHaiwanGST5000_ModbusRTU.cpp
60b2dbff31c8ef139d27ca4525424ca2292c3c0c
[]
no_license
LaiDevin/MainApp_Daemon
4883748c0d188e295c7c209914410857bf5de73c
1f465bc62479ffaab40f1d6eabb64d610ca29e45
refs/heads/master
2020-03-12T04:30:11.600870
2018-04-21T09:13:52
2018-04-21T09:13:52
130,446,250
0
0
null
null
null
null
UTF-8
C++
false
false
6,582
cpp
#include <deque> #include "FasHaiwanGST5000_ModbusRTU.h" #include "crc.h" #include "Tool.h" #include <string.h> #include <math.h> #define MSG_DEBUG (1) //从机地址 #define SLAVE_ADDR 0X01 #define MAX_POINT_SIZE 242 //查询功能码为0x03,modbus rtu的工作方式必须主机发起查询,从机返回结果 const unsigned char _query_code = 0x03; bool FasHaiwanGST5000_ModbusRTU::init(int nType, const char *sComDevName, int nBitrate, int nParity, int nDatabits, int nStopbits, int nFlowCtrl) { if(nType == COM_TYPE_RS232) { if(!m_obj232Com.Open(sComDevName, nBitrate, nParity, nDatabits, nStopbits, nFlowCtrl)) { return false; } } else if(nType == COM_TYPE_RS485) { if(!m_obj485Com.Open(sComDevName, nBitrate, nParity, nDatabits, nStopbits, nFlowCtrl)) { return false; } } return true; } bool FasHaiwanGST5000_ModbusRTU::unInit() { m_obj232Com.Close(); m_obj485Com.Close(); return false; } #define RECV_SIZE (1024) static unsigned char s_RemainBuffer[RECV_SIZE] = {0}; static int s_nRemainLen = 0; static void handleAlarmTempMsg(PartRunStatus& stPartStatus, unsigned short loop, unsigned short point) { stPartStatus.nRequestType = FAS_REQUEST_SENDEVENT; stPartStatus.nSysType = SYS_TYPE_FIRE_ALARM_SYSTEM; stPartStatus.nSysAddr = SYS_ADDR; stPartStatus.nPartType = PARTS_TYPE_ALARM_CONTROLLER; //部件地址 stPartStatus.nPartAddr[0] = 0x00; stPartStatus.nPartAddr[1] = 0x00; stPartStatus.nPartAddr[2] = 0x00; stPartStatus.nPartAddr[3] = 0x00; //Time Time stTime; Tool::getTime(stTime); stPartStatus.time.nYear = stTime.nYear; stPartStatus.time.nDay = stTime.nDay; stPartStatus.time.nDay = stTime.nDay; stPartStatus.time.nHour = stTime.nHour; stPartStatus.time.nMin = stTime.nMin; stPartStatus.time.nSec = stTime.nSec; memset(&stPartStatus.PartStatus.StatusBit, 0, sizeof(stPartStatus.PartStatus.StatusBit)); stPartStatus.PartStatus.StatusBit.nBit1 = 1; unsigned char strAddrMsg[31] = {0}; //FasID //strAddrMsg[0] = ((FAS_ID_GST5000_MODBUS_RTU >> 8) & 0xFF); //strAddrMsg[1] = (FAS_ID_GST5000_MODBUS_RTU & 0xFF); //Host strAddrMsg[2] = 0x00; strAddrMsg[3] = 0x00; //Loop strAddrMsg[4] = ((loop >> 8) & 0xFF); strAddrMsg[5] = (loop & 0xFF); //Point strAddrMsg[6] = ((point >> 8) & 0xFF); strAddrMsg[7] = (point & 0xFF); memcpy(stPartStatus.strPartDescription, strAddrMsg, 31); } static int handleMsg(std::deque<PartRunStatus> &vPartStatus, const unsigned char * buffer, int nLen, unsigned short areaNum, unsigned short point) { for (int i = 0; i < nLen; ++i) { unsigned short _alarmArea = (areaNum * MAX_POINT_SIZE + point - 1) % 16; unsigned short _indexDevice = ((unsigned short)buffer[i + 2] << 8) & buffer[ i+ 3]; PartRunStatus stPartStatus; if ( (_indexDevice >> (16 - _alarmArea)) & 0x0001) { handleAlarmTempMsg(stPartStatus, areaNum, point); vPartStatus.push_back(stPartStatus); } } return 0; } int FasHaiwanGST5000_ModbusRTU::recvData(int nComType, vector<PartRunStatus> &vtPartStatus) { Com *pobjCom = getComObj(nComType); if(NULL == pobjCom) { return -1; } unsigned char strRecvBuffer[RECV_SIZE] = {'\0'}; int nLen = pobjCom->Recv(strRecvBuffer); if (nLen > 0) { //接收数据长度大于零 if (s_nRemainLen + nLen >= RECV_SIZE - 1) { printf("error\n"); s_nRemainLen = 0; memset(s_RemainBuffer, 0, RECV_SIZE); } for (int i = 0; i < nLen; i++) { s_RemainBuffer[s_nRemainLen++] = strRecvBuffer[i]; //byte1 从机地址 byte2 功能码 byte3 应答字节数 if (s_nRemainLen >= 3) { if (s_RemainBuffer[0] == SLAVE_ADDR && s_RemainBuffer[1] == _query_code) { unsigned char _replyLen = s_RemainBuffer[2]; if (s_nRemainLen >= (_replyLen + 4 + 1)) {//0x01 0x03 和两位crc16校验位,和自身 1, 所以加5 unsigned char _remoteCrcLow = s_RemainBuffer[_replyLen + 2 + 1]; unsigned char _remoteCrcHigh = s_RemainBuffer[_replyLen + 2 + 2]; unsigned short resCrc = CRC16_MODBUS(s_RemainBuffer, _replyLen + 3); unsigned char _localCrcLow = resCrc & 0x00FF; unsigned char _localCrcHigh = resCrc >> 8; if (_localCrcHigh == _remoteCrcHigh && _localCrcLow == _remoteCrcLow) { std::deque<PartRunStatus> stPartStatus; int ret = handleMsg(stPartStatus, s_RemainBuffer, _replyLen / 2, areaNum(), point()); if(ret == -1){ printf("Incomplete data!\n"); } else { while (stPartStatus.size() > 0) { vtPartStatus.insert(vtPartStatus.end(), stPartStatus.begin(), stPartStatus.end()); } } } memset(s_RemainBuffer, 0, RECV_SIZE); s_nRemainLen = 0; } } } } } return nLen; } int FasHaiwanGST5000_ModbusRTU::sendData(int nComType) { unsigned char sBuffer[8] = {'\0'}; unsigned short _startAddr = 0; _startAddr = (areaNum() * MAX_POINT_SIZE + point() - 1) / 16; setSendLen(1); if (handleSendBuffer(sBuffer, _startAddr, sendLen()) == false) { return 0; } int nLen = ARRAY_SIZE(sBuffer); Com *pobjCom = getComObj(nComType); if(NULL == pobjCom) { return -1; } return pobjCom->Send(sBuffer, nLen); } bool FasHaiwanGST5000_ModbusRTU::handleSendBuffer(unsigned char *dest, unsigned short addr, unsigned short len) { if (!dest || ARRAY_SIZE(dest) != 8) return false; dest[0] = SLAVE_ADDR; dest[1] = _query_code; dest[2] = addr >> 8; dest[3] = addr; dest[4] = len >> 8; dest[5] = len; unsigned short crcCode = CRC16_MODBUS(dest, 6); dest[6] = crcCode; //crc low bit dest[6] = crcCode >> 8; //crc high bit return true; }
[ "laidawang@zds-t.com" ]
laidawang@zds-t.com
ed0151d9cf7d712c6082bdebf10cec4a8afad39c
5cf9ed065c0afe094727dfebdc42254dd612dfe9
/curv/arg.cc
a729c535117f4f6c19850024cf8b4d35448c678f
[ "MIT" ]
permissive
PcloD/curv
8c8c0d526d6308dc905aeceb832bb6534ed76944
cf6ddefdde7a12b32a8e0980a0d34a42ce495253
refs/heads/master
2021-07-18T06:42:22.872270
2017-10-25T12:04:47
2017-10-25T12:04:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,094
cc
// Copyright Doug Moen 2016-2017. // Distributed under The MIT License. // See accompanying file LICENCE.md or https://opensource.org/licenses/MIT #include <cmath> #include <curv/arg.h> #include <curv/exception.h> #include <curv/phrase.h> namespace curv { void At_Arg::get_locations(std::list<Location>& locs) const { assert(eval_frame_.call_phrase != nullptr); auto arg = eval_frame_.call_phrase->arg_; locs.push_back(arg->location()); // We only dump the stack starting at the parent call frame, // for cosmetic reasons. It looks stupid to underline one of the // arguments in a function call, and on the next line, // underline the same entire function call. get_frame_locations(eval_frame_.parent_frame, locs); } Shared<const String> At_Arg::rewrite_message(Shared<const String> msg) const { if (arg_index_ < 0) return msg; else return stringify("at argument[",arg_index_,"], ", msg); } // TODO: Most of the following functions are redundant with the Value API. bool arg_to_bool(Value val, const Context& ctx) { if (!val.is_bool()) throw Exception(ctx, "not boolean"); return val.get_bool_unsafe(); } auto arg_to_list(Value val, const Context& ctx) -> List& { if (!val.is_ref()) throw Exception(ctx, "not a list"); Ref_Value& ref( val.get_ref_unsafe() ); if (ref.type_ != Ref_Value::ty_list) throw Exception(ctx, "not a list"); return (List&)ref; } int arg_to_int(Value val, int lo, int hi, const Context& ctx) { if (!val.is_num()) throw Exception(ctx, "not an integer"); double num = val.get_num_unsafe(); double intf; double frac = modf(num, &intf); if (frac != 0.0) throw Exception(ctx, "not an integer"); if (intf < (double)lo || intf > (double)hi) throw Exception(ctx, stringify("not in range [",lo,"..",hi,"]")); return (int)intf; } auto arg_to_num(Value val, const Context& ctx) -> double { if (!val.is_num()) throw Exception(ctx, "not a number"); return val.get_num_unsafe(); } } // namespace curv
[ "doug@moens.org" ]
doug@moens.org
5e01b1602bc5c0f1b6d66dde46129f283a61a362
0a3a009fa93539a2b45b5642341f4cb0c5c62df5
/Axis.StandardElements/application/factories/parsers/LinearHexahedronPusoParserFactory.hpp
ce83ab9d4f0e9a2633c11cfd59671e0597582bcb
[ "MIT" ]
permissive
renato-yuzup/axis-fem
5bdb610457013d78a9f62496d4a0ba5e68a5a966
2e8d325eb9c8e99285f513b4c1218ef53eb0ab22
refs/heads/master
2020-04-28T19:54:21.273024
2019-03-31T22:04:22
2019-03-31T22:04:22
175,526,004
4
0
null
null
null
null
UTF-8
C++
false
false
988
hpp
#pragma once #include "application/factories/parsers/ElementParserFactory.hpp" #include "application/factories/parsers/BlockProvider.hpp" namespace axis { namespace application { namespace factories { namespace parsers { class LinearHexahedronPusoParserFactory : public ElementParserFactory { public: LinearHexahedronPusoParserFactory(const axis::application::factories::parsers::BlockProvider& provider); ~LinearHexahedronPusoParserFactory(void); virtual void Destroy( void ) const; virtual bool CanBuild( const axis::application::parsing::core::SectionDefinition& definition ) const; virtual axis::application::parsing::parsers::BlockParser& BuildParser( const axis::application::parsing::core::SectionDefinition& definition, axis::domain::collections::ElementSet& elementCollection ) const; private: const axis::application::factories::parsers::BlockProvider& provider_; }; } } } } // namespace axis::application::factories::parsers
[ "renato@yuzu-project.com" ]
renato@yuzu-project.com
eee7f752a033d69d4e6923a5274111228584ae57
73be585f10776bd6b6fcd0e6d1bda634ecd698c8
/tensorflow/c/experimental/filesystem/plugins/posix/posix_filesystem.cc
dcf28052a2bd2b305c034347f409fdf159881ada
[ "Apache-2.0" ]
permissive
jmhessel/tensorflow
efa9aaf95092d86c63b295fd6bc383b72349a151
87b53f5d55b8986f5d47df64a3f30b12430458de
refs/heads/master
2020-12-19T20:47:13.007391
2020-06-26T19:47:27
2020-06-26T19:47:27
235,839,141
1
0
Apache-2.0
2020-01-23T16:42:38
2020-01-23T16:42:36
null
UTF-8
C++
false
false
15,841
cc
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #include <dirent.h> #include <errno.h> #include <fcntl.h> #include <limits.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/mman.h> #include <sys/stat.h> #include <unistd.h> #include "tensorflow/c/experimental/filesystem/filesystem_interface.h" #include "tensorflow/c/experimental/filesystem/plugins/posix/posix_filesystem_helper.h" #include "tensorflow/c/tf_status.h" // Implementation of a filesystem for POSIX environments. // This filesystem will support `file://` and empty (local) URI schemes. // SECTION 1. Implementation for `TF_RandomAccessFile` // ---------------------------------------------------------------------------- namespace tf_random_access_file { typedef struct PosixFile { const char* filename; int fd; } PosixFile; static void Cleanup(TF_RandomAccessFile* file) { auto posix_file = static_cast<PosixFile*>(file->plugin_file); close(posix_file->fd); free(const_cast<char*>(posix_file->filename)); delete posix_file; } static int64_t Read(const TF_RandomAccessFile* file, uint64_t offset, size_t n, char* buffer, TF_Status* status) { auto posix_file = static_cast<PosixFile*>(file->plugin_file); char* dst = buffer; int64_t read = 0; while (n > 0) { // Some platforms, notably macs, throw `EINVAL` if `pread` is asked to read // more than fits in a 32-bit integer. size_t requested_read_length; if (n > INT32_MAX) requested_read_length = INT32_MAX; else requested_read_length = n; // `pread` returns a `ssize_t` on POSIX, but due to interface being // cross-platform, return type of `Read` is `int64_t`. int64_t r = int64_t{pread(posix_file->fd, dst, requested_read_length, static_cast<off_t>(offset))}; if (r > 0) { dst += r; offset += static_cast<uint64_t>(r); n -= r; // safe as 0 < r <= n so n will never underflow read += r; } else if (r == 0) { TF_SetStatus(status, TF_OUT_OF_RANGE, "Read fewer bytes than requested"); break; } else if (errno == EINTR || errno == EAGAIN) { // Retry } else { TF_SetStatusFromIOError(status, errno, posix_file->filename); break; } } return read; } } // namespace tf_random_access_file // SECTION 2. Implementation for `TF_WritableFile` // ---------------------------------------------------------------------------- namespace tf_writable_file { typedef struct PosixFile { const char* filename; FILE* handle; } PosixFile; static void Cleanup(TF_WritableFile* file) { auto posix_file = static_cast<PosixFile*>(file->plugin_file); free(const_cast<char*>(posix_file->filename)); delete posix_file; } static void Append(const TF_WritableFile* file, const char* buffer, size_t n, TF_Status* status) { auto posix_file = static_cast<PosixFile*>(file->plugin_file); size_t r = fwrite(buffer, 1, n, posix_file->handle); if (r != n) TF_SetStatusFromIOError(status, errno, posix_file->filename); else TF_SetStatus(status, TF_OK, ""); } static int64_t Tell(const TF_WritableFile* file, TF_Status* status) { auto posix_file = static_cast<PosixFile*>(file->plugin_file); // POSIX's `ftell` returns `long`, do a manual cast. int64_t position = int64_t{ftell(posix_file->handle)}; if (position < 0) TF_SetStatusFromIOError(status, errno, posix_file->filename); else TF_SetStatus(status, TF_OK, ""); return position; } static void Flush(const TF_WritableFile* file, TF_Status* status) { auto posix_file = static_cast<PosixFile*>(file->plugin_file); TF_SetStatus(status, TF_OK, ""); if (fflush(posix_file->handle) != 0) TF_SetStatusFromIOError(status, errno, posix_file->filename); } static void Sync(const TF_WritableFile* file, TF_Status* status) { // For historical reasons, this does the same as `Flush` at the moment. // TODO(b/144055243): This should use `fsync`/`sync`. Flush(file, status); } static void Close(const TF_WritableFile* file, TF_Status* status) { auto posix_file = static_cast<PosixFile*>(file->plugin_file); if (fclose(posix_file->handle) != 0) TF_SetStatusFromIOError(status, errno, posix_file->filename); else TF_SetStatus(status, TF_OK, ""); } } // namespace tf_writable_file // SECTION 3. Implementation for `TF_ReadOnlyMemoryRegion` // ---------------------------------------------------------------------------- namespace tf_read_only_memory_region { typedef struct PosixMemoryRegion { const void* const address; const uint64_t length; } PosixMemoryRegion; static void Cleanup(TF_ReadOnlyMemoryRegion* region) { auto r = static_cast<PosixMemoryRegion*>(region->plugin_memory_region); munmap(const_cast<void*>(r->address), r->length); delete r; } static const void* Data(const TF_ReadOnlyMemoryRegion* region) { auto r = static_cast<PosixMemoryRegion*>(region->plugin_memory_region); return r->address; } static uint64_t Length(const TF_ReadOnlyMemoryRegion* region) { auto r = static_cast<PosixMemoryRegion*>(region->plugin_memory_region); return r->length; } } // namespace tf_read_only_memory_region // SECTION 4. Implementation for `TF_Filesystem`, the actual filesystem // ---------------------------------------------------------------------------- namespace tf_posix_filesystem { static void Init(TF_Filesystem* filesystem, TF_Status* status) { TF_SetStatus(status, TF_OK, ""); } static void Cleanup(TF_Filesystem* filesystem) {} static void NewRandomAccessFile(const TF_Filesystem* filesystem, const char* path, TF_RandomAccessFile* file, TF_Status* status) { int fd = open(path, O_RDONLY); if (fd < 0) { TF_SetStatusFromIOError(status, errno, path); return; } struct stat st; fstat(fd, &st); if (S_ISDIR(st.st_mode)) { TF_SetStatus(status, TF_FAILED_PRECONDITION, "path is a directory"); close(fd); return; } file->plugin_file = new tf_random_access_file::PosixFile({strdup(path), fd}); TF_SetStatus(status, TF_OK, ""); } static void NewWritableFile(const TF_Filesystem* filesystem, const char* path, TF_WritableFile* file, TF_Status* status) { FILE* f = fopen(path, "w"); if (f == nullptr) { TF_SetStatusFromIOError(status, errno, path); return; } file->plugin_file = new tf_writable_file::PosixFile({strdup(path), f}); TF_SetStatus(status, TF_OK, ""); } static void NewAppendableFile(const TF_Filesystem* filesystem, const char* path, TF_WritableFile* file, TF_Status* status) { FILE* f = fopen(path, "a"); if (f == nullptr) { TF_SetStatusFromIOError(status, errno, path); return; } file->plugin_file = new tf_writable_file::PosixFile({strdup(path), f}); TF_SetStatus(status, TF_OK, ""); } static void NewReadOnlyMemoryRegionFromFile(const TF_Filesystem* filesystem, const char* path, TF_ReadOnlyMemoryRegion* region, TF_Status* status) { int fd = open(path, O_RDONLY); if (fd < 0) { TF_SetStatusFromIOError(status, errno, path); return; } struct stat st; fstat(fd, &st); if (S_ISDIR(st.st_mode)) { TF_SetStatus(status, TF_FAILED_PRECONDITION, "path is a directory"); } else { const void* address = mmap(nullptr, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if (address == MAP_FAILED) { TF_SetStatusFromIOError(status, errno, path); } else { region->plugin_memory_region = new tf_read_only_memory_region::PosixMemoryRegion{ address, static_cast<uint64_t>(st.st_size)}; TF_SetStatus(status, TF_OK, ""); } } close(fd); } static void CreateDir(const TF_Filesystem* filesystem, const char* path, TF_Status* status) { if (strlen(path) == 0) TF_SetStatus(status, TF_ALREADY_EXISTS, "already exists"); else if (mkdir(path, /*mode=*/0755) != 0) TF_SetStatusFromIOError(status, errno, path); else TF_SetStatus(status, TF_OK, ""); } static void DeleteFile(const TF_Filesystem* filesystem, const char* path, TF_Status* status) { if (unlink(path) != 0) TF_SetStatusFromIOError(status, errno, path); else TF_SetStatus(status, TF_OK, ""); } static void DeleteDir(const TF_Filesystem* filesystem, const char* path, TF_Status* status) { if (rmdir(path) != 0) TF_SetStatusFromIOError(status, errno, path); else TF_SetStatus(status, TF_OK, ""); } static void RenameFile(const TF_Filesystem* filesystem, const char* src, const char* dst, TF_Status* status) { // If target is a directory return TF_FAILED_PRECONDITION. // Target might be missing, so don't error in that case. struct stat st; if (stat(dst, &st) != 0) { if (errno != ENOENT) { TF_SetStatusFromIOError(status, errno, dst); return; } } else if (S_ISDIR(st.st_mode)) { TF_SetStatus(status, TF_FAILED_PRECONDITION, "target path is a directory"); return; } // We cannot rename directories yet, so prevent this. if (stat(src, &st) != 0) { TF_SetStatusFromIOError(status, errno, src); return; } else if (S_ISDIR(st.st_mode)) { TF_SetStatus(status, TF_FAILED_PRECONDITION, "source path is a directory"); return; } // Do the actual rename. Here both arguments are filenames. if (rename(src, dst) != 0) TF_SetStatusFromIOError(status, errno, dst); else TF_SetStatus(status, TF_OK, ""); } static void CopyFile(const TF_Filesystem* filesystem, const char* src, const char* dst, TF_Status* status) { // If target is a directory return TF_FAILED_PRECONDITION. // Target might be missing, so don't error in that case. struct stat st; if (stat(dst, &st) != 0) { if (errno != ENOENT) { TF_SetStatusFromIOError(status, errno, dst); return; } } else if (S_ISDIR(st.st_mode)) { TF_SetStatus(status, TF_FAILED_PRECONDITION, "target path is a directory"); return; } // We cannot copy directories yet, so prevent this. if (stat(src, &st) != 0) { TF_SetStatusFromIOError(status, errno, src); return; } else if (S_ISDIR(st.st_mode)) { TF_SetStatus(status, TF_FAILED_PRECONDITION, "source path is a directory"); return; } // Both `src` and `dst` point to files here. Delegate to helper. if (TransferFileContents(src, dst, st.st_mode, st.st_size) < 0) TF_SetStatusFromIOError(status, errno, dst); else TF_SetStatus(status, TF_OK, ""); } static void PathExists(const TF_Filesystem* filesystem, const char* path, TF_Status* status) { if (access(path, F_OK) != 0) TF_SetStatusFromIOError(status, errno, path); else TF_SetStatus(status, TF_OK, ""); } static void Stat(const TF_Filesystem* filesystem, const char* path, TF_FileStatistics* stats, TF_Status* status) { struct stat sbuf; if (stat(path, &sbuf) != 0) { TF_SetStatusFromIOError(status, errno, path); } else { stats->length = sbuf.st_size; stats->mtime_nsec = sbuf.st_mtime * (1000 * 1000 * 1000); stats->is_directory = S_ISDIR(sbuf.st_mode); TF_SetStatus(status, TF_OK, ""); } } static int GetChildren(const TF_Filesystem* filesystem, const char* path, char*** entries, TF_Status* status) { struct dirent** dir_entries = nullptr; /* we don't promise entries would be sorted */ int num_entries = scandir(path, &dir_entries, RemoveSpecialDirectoryEntries, nullptr); if (num_entries < 0) { TF_SetStatusFromIOError(status, errno, path); } else { *entries = static_cast<char**>(calloc(num_entries, sizeof((*entries)[0]))); for (int i = 0; i < num_entries; i++) { (*entries)[i] = strdup(dir_entries[i]->d_name); free(dir_entries[i]); } free(dir_entries); } return num_entries; } } // namespace tf_posix_filesystem int TF_InitPlugin(void* (*allocator)(size_t), TF_FilesystemPluginInfo** info) { const int num_schemes = 2; *info = static_cast<TF_FilesystemPluginInfo*>( allocator(num_schemes * sizeof((*info)[0]))); for (int i = 0; i < num_schemes; i++) { TF_FilesystemPluginInfo* current_info = &((*info)[i]); TF_SetFilesystemVersionMetadata(current_info); current_info->random_access_file_ops = static_cast<TF_RandomAccessFileOps*>( allocator(TF_RANDOM_ACCESS_FILE_OPS_SIZE)); current_info->random_access_file_ops->cleanup = tf_random_access_file::Cleanup; current_info->random_access_file_ops->read = tf_random_access_file::Read; current_info->writable_file_ops = static_cast<TF_WritableFileOps*>(allocator(TF_WRITABLE_FILE_OPS_SIZE)); current_info->writable_file_ops->cleanup = tf_writable_file::Cleanup; current_info->writable_file_ops->append = tf_writable_file::Append; current_info->writable_file_ops->tell = tf_writable_file::Tell; current_info->writable_file_ops->flush = tf_writable_file::Flush; current_info->writable_file_ops->sync = tf_writable_file::Sync; current_info->writable_file_ops->close = tf_writable_file::Close; current_info->read_only_memory_region_ops = static_cast<TF_ReadOnlyMemoryRegionOps*>( allocator(TF_READ_ONLY_MEMORY_REGION_OPS_SIZE)); current_info->read_only_memory_region_ops->cleanup = tf_read_only_memory_region::Cleanup; current_info->read_only_memory_region_ops->data = tf_read_only_memory_region::Data; current_info->read_only_memory_region_ops->length = tf_read_only_memory_region::Length; current_info->filesystem_ops = static_cast<TF_FilesystemOps*>(allocator(TF_FILESYSTEM_OPS_SIZE)); current_info->filesystem_ops->init = tf_posix_filesystem::Init; current_info->filesystem_ops->cleanup = tf_posix_filesystem::Cleanup; current_info->filesystem_ops->new_random_access_file = tf_posix_filesystem::NewRandomAccessFile; current_info->filesystem_ops->new_writable_file = tf_posix_filesystem::NewWritableFile; current_info->filesystem_ops->new_appendable_file = tf_posix_filesystem::NewAppendableFile; current_info->filesystem_ops->new_read_only_memory_region_from_file = tf_posix_filesystem::NewReadOnlyMemoryRegionFromFile; current_info->filesystem_ops->create_dir = tf_posix_filesystem::CreateDir; current_info->filesystem_ops->delete_file = tf_posix_filesystem::DeleteFile; current_info->filesystem_ops->delete_dir = tf_posix_filesystem::DeleteDir; current_info->filesystem_ops->rename_file = tf_posix_filesystem::RenameFile; current_info->filesystem_ops->copy_file = tf_posix_filesystem::CopyFile; current_info->filesystem_ops->path_exists = tf_posix_filesystem::PathExists; current_info->filesystem_ops->stat = tf_posix_filesystem::Stat; current_info->filesystem_ops->get_children = tf_posix_filesystem::GetChildren; } (*info)[0].scheme = strdup(""); (*info)[1].scheme = strdup("file"); return num_schemes; }
[ "gardener@tensorflow.org" ]
gardener@tensorflow.org
f93fe8dd9ed843cefec53750d6cf94d1754105ac
d72c4b383763b2759cae748f8a364c3dc648e244
/Demos/Games/Tanks/Source/JMFrameEventListener.cpp
220efaa2f1b8b52e5daedacb5a1c07bd9f7612be
[]
no_license
JackMcCallum/Portfolio
d1ccb57049b4e9f93aad2384d621ec9e54fa71bc
4fb6001b70b3cef08424f75ac919d9e5c9a1a8e5
refs/heads/master
2021-01-23T05:30:23.672861
2014-10-24T02:36:12
2014-10-24T02:36:12
25,625,986
3
0
null
null
null
null
UTF-8
C++
false
false
1,056
cpp
#include "StdAfx.h" #include "JMFrameEventListener.h" // ------------------------------------------------------------------------------------------------------------ void JMFrameEventListener::eventPreRender(const JMFrameEvent &evt) { // Do Nothing } // ------------------------------------------------------------------------------------------------------------ void JMFrameEventListener::eventPostRender(const JMFrameEvent &evt) { // Do Nothing } // ------------------------------------------------------------------------------------------------------------ void JMFrameEventListener::eventEnteringLoop(const JMFrameEvent &evt) { // Do Nothing } // ------------------------------------------------------------------------------------------------------------ void JMFrameEventListener::eventLeavingLoop(const JMFrameEvent &evt) { // Do Nothing } // ------------------------------------------------------------------------------------------------------------ void JMFrameEventListener::eventWindowResized(const JMFrameEvent &evt) { // Do Nothing }
[ "jackmccallum1994@gmail.com" ]
jackmccallum1994@gmail.com
d9cdbe27e5a07a82b79e1a2f3a0bbd92ef6d4632
9030ce2789a58888904d0c50c21591632eddffd7
/SDK/ARKSurvivalEvolved_MegaRaptor_Character_BP_classes.hpp
7a73b870433c905f8942f12223269ef4e9f56ec7
[ "MIT" ]
permissive
2bite/ARK-SDK
8ce93f504b2e3bd4f8e7ced184980b13f127b7bf
ce1f4906ccf82ed38518558c0163c4f92f5f7b14
refs/heads/master
2022-09-19T06:28:20.076298
2022-09-03T17:21:00
2022-09-03T17:21:00
232,411,353
14
5
null
null
null
null
UTF-8
C++
false
false
1,168
hpp
#pragma once // ARKSurvivalEvolved (332.8) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "ARKSurvivalEvolved_MegaRaptor_Character_BP_structs.hpp" namespace sdk { //--------------------------------------------------------------------------- //Classes //--------------------------------------------------------------------------- // BlueprintGeneratedClass MegaRaptor_Character_BP.MegaRaptor_Character_BP_C // 0x000F (0x2668 - 0x2659) class AMegaRaptor_Character_BP_C : public ARaptor_Character_BP_C { public: unsigned char UnknownData00[0x7]; // 0x2659(0x0007) MISSED OFFSET class UDinoCharacterStatusComponent_BP_MegaRaptor_C* DinoCharacterStatus_BP_MegaRaptor_C1; // 0x2660(0x0008) (BlueprintVisible, ZeroConstructor, IsPlainOldData) static UClass* StaticClass() { static auto ptr = UObject::FindClass("BlueprintGeneratedClass MegaRaptor_Character_BP.MegaRaptor_Character_BP_C"); return ptr; } void UserConstructionScript(); void ExecuteUbergraph_MegaRaptor_Character_BP(int EntryPoint); }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "sergey.2bite@gmail.com" ]
sergey.2bite@gmail.com
424de227d2d995fdbbd0b4d046b2138b02a5ac80
e20087104206b48e86cdf135145cd8d2f3c665e3
/gv_framework/inc/gv_sandbox_manager.h
c1d781e351b0f136e806495139082e0d24c6e548
[ "MIT" ]
permissive
dragonsn/gv_game_engine
5929ecdadf0403ac68b74130ecf9f72b62ddd624
92595a63148d15a989859c93223a55168a1861b5
refs/heads/master
2022-11-19T01:48:46.783547
2022-11-08T10:24:45
2022-11-08T10:24:45
159,043,827
2
1
null
null
null
null
UTF-8
C++
false
false
1,878
h
#pragma once namespace gv { //=================================================================================> // this is a singleton to manager all the sandboxes , create , and destroy // sandboxs // this is the universe! //=================================================================================> class gv_sandbox_manager_data; class gv_sandbox_manager { public: gv_sandbox_manager(); ~gv_sandbox_manager(); bool init(gv_ushort nb_sand_box = 2, gv_uint max_object_per_sand_box = 655360, bool enable_name_hash = true, bool is_editor = false); void destroy(); gv_sandbox* get_sand_box(const gv_sandbox_handle& hd); gv_sandbox* get_base_sandbox(); gv_sandbox* create_sandbox(gv_sandbox* outer = NULL); bool delete_sandbox(gv_sandbox* p); bool is_valid(const gv_sandbox_handle& hd); bool is_valid(const gv_sandbox* sandbox); bool run(); gv_string get_xml_module_file_path(const gv_id& name); gv_string get_bin_module_file_path(const gv_id& name); bool add_new_xml_module(const gv_id& name, gv_sandbox* outer, bool force_create = true); bool add_new_bin_module(const gv_id& name, gv_sandbox* outer, bool force_create = true); void register_new_xml_module_path(const gv_id& name, const gv_string_tmp& s); ; void register_new_bin_module_path(const gv_id& name, const gv_string_tmp& s); ; gv_int query_registered_modules(gvt_array< gv_id >& modules, gvt_array< gv_string >& path, bool is_binary); protected: bool init_data_dir(); bool init_native_classes(); bool init_network(); gvt_array< gvt_ref_ptr< gv_sandbox > > m_sandboxs; gv_uint m_cu_uuid; gv_ushort m_max_sandbox; gv_ushort m_sandbox_nb; gv_uint m_max_object_per_sand_box; bool m_enable_name_hash; bool m_is_inited; gv_mutex m_mutex; gv_sandbox_manager_data* m_pimpl; }; namespace gv_global { extern gvt_global< gv_sandbox_manager > sandbox_mama; } }
[ "shennan.dragon@gmail.com" ]
shennan.dragon@gmail.com
ea24326d0925011736eba1afc65b8a249c2bc257
124757448c2246c0bce084d55395a708119b78e5
/common/message/function/connecttestmessage.cpp
b48db39150e69434fcbb5fe4752d39d3a3c78ab0
[]
no_license
ssdut153/testServerGUI
9ba2a60bb18a70fbef775ccf970ef26d4cd00c60
5ae9577e71533eed57e415f62a8705a693874583
refs/heads/master
2021-08-04T19:22:21.668716
2021-02-10T07:04:51
2021-02-10T07:04:51
61,616,113
2
1
null
null
null
null
UTF-8
C++
false
false
551
cpp
/***************************************************************************************** * Copyright(c) 2016 Yang Zhizhuang (Software School of Dalian University of Technology) * All rights reserved. * * 文件名称: connecttestmessage.cpp * 简要描述: * * 创建日期: * 作者: * 说明: * * 修改日期: * 作者: * 说明: ****************************************************************************************/ #include "connecttestmessage.h" connectTestMessage::connectTestMessage() { head="connectTest"; }
[ "yzz0427@outlook.com" ]
yzz0427@outlook.com
e89e9b58e764936cda04be38a08929694da95824
7ff68ac046acb880032ca4d2cd4501db362827ce
/SneezeBall Revision/Library/Il2cppBuildCache/WebGL/il2cppOutput/UnityEngine.AudioModule.cpp
87329cd0564bebe40c8f6eea599acd001c01752b
[]
no_license
MachineLearningAmateur/UnityJuniorCrashCourse
2ed6941d7665a96a40383ed132cb1f9db6a66428
a758c413f90f1a78384be67fe1b5666fa287482b
refs/heads/main
2023-08-25T02:44:38.196631
2021-09-17T10:24:30
2021-09-17T10:24:30
403,916,603
0
0
null
null
null
null
UTF-8
C++
false
false
81,453
cpp
#include "pch-cpp.hpp" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <limits> #include <stdint.h> struct VirtActionInvoker0 { typedef void (*Action)(void*, const RuntimeMethod*); static inline void Invoke (Il2CppMethodSlot slot, RuntimeObject* obj) { const VirtualInvokeData& invokeData = il2cpp_codegen_get_virtual_invoke_data(slot, obj); ((Action)invokeData.methodPtr)(obj, invokeData.method); } }; template <typename T1> struct VirtActionInvoker1 { typedef void (*Action)(void*, T1, const RuntimeMethod*); static inline void Invoke (Il2CppMethodSlot slot, RuntimeObject* obj, T1 p1) { const VirtualInvokeData& invokeData = il2cpp_codegen_get_virtual_invoke_data(slot, obj); ((Action)invokeData.methodPtr)(obj, p1, invokeData.method); } }; template <typename T1, typename T2> struct VirtActionInvoker2 { typedef void (*Action)(void*, T1, T2, const RuntimeMethod*); static inline void Invoke (Il2CppMethodSlot slot, RuntimeObject* obj, T1 p1, T2 p2) { const VirtualInvokeData& invokeData = il2cpp_codegen_get_virtual_invoke_data(slot, obj); ((Action)invokeData.methodPtr)(obj, p1, p2, invokeData.method); } }; struct GenericVirtActionInvoker0 { typedef void (*Action)(void*, const RuntimeMethod*); static inline void Invoke (const RuntimeMethod* method, RuntimeObject* obj) { VirtualInvokeData invokeData; il2cpp_codegen_get_generic_virtual_invoke_data(method, obj, &invokeData); ((Action)invokeData.methodPtr)(obj, invokeData.method); } }; template <typename T1> struct GenericVirtActionInvoker1 { typedef void (*Action)(void*, T1, const RuntimeMethod*); static inline void Invoke (const RuntimeMethod* method, RuntimeObject* obj, T1 p1) { VirtualInvokeData invokeData; il2cpp_codegen_get_generic_virtual_invoke_data(method, obj, &invokeData); ((Action)invokeData.methodPtr)(obj, p1, invokeData.method); } }; template <typename T1, typename T2> struct GenericVirtActionInvoker2 { typedef void (*Action)(void*, T1, T2, const RuntimeMethod*); static inline void Invoke (const RuntimeMethod* method, RuntimeObject* obj, T1 p1, T2 p2) { VirtualInvokeData invokeData; il2cpp_codegen_get_generic_virtual_invoke_data(method, obj, &invokeData); ((Action)invokeData.methodPtr)(obj, p1, p2, invokeData.method); } }; struct InterfaceActionInvoker0 { typedef void (*Action)(void*, const RuntimeMethod*); static inline void Invoke (Il2CppMethodSlot slot, RuntimeClass* declaringInterface, RuntimeObject* obj) { const VirtualInvokeData& invokeData = il2cpp_codegen_get_interface_invoke_data(slot, obj, declaringInterface); ((Action)invokeData.methodPtr)(obj, invokeData.method); } }; template <typename T1> struct InterfaceActionInvoker1 { typedef void (*Action)(void*, T1, const RuntimeMethod*); static inline void Invoke (Il2CppMethodSlot slot, RuntimeClass* declaringInterface, RuntimeObject* obj, T1 p1) { const VirtualInvokeData& invokeData = il2cpp_codegen_get_interface_invoke_data(slot, obj, declaringInterface); ((Action)invokeData.methodPtr)(obj, p1, invokeData.method); } }; template <typename T1, typename T2> struct InterfaceActionInvoker2 { typedef void (*Action)(void*, T1, T2, const RuntimeMethod*); static inline void Invoke (Il2CppMethodSlot slot, RuntimeClass* declaringInterface, RuntimeObject* obj, T1 p1, T2 p2) { const VirtualInvokeData& invokeData = il2cpp_codegen_get_interface_invoke_data(slot, obj, declaringInterface); ((Action)invokeData.methodPtr)(obj, p1, p2, invokeData.method); } }; struct GenericInterfaceActionInvoker0 { typedef void (*Action)(void*, const RuntimeMethod*); static inline void Invoke (const RuntimeMethod* method, RuntimeObject* obj) { VirtualInvokeData invokeData; il2cpp_codegen_get_generic_interface_invoke_data(method, obj, &invokeData); ((Action)invokeData.methodPtr)(obj, invokeData.method); } }; template <typename T1> struct GenericInterfaceActionInvoker1 { typedef void (*Action)(void*, T1, const RuntimeMethod*); static inline void Invoke (const RuntimeMethod* method, RuntimeObject* obj, T1 p1) { VirtualInvokeData invokeData; il2cpp_codegen_get_generic_interface_invoke_data(method, obj, &invokeData); ((Action)invokeData.methodPtr)(obj, p1, invokeData.method); } }; template <typename T1, typename T2> struct GenericInterfaceActionInvoker2 { typedef void (*Action)(void*, T1, T2, const RuntimeMethod*); static inline void Invoke (const RuntimeMethod* method, RuntimeObject* obj, T1 p1, T2 p2) { VirtualInvokeData invokeData; il2cpp_codegen_get_generic_interface_invoke_data(method, obj, &invokeData); ((Action)invokeData.methodPtr)(obj, p1, p2, invokeData.method); } }; // System.Delegate[] struct DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8; // System.Single[] struct SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA; // System.AsyncCallback struct AsyncCallback_tA7921BEF974919C46FF8F9D9867C567B200BB0EA; // UnityEngine.AudioClip struct AudioClip_t16D2E573E7CC1C5118D8EE0F0692D46866A1C0EE; // UnityEngine.Experimental.Audio.AudioSampleProvider struct AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B; // System.Delegate struct Delegate_t; // System.DelegateData struct DelegateData_t17DD30660E330C49381DAA99F934BE75CB11F288; // System.IAsyncResult struct IAsyncResult_tC9F97BF36FCF122D29D3101D80642278297BF370; // System.Reflection.MethodInfo struct MethodInfo_t; // System.String struct String_t; // System.Void struct Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5; // UnityEngine.AudioClip/PCMReaderCallback struct PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B; // UnityEngine.AudioClip/PCMSetPositionCallback struct PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C; // UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler struct SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487; // UnityEngine.AudioSettings/AudioConfigurationChangeHandler struct AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A; IL2CPP_EXTERN_C RuntimeClass* AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_il2cpp_TypeInfo_var; IL2CPP_EXTERN_C RuntimeClass* Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_il2cpp_TypeInfo_var; IL2CPP_EXTERN_C RuntimeClass* Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046_il2cpp_TypeInfo_var; IL2CPP_EXTERN_C RuntimeClass* PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A_il2cpp_TypeInfo_var; IL2CPP_EXTERN_C RuntimeClass* UInt32_tE60352A06233E4E69DD198BCC67142159F686B15_il2cpp_TypeInfo_var; struct Delegate_t_marshaled_com; struct Delegate_t_marshaled_pinvoke; struct DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8; struct SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA; IL2CPP_EXTERN_C_BEGIN IL2CPP_EXTERN_C_END #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // <Module> struct U3CModuleU3E_t6975E9BBACF02877D569BBF09DC44C44D3C346CB { public: public: }; // System.Object struct Il2CppArrayBounds; // System.Array // UnityEngine.Experimental.Audio.AudioSampleProvider struct AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B : public RuntimeObject { public: // UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler UnityEngine.Experimental.Audio.AudioSampleProvider::sampleFramesAvailable SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * ___sampleFramesAvailable_0; // UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler UnityEngine.Experimental.Audio.AudioSampleProvider::sampleFramesOverflow SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * ___sampleFramesOverflow_1; public: inline static int32_t get_offset_of_sampleFramesAvailable_0() { return static_cast<int32_t>(offsetof(AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B, ___sampleFramesAvailable_0)); } inline SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * get_sampleFramesAvailable_0() const { return ___sampleFramesAvailable_0; } inline SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 ** get_address_of_sampleFramesAvailable_0() { return &___sampleFramesAvailable_0; } inline void set_sampleFramesAvailable_0(SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * value) { ___sampleFramesAvailable_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___sampleFramesAvailable_0), (void*)value); } inline static int32_t get_offset_of_sampleFramesOverflow_1() { return static_cast<int32_t>(offsetof(AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B, ___sampleFramesOverflow_1)); } inline SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * get_sampleFramesOverflow_1() const { return ___sampleFramesOverflow_1; } inline SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 ** get_address_of_sampleFramesOverflow_1() { return &___sampleFramesOverflow_1; } inline void set_sampleFramesOverflow_1(SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * value) { ___sampleFramesOverflow_1 = value; Il2CppCodeGenWriteBarrier((void**)(&___sampleFramesOverflow_1), (void*)value); } }; // UnityEngine.AudioSettings struct AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08 : public RuntimeObject { public: public: }; struct AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_StaticFields { public: // UnityEngine.AudioSettings/AudioConfigurationChangeHandler UnityEngine.AudioSettings::OnAudioConfigurationChanged AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * ___OnAudioConfigurationChanged_0; public: inline static int32_t get_offset_of_OnAudioConfigurationChanged_0() { return static_cast<int32_t>(offsetof(AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_StaticFields, ___OnAudioConfigurationChanged_0)); } inline AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * get_OnAudioConfigurationChanged_0() const { return ___OnAudioConfigurationChanged_0; } inline AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A ** get_address_of_OnAudioConfigurationChanged_0() { return &___OnAudioConfigurationChanged_0; } inline void set_OnAudioConfigurationChanged_0(AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * value) { ___OnAudioConfigurationChanged_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___OnAudioConfigurationChanged_0), (void*)value); } }; // System.ValueType struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52 : public RuntimeObject { public: public: }; // Native definition for P/Invoke marshalling of System.ValueType struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52_marshaled_pinvoke { }; // Native definition for COM marshalling of System.ValueType struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52_marshaled_com { }; // System.Boolean struct Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37 { public: // System.Boolean System.Boolean::m_value bool ___m_value_0; public: inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37, ___m_value_0)); } inline bool get_m_value_0() const { return ___m_value_0; } inline bool* get_address_of_m_value_0() { return &___m_value_0; } inline void set_m_value_0(bool value) { ___m_value_0 = value; } }; struct Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields { public: // System.String System.Boolean::TrueString String_t* ___TrueString_5; // System.String System.Boolean::FalseString String_t* ___FalseString_6; public: inline static int32_t get_offset_of_TrueString_5() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields, ___TrueString_5)); } inline String_t* get_TrueString_5() const { return ___TrueString_5; } inline String_t** get_address_of_TrueString_5() { return &___TrueString_5; } inline void set_TrueString_5(String_t* value) { ___TrueString_5 = value; Il2CppCodeGenWriteBarrier((void**)(&___TrueString_5), (void*)value); } inline static int32_t get_offset_of_FalseString_6() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields, ___FalseString_6)); } inline String_t* get_FalseString_6() const { return ___FalseString_6; } inline String_t** get_address_of_FalseString_6() { return &___FalseString_6; } inline void set_FalseString_6(String_t* value) { ___FalseString_6 = value; Il2CppCodeGenWriteBarrier((void**)(&___FalseString_6), (void*)value); } }; // System.Int32 struct Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046 { public: // System.Int32 System.Int32::m_value int32_t ___m_value_0; public: inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046, ___m_value_0)); } inline int32_t get_m_value_0() const { return ___m_value_0; } inline int32_t* get_address_of_m_value_0() { return &___m_value_0; } inline void set_m_value_0(int32_t value) { ___m_value_0 = value; } }; // System.IntPtr struct IntPtr_t { public: // System.Void* System.IntPtr::m_value void* ___m_value_0; public: inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(IntPtr_t, ___m_value_0)); } inline void* get_m_value_0() const { return ___m_value_0; } inline void** get_address_of_m_value_0() { return &___m_value_0; } inline void set_m_value_0(void* value) { ___m_value_0 = value; } }; struct IntPtr_t_StaticFields { public: // System.IntPtr System.IntPtr::Zero intptr_t ___Zero_1; public: inline static int32_t get_offset_of_Zero_1() { return static_cast<int32_t>(offsetof(IntPtr_t_StaticFields, ___Zero_1)); } inline intptr_t get_Zero_1() const { return ___Zero_1; } inline intptr_t* get_address_of_Zero_1() { return &___Zero_1; } inline void set_Zero_1(intptr_t value) { ___Zero_1 = value; } }; // System.Single struct Single_tE07797BA3C98D4CA9B5A19413C19A76688AB899E { public: // System.Single System.Single::m_value float ___m_value_0; public: inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Single_tE07797BA3C98D4CA9B5A19413C19A76688AB899E, ___m_value_0)); } inline float get_m_value_0() const { return ___m_value_0; } inline float* get_address_of_m_value_0() { return &___m_value_0; } inline void set_m_value_0(float value) { ___m_value_0 = value; } }; // System.UInt32 struct UInt32_tE60352A06233E4E69DD198BCC67142159F686B15 { public: // System.UInt32 System.UInt32::m_value uint32_t ___m_value_0; public: inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(UInt32_tE60352A06233E4E69DD198BCC67142159F686B15, ___m_value_0)); } inline uint32_t get_m_value_0() const { return ___m_value_0; } inline uint32_t* get_address_of_m_value_0() { return &___m_value_0; } inline void set_m_value_0(uint32_t value) { ___m_value_0 = value; } }; // System.Void struct Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5 { public: union { struct { }; uint8_t Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5__padding[1]; }; public: }; // System.Delegate struct Delegate_t : public RuntimeObject { public: // System.IntPtr System.Delegate::method_ptr Il2CppMethodPointer ___method_ptr_0; // System.IntPtr System.Delegate::invoke_impl intptr_t ___invoke_impl_1; // System.Object System.Delegate::m_target RuntimeObject * ___m_target_2; // System.IntPtr System.Delegate::method intptr_t ___method_3; // System.IntPtr System.Delegate::delegate_trampoline intptr_t ___delegate_trampoline_4; // System.IntPtr System.Delegate::extra_arg intptr_t ___extra_arg_5; // System.IntPtr System.Delegate::method_code intptr_t ___method_code_6; // System.Reflection.MethodInfo System.Delegate::method_info MethodInfo_t * ___method_info_7; // System.Reflection.MethodInfo System.Delegate::original_method_info MethodInfo_t * ___original_method_info_8; // System.DelegateData System.Delegate::data DelegateData_t17DD30660E330C49381DAA99F934BE75CB11F288 * ___data_9; // System.Boolean System.Delegate::method_is_virtual bool ___method_is_virtual_10; public: inline static int32_t get_offset_of_method_ptr_0() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_ptr_0)); } inline Il2CppMethodPointer get_method_ptr_0() const { return ___method_ptr_0; } inline Il2CppMethodPointer* get_address_of_method_ptr_0() { return &___method_ptr_0; } inline void set_method_ptr_0(Il2CppMethodPointer value) { ___method_ptr_0 = value; } inline static int32_t get_offset_of_invoke_impl_1() { return static_cast<int32_t>(offsetof(Delegate_t, ___invoke_impl_1)); } inline intptr_t get_invoke_impl_1() const { return ___invoke_impl_1; } inline intptr_t* get_address_of_invoke_impl_1() { return &___invoke_impl_1; } inline void set_invoke_impl_1(intptr_t value) { ___invoke_impl_1 = value; } inline static int32_t get_offset_of_m_target_2() { return static_cast<int32_t>(offsetof(Delegate_t, ___m_target_2)); } inline RuntimeObject * get_m_target_2() const { return ___m_target_2; } inline RuntimeObject ** get_address_of_m_target_2() { return &___m_target_2; } inline void set_m_target_2(RuntimeObject * value) { ___m_target_2 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_target_2), (void*)value); } inline static int32_t get_offset_of_method_3() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_3)); } inline intptr_t get_method_3() const { return ___method_3; } inline intptr_t* get_address_of_method_3() { return &___method_3; } inline void set_method_3(intptr_t value) { ___method_3 = value; } inline static int32_t get_offset_of_delegate_trampoline_4() { return static_cast<int32_t>(offsetof(Delegate_t, ___delegate_trampoline_4)); } inline intptr_t get_delegate_trampoline_4() const { return ___delegate_trampoline_4; } inline intptr_t* get_address_of_delegate_trampoline_4() { return &___delegate_trampoline_4; } inline void set_delegate_trampoline_4(intptr_t value) { ___delegate_trampoline_4 = value; } inline static int32_t get_offset_of_extra_arg_5() { return static_cast<int32_t>(offsetof(Delegate_t, ___extra_arg_5)); } inline intptr_t get_extra_arg_5() const { return ___extra_arg_5; } inline intptr_t* get_address_of_extra_arg_5() { return &___extra_arg_5; } inline void set_extra_arg_5(intptr_t value) { ___extra_arg_5 = value; } inline static int32_t get_offset_of_method_code_6() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_code_6)); } inline intptr_t get_method_code_6() const { return ___method_code_6; } inline intptr_t* get_address_of_method_code_6() { return &___method_code_6; } inline void set_method_code_6(intptr_t value) { ___method_code_6 = value; } inline static int32_t get_offset_of_method_info_7() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_info_7)); } inline MethodInfo_t * get_method_info_7() const { return ___method_info_7; } inline MethodInfo_t ** get_address_of_method_info_7() { return &___method_info_7; } inline void set_method_info_7(MethodInfo_t * value) { ___method_info_7 = value; Il2CppCodeGenWriteBarrier((void**)(&___method_info_7), (void*)value); } inline static int32_t get_offset_of_original_method_info_8() { return static_cast<int32_t>(offsetof(Delegate_t, ___original_method_info_8)); } inline MethodInfo_t * get_original_method_info_8() const { return ___original_method_info_8; } inline MethodInfo_t ** get_address_of_original_method_info_8() { return &___original_method_info_8; } inline void set_original_method_info_8(MethodInfo_t * value) { ___original_method_info_8 = value; Il2CppCodeGenWriteBarrier((void**)(&___original_method_info_8), (void*)value); } inline static int32_t get_offset_of_data_9() { return static_cast<int32_t>(offsetof(Delegate_t, ___data_9)); } inline DelegateData_t17DD30660E330C49381DAA99F934BE75CB11F288 * get_data_9() const { return ___data_9; } inline DelegateData_t17DD30660E330C49381DAA99F934BE75CB11F288 ** get_address_of_data_9() { return &___data_9; } inline void set_data_9(DelegateData_t17DD30660E330C49381DAA99F934BE75CB11F288 * value) { ___data_9 = value; Il2CppCodeGenWriteBarrier((void**)(&___data_9), (void*)value); } inline static int32_t get_offset_of_method_is_virtual_10() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_is_virtual_10)); } inline bool get_method_is_virtual_10() const { return ___method_is_virtual_10; } inline bool* get_address_of_method_is_virtual_10() { return &___method_is_virtual_10; } inline void set_method_is_virtual_10(bool value) { ___method_is_virtual_10 = value; } }; // Native definition for P/Invoke marshalling of System.Delegate struct Delegate_t_marshaled_pinvoke { intptr_t ___method_ptr_0; intptr_t ___invoke_impl_1; Il2CppIUnknown* ___m_target_2; intptr_t ___method_3; intptr_t ___delegate_trampoline_4; intptr_t ___extra_arg_5; intptr_t ___method_code_6; MethodInfo_t * ___method_info_7; MethodInfo_t * ___original_method_info_8; DelegateData_t17DD30660E330C49381DAA99F934BE75CB11F288 * ___data_9; int32_t ___method_is_virtual_10; }; // Native definition for COM marshalling of System.Delegate struct Delegate_t_marshaled_com { intptr_t ___method_ptr_0; intptr_t ___invoke_impl_1; Il2CppIUnknown* ___m_target_2; intptr_t ___method_3; intptr_t ___delegate_trampoline_4; intptr_t ___extra_arg_5; intptr_t ___method_code_6; MethodInfo_t * ___method_info_7; MethodInfo_t * ___original_method_info_8; DelegateData_t17DD30660E330C49381DAA99F934BE75CB11F288 * ___data_9; int32_t ___method_is_virtual_10; }; // UnityEngine.Object struct Object_tF2F3778131EFF286AF62B7B013A170F95A91571A : public RuntimeObject { public: // System.IntPtr UnityEngine.Object::m_CachedPtr intptr_t ___m_CachedPtr_0; public: inline static int32_t get_offset_of_m_CachedPtr_0() { return static_cast<int32_t>(offsetof(Object_tF2F3778131EFF286AF62B7B013A170F95A91571A, ___m_CachedPtr_0)); } inline intptr_t get_m_CachedPtr_0() const { return ___m_CachedPtr_0; } inline intptr_t* get_address_of_m_CachedPtr_0() { return &___m_CachedPtr_0; } inline void set_m_CachedPtr_0(intptr_t value) { ___m_CachedPtr_0 = value; } }; struct Object_tF2F3778131EFF286AF62B7B013A170F95A91571A_StaticFields { public: // System.Int32 UnityEngine.Object::OffsetOfInstanceIDInCPlusPlusObject int32_t ___OffsetOfInstanceIDInCPlusPlusObject_1; public: inline static int32_t get_offset_of_OffsetOfInstanceIDInCPlusPlusObject_1() { return static_cast<int32_t>(offsetof(Object_tF2F3778131EFF286AF62B7B013A170F95A91571A_StaticFields, ___OffsetOfInstanceIDInCPlusPlusObject_1)); } inline int32_t get_OffsetOfInstanceIDInCPlusPlusObject_1() const { return ___OffsetOfInstanceIDInCPlusPlusObject_1; } inline int32_t* get_address_of_OffsetOfInstanceIDInCPlusPlusObject_1() { return &___OffsetOfInstanceIDInCPlusPlusObject_1; } inline void set_OffsetOfInstanceIDInCPlusPlusObject_1(int32_t value) { ___OffsetOfInstanceIDInCPlusPlusObject_1 = value; } }; // Native definition for P/Invoke marshalling of UnityEngine.Object struct Object_tF2F3778131EFF286AF62B7B013A170F95A91571A_marshaled_pinvoke { intptr_t ___m_CachedPtr_0; }; // Native definition for COM marshalling of UnityEngine.Object struct Object_tF2F3778131EFF286AF62B7B013A170F95A91571A_marshaled_com { intptr_t ___m_CachedPtr_0; }; // UnityEngine.Playables.PlayableHandle struct PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A { public: // System.IntPtr UnityEngine.Playables.PlayableHandle::m_Handle intptr_t ___m_Handle_0; // System.UInt32 UnityEngine.Playables.PlayableHandle::m_Version uint32_t ___m_Version_1; public: inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A, ___m_Handle_0)); } inline intptr_t get_m_Handle_0() const { return ___m_Handle_0; } inline intptr_t* get_address_of_m_Handle_0() { return &___m_Handle_0; } inline void set_m_Handle_0(intptr_t value) { ___m_Handle_0 = value; } inline static int32_t get_offset_of_m_Version_1() { return static_cast<int32_t>(offsetof(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A, ___m_Version_1)); } inline uint32_t get_m_Version_1() const { return ___m_Version_1; } inline uint32_t* get_address_of_m_Version_1() { return &___m_Version_1; } inline void set_m_Version_1(uint32_t value) { ___m_Version_1 = value; } }; struct PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A_StaticFields { public: // UnityEngine.Playables.PlayableHandle UnityEngine.Playables.PlayableHandle::m_Null PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A ___m_Null_2; public: inline static int32_t get_offset_of_m_Null_2() { return static_cast<int32_t>(offsetof(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A_StaticFields, ___m_Null_2)); } inline PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A get_m_Null_2() const { return ___m_Null_2; } inline PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A * get_address_of_m_Null_2() { return &___m_Null_2; } inline void set_m_Null_2(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A value) { ___m_Null_2 = value; } }; // UnityEngine.Playables.PlayableOutputHandle struct PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 { public: // System.IntPtr UnityEngine.Playables.PlayableOutputHandle::m_Handle intptr_t ___m_Handle_0; // System.UInt32 UnityEngine.Playables.PlayableOutputHandle::m_Version uint32_t ___m_Version_1; public: inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1, ___m_Handle_0)); } inline intptr_t get_m_Handle_0() const { return ___m_Handle_0; } inline intptr_t* get_address_of_m_Handle_0() { return &___m_Handle_0; } inline void set_m_Handle_0(intptr_t value) { ___m_Handle_0 = value; } inline static int32_t get_offset_of_m_Version_1() { return static_cast<int32_t>(offsetof(PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1, ___m_Version_1)); } inline uint32_t get_m_Version_1() const { return ___m_Version_1; } inline uint32_t* get_address_of_m_Version_1() { return &___m_Version_1; } inline void set_m_Version_1(uint32_t value) { ___m_Version_1 = value; } }; struct PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1_StaticFields { public: // UnityEngine.Playables.PlayableOutputHandle UnityEngine.Playables.PlayableOutputHandle::m_Null PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 ___m_Null_2; public: inline static int32_t get_offset_of_m_Null_2() { return static_cast<int32_t>(offsetof(PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1_StaticFields, ___m_Null_2)); } inline PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 get_m_Null_2() const { return ___m_Null_2; } inline PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 * get_address_of_m_Null_2() { return &___m_Null_2; } inline void set_m_Null_2(PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 value) { ___m_Null_2 = value; } }; // UnityEngine.AudioClip struct AudioClip_t16D2E573E7CC1C5118D8EE0F0692D46866A1C0EE : public Object_tF2F3778131EFF286AF62B7B013A170F95A91571A { public: // UnityEngine.AudioClip/PCMReaderCallback UnityEngine.AudioClip::m_PCMReaderCallback PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * ___m_PCMReaderCallback_4; // UnityEngine.AudioClip/PCMSetPositionCallback UnityEngine.AudioClip::m_PCMSetPositionCallback PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * ___m_PCMSetPositionCallback_5; public: inline static int32_t get_offset_of_m_PCMReaderCallback_4() { return static_cast<int32_t>(offsetof(AudioClip_t16D2E573E7CC1C5118D8EE0F0692D46866A1C0EE, ___m_PCMReaderCallback_4)); } inline PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * get_m_PCMReaderCallback_4() const { return ___m_PCMReaderCallback_4; } inline PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B ** get_address_of_m_PCMReaderCallback_4() { return &___m_PCMReaderCallback_4; } inline void set_m_PCMReaderCallback_4(PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * value) { ___m_PCMReaderCallback_4 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_PCMReaderCallback_4), (void*)value); } inline static int32_t get_offset_of_m_PCMSetPositionCallback_5() { return static_cast<int32_t>(offsetof(AudioClip_t16D2E573E7CC1C5118D8EE0F0692D46866A1C0EE, ___m_PCMSetPositionCallback_5)); } inline PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * get_m_PCMSetPositionCallback_5() const { return ___m_PCMSetPositionCallback_5; } inline PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C ** get_address_of_m_PCMSetPositionCallback_5() { return &___m_PCMSetPositionCallback_5; } inline void set_m_PCMSetPositionCallback_5(PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * value) { ___m_PCMSetPositionCallback_5 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_PCMSetPositionCallback_5), (void*)value); } }; // UnityEngine.Audio.AudioClipPlayable struct AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F { public: // UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioClipPlayable::m_Handle PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A ___m_Handle_0; public: inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F, ___m_Handle_0)); } inline PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A get_m_Handle_0() const { return ___m_Handle_0; } inline PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A * get_address_of_m_Handle_0() { return &___m_Handle_0; } inline void set_m_Handle_0(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A value) { ___m_Handle_0 = value; } }; // UnityEngine.Audio.AudioMixerPlayable struct AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A { public: // UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioMixerPlayable::m_Handle PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A ___m_Handle_0; public: inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A, ___m_Handle_0)); } inline PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A get_m_Handle_0() const { return ___m_Handle_0; } inline PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A * get_address_of_m_Handle_0() { return &___m_Handle_0; } inline void set_m_Handle_0(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A value) { ___m_Handle_0 = value; } }; // UnityEngine.Audio.AudioPlayableOutput struct AudioPlayableOutput_t9809407FDE5B55DD34088A665C8C53346AC76EE8 { public: // UnityEngine.Playables.PlayableOutputHandle UnityEngine.Audio.AudioPlayableOutput::m_Handle PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 ___m_Handle_0; public: inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(AudioPlayableOutput_t9809407FDE5B55DD34088A665C8C53346AC76EE8, ___m_Handle_0)); } inline PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 get_m_Handle_0() const { return ___m_Handle_0; } inline PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 * get_address_of_m_Handle_0() { return &___m_Handle_0; } inline void set_m_Handle_0(PlayableOutputHandle_t8C84BCDB2AECFEDBCF0E7CC7CDBADD517D148CD1 value) { ___m_Handle_0 = value; } }; // UnityEngine.Component struct Component_t62FBC8D2420DA4BE9037AFE430740F6B3EECA684 : public Object_tF2F3778131EFF286AF62B7B013A170F95A91571A { public: public: }; // System.MulticastDelegate struct MulticastDelegate_t : public Delegate_t { public: // System.Delegate[] System.MulticastDelegate::delegates DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8* ___delegates_11; public: inline static int32_t get_offset_of_delegates_11() { return static_cast<int32_t>(offsetof(MulticastDelegate_t, ___delegates_11)); } inline DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8* get_delegates_11() const { return ___delegates_11; } inline DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8** get_address_of_delegates_11() { return &___delegates_11; } inline void set_delegates_11(DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8* value) { ___delegates_11 = value; Il2CppCodeGenWriteBarrier((void**)(&___delegates_11), (void*)value); } }; // Native definition for P/Invoke marshalling of System.MulticastDelegate struct MulticastDelegate_t_marshaled_pinvoke : public Delegate_t_marshaled_pinvoke { Delegate_t_marshaled_pinvoke** ___delegates_11; }; // Native definition for COM marshalling of System.MulticastDelegate struct MulticastDelegate_t_marshaled_com : public Delegate_t_marshaled_com { Delegate_t_marshaled_com** ___delegates_11; }; // System.AsyncCallback struct AsyncCallback_tA7921BEF974919C46FF8F9D9867C567B200BB0EA : public MulticastDelegate_t { public: public: }; // UnityEngine.Behaviour struct Behaviour_t1A3DDDCF73B4627928FBFE02ED52B7251777DBD9 : public Component_t62FBC8D2420DA4BE9037AFE430740F6B3EECA684 { public: public: }; // UnityEngine.AudioClip/PCMReaderCallback struct PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B : public MulticastDelegate_t { public: public: }; // UnityEngine.AudioClip/PCMSetPositionCallback struct PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C : public MulticastDelegate_t { public: public: }; // UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler struct SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 : public MulticastDelegate_t { public: public: }; // UnityEngine.AudioSettings/AudioConfigurationChangeHandler struct AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A : public MulticastDelegate_t { public: public: }; // UnityEngine.AudioBehaviour struct AudioBehaviour_tB44966D47AD43C50C7294AEE9B57574E55AACA4A : public Behaviour_t1A3DDDCF73B4627928FBFE02ED52B7251777DBD9 { public: public: }; // UnityEngine.AudioListener struct AudioListener_t03B51B434A263F9AFD07AC8AA5CB4FE6402252A3 : public AudioBehaviour_tB44966D47AD43C50C7294AEE9B57574E55AACA4A { public: public: }; // UnityEngine.AudioSource struct AudioSource_tC4BF65AF8CDCAA63724BB3CA59A7A29249269E6B : public AudioBehaviour_tB44966D47AD43C50C7294AEE9B57574E55AACA4A { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif // System.Single[] struct SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA : public RuntimeArray { public: ALIGN_FIELD (8) float m_Items[1]; public: inline float GetAt(il2cpp_array_size_t index) const { IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length); return m_Items[index]; } inline float* GetAddressAt(il2cpp_array_size_t index) { IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length); return m_Items + index; } inline void SetAt(il2cpp_array_size_t index, float value) { IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length); m_Items[index] = value; } inline float GetAtUnchecked(il2cpp_array_size_t index) const { return m_Items[index]; } inline float* GetAddressAtUnchecked(il2cpp_array_size_t index) { return m_Items + index; } inline void SetAtUnchecked(il2cpp_array_size_t index, float value) { m_Items[index] = value; } }; // System.Delegate[] struct DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8 : public RuntimeArray { public: ALIGN_FIELD (8) Delegate_t * m_Items[1]; public: inline Delegate_t * GetAt(il2cpp_array_size_t index) const { IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length); return m_Items[index]; } inline Delegate_t ** GetAddressAt(il2cpp_array_size_t index) { IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length); return m_Items + index; } inline void SetAt(il2cpp_array_size_t index, Delegate_t * value) { IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length); m_Items[index] = value; Il2CppCodeGenWriteBarrier((void**)m_Items + index, (void*)value); } inline Delegate_t * GetAtUnchecked(il2cpp_array_size_t index) const { return m_Items[index]; } inline Delegate_t ** GetAddressAtUnchecked(il2cpp_array_size_t index) { return m_Items + index; } inline void SetAtUnchecked(il2cpp_array_size_t index, Delegate_t * value) { m_Items[index] = value; Il2CppCodeGenWriteBarrier((void**)m_Items + index, (void*)value); } }; // System.Void UnityEngine.AudioClip/PCMReaderCallback::Invoke(System.Single[]) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PCMReaderCallback_Invoke_mE5E7A777A52B9627F9A6A57A140E5C4AAB5A1387 (PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * __this, SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* ___data0, const RuntimeMethod* method); // System.Void UnityEngine.AudioClip/PCMSetPositionCallback::Invoke(System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PCMSetPositionCallback_Invoke_m1FBFFA5FC15B57601D6D13F4A574F7CAD2A93B7E (PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * __this, int32_t ___position0, const RuntimeMethod* method); // UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioClipPlayable::GetHandle() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A AudioClipPlayable_GetHandle_mBEB846B088961170B6DB961951B511C11B98E0B8 (AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F * __this, const RuntimeMethod* method); // System.Boolean UnityEngine.Playables.PlayableHandle::op_Equality(UnityEngine.Playables.PlayableHandle,UnityEngine.Playables.PlayableHandle) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PlayableHandle_op_Equality_mFD26CFA8ECF2B622B1A3D4117066CAE965C9F704 (PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A ___x0, PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A ___y1, const RuntimeMethod* method); // System.Boolean UnityEngine.Audio.AudioClipPlayable::Equals(UnityEngine.Audio.AudioClipPlayable) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool AudioClipPlayable_Equals_m52ECDD49AE6BD8AB4C0AC83C417A0C1B23E3E55E (AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F * __this, AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F ___other0, const RuntimeMethod* method); // UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioMixerPlayable::GetHandle() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A AudioMixerPlayable_GetHandle_m76EFC486A7639C4842F590F544B60988CF27BB17 (AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A * __this, const RuntimeMethod* method); // System.Boolean UnityEngine.Audio.AudioMixerPlayable::Equals(UnityEngine.Audio.AudioMixerPlayable) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool AudioMixerPlayable_Equals_mB55D2602ACCD196F61AF3D1AE90B81930A9AB7E8 (AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A * __this, AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A ___other0, const RuntimeMethod* method); // System.Void UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler::Invoke(UnityEngine.Experimental.Audio.AudioSampleProvider,System.UInt32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void SampleFramesHandler_Invoke_mCB6172CE3EF20C5E12A697A5CE5EEDED9A3B5779 (SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * __this, AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B * ___provider0, uint32_t ___sampleFrameCount1, const RuntimeMethod* method); // System.Void UnityEngine.AudioSettings/AudioConfigurationChangeHandler::Invoke(System.Boolean) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioConfigurationChangeHandler_Invoke_mDC001A19067B6A02B0DE21A4D66FC8D82529F911 (AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * __this, bool ___deviceWasChanged0, const RuntimeMethod* method); #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Void UnityEngine.AudioClip::InvokePCMReaderCallback_Internal(System.Single[]) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioClip_InvokePCMReaderCallback_Internal_m9CB2976CDC2C73A92479F8C11C30B17FAA05751F (AudioClip_t16D2E573E7CC1C5118D8EE0F0692D46866A1C0EE * __this, SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* ___data0, const RuntimeMethod* method) { bool V_0 = false; { PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * L_0 = __this->get_m_PCMReaderCallback_4(); V_0 = (bool)((!(((RuntimeObject*)(PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B *)L_0) <= ((RuntimeObject*)(RuntimeObject *)NULL)))? 1 : 0); bool L_1 = V_0; if (!L_1) { goto IL_001b; } } { PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * L_2 = __this->get_m_PCMReaderCallback_4(); SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* L_3 = ___data0; PCMReaderCallback_Invoke_mE5E7A777A52B9627F9A6A57A140E5C4AAB5A1387(L_2, L_3, /*hidden argument*/NULL); } IL_001b: { return; } } // System.Void UnityEngine.AudioClip::InvokePCMSetPositionCallback_Internal(System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioClip_InvokePCMSetPositionCallback_Internal_m9F3ACF3A244349568C0D0D1D40EE72EF013FB45D (AudioClip_t16D2E573E7CC1C5118D8EE0F0692D46866A1C0EE * __this, int32_t ___position0, const RuntimeMethod* method) { bool V_0 = false; { PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * L_0 = __this->get_m_PCMSetPositionCallback_5(); V_0 = (bool)((!(((RuntimeObject*)(PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C *)L_0) <= ((RuntimeObject*)(RuntimeObject *)NULL)))? 1 : 0); bool L_1 = V_0; if (!L_1) { goto IL_001b; } } { PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * L_2 = __this->get_m_PCMSetPositionCallback_5(); int32_t L_3 = ___position0; PCMSetPositionCallback_Invoke_m1FBFFA5FC15B57601D6D13F4A574F7CAD2A93B7E(L_2, L_3, /*hidden argument*/NULL); } IL_001b: { return; } } #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioClipPlayable::GetHandle() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A AudioClipPlayable_GetHandle_mBEB846B088961170B6DB961951B511C11B98E0B8 (AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F * __this, const RuntimeMethod* method) { PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A V_0; memset((&V_0), 0, sizeof(V_0)); { PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_0 = __this->get_m_Handle_0(); V_0 = L_0; goto IL_000a; } IL_000a: { PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_1 = V_0; return L_1; } } IL2CPP_EXTERN_C PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A AudioClipPlayable_GetHandle_mBEB846B088961170B6DB961951B511C11B98E0B8_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method) { int32_t _offset = 1; AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F * _thisAdjusted = reinterpret_cast<AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F *>(__this + _offset); PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A _returnValue; _returnValue = AudioClipPlayable_GetHandle_mBEB846B088961170B6DB961951B511C11B98E0B8(_thisAdjusted, method); return _returnValue; } // System.Boolean UnityEngine.Audio.AudioClipPlayable::Equals(UnityEngine.Audio.AudioClipPlayable) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool AudioClipPlayable_Equals_m52ECDD49AE6BD8AB4C0AC83C417A0C1B23E3E55E (AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F * __this, AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F ___other0, const RuntimeMethod* method) { static bool s_Il2CppMethodInitialized; if (!s_Il2CppMethodInitialized) { il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A_il2cpp_TypeInfo_var); s_Il2CppMethodInitialized = true; } bool V_0 = false; { PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_0; L_0 = AudioClipPlayable_GetHandle_mBEB846B088961170B6DB961951B511C11B98E0B8((AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F *)__this, /*hidden argument*/NULL); PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_1; L_1 = AudioClipPlayable_GetHandle_mBEB846B088961170B6DB961951B511C11B98E0B8((AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F *)(&___other0), /*hidden argument*/NULL); IL2CPP_RUNTIME_CLASS_INIT(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A_il2cpp_TypeInfo_var); bool L_2; L_2 = PlayableHandle_op_Equality_mFD26CFA8ECF2B622B1A3D4117066CAE965C9F704(L_0, L_1, /*hidden argument*/NULL); V_0 = L_2; goto IL_0016; } IL_0016: { bool L_3 = V_0; return L_3; } } IL2CPP_EXTERN_C bool AudioClipPlayable_Equals_m52ECDD49AE6BD8AB4C0AC83C417A0C1B23E3E55E_AdjustorThunk (RuntimeObject * __this, AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F ___other0, const RuntimeMethod* method) { int32_t _offset = 1; AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F * _thisAdjusted = reinterpret_cast<AudioClipPlayable_t3574B22284CE09FDEAD15BD18D66C4A21D59FA5F *>(__this + _offset); bool _returnValue; _returnValue = AudioClipPlayable_Equals_m52ECDD49AE6BD8AB4C0AC83C417A0C1B23E3E55E(_thisAdjusted, ___other0, method); return _returnValue; } #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioMixerPlayable::GetHandle() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A AudioMixerPlayable_GetHandle_m76EFC486A7639C4842F590F544B60988CF27BB17 (AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A * __this, const RuntimeMethod* method) { PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A V_0; memset((&V_0), 0, sizeof(V_0)); { PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_0 = __this->get_m_Handle_0(); V_0 = L_0; goto IL_000a; } IL_000a: { PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_1 = V_0; return L_1; } } IL2CPP_EXTERN_C PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A AudioMixerPlayable_GetHandle_m76EFC486A7639C4842F590F544B60988CF27BB17_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method) { int32_t _offset = 1; AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A * _thisAdjusted = reinterpret_cast<AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A *>(__this + _offset); PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A _returnValue; _returnValue = AudioMixerPlayable_GetHandle_m76EFC486A7639C4842F590F544B60988CF27BB17(_thisAdjusted, method); return _returnValue; } // System.Boolean UnityEngine.Audio.AudioMixerPlayable::Equals(UnityEngine.Audio.AudioMixerPlayable) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool AudioMixerPlayable_Equals_mB55D2602ACCD196F61AF3D1AE90B81930A9AB7E8 (AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A * __this, AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A ___other0, const RuntimeMethod* method) { static bool s_Il2CppMethodInitialized; if (!s_Il2CppMethodInitialized) { il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A_il2cpp_TypeInfo_var); s_Il2CppMethodInitialized = true; } bool V_0 = false; { PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_0; L_0 = AudioMixerPlayable_GetHandle_m76EFC486A7639C4842F590F544B60988CF27BB17((AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A *)__this, /*hidden argument*/NULL); PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A L_1; L_1 = AudioMixerPlayable_GetHandle_m76EFC486A7639C4842F590F544B60988CF27BB17((AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A *)(&___other0), /*hidden argument*/NULL); IL2CPP_RUNTIME_CLASS_INIT(PlayableHandle_t50DCD240B0400DDAD0822C13E5DBC7AD64DC027A_il2cpp_TypeInfo_var); bool L_2; L_2 = PlayableHandle_op_Equality_mFD26CFA8ECF2B622B1A3D4117066CAE965C9F704(L_0, L_1, /*hidden argument*/NULL); V_0 = L_2; goto IL_0016; } IL_0016: { bool L_3 = V_0; return L_3; } } IL2CPP_EXTERN_C bool AudioMixerPlayable_Equals_mB55D2602ACCD196F61AF3D1AE90B81930A9AB7E8_AdjustorThunk (RuntimeObject * __this, AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A ___other0, const RuntimeMethod* method) { int32_t _offset = 1; AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A * _thisAdjusted = reinterpret_cast<AudioMixerPlayable_t80531461F1E238E237D7BB2BAE7E031ABDE95C4A *>(__this + _offset); bool _returnValue; _returnValue = AudioMixerPlayable_Equals_mB55D2602ACCD196F61AF3D1AE90B81930A9AB7E8(_thisAdjusted, ___other0, method); return _returnValue; } #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Void UnityEngine.Experimental.Audio.AudioSampleProvider::InvokeSampleFramesAvailable(System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioSampleProvider_InvokeSampleFramesAvailable_mE6689CFA13C0621F305F389FEEE4D543B71BF236 (AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B * __this, int32_t ___sampleFrameCount0, const RuntimeMethod* method) { bool V_0 = false; { SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * L_0 = __this->get_sampleFramesAvailable_0(); V_0 = (bool)((!(((RuntimeObject*)(SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 *)L_0) <= ((RuntimeObject*)(RuntimeObject *)NULL)))? 1 : 0); bool L_1 = V_0; if (!L_1) { goto IL_001c; } } { SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * L_2 = __this->get_sampleFramesAvailable_0(); int32_t L_3 = ___sampleFrameCount0; SampleFramesHandler_Invoke_mCB6172CE3EF20C5E12A697A5CE5EEDED9A3B5779(L_2, __this, L_3, /*hidden argument*/NULL); } IL_001c: { return; } } // System.Void UnityEngine.Experimental.Audio.AudioSampleProvider::InvokeSampleFramesOverflow(System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioSampleProvider_InvokeSampleFramesOverflow_m998BEADD2A2B4BEF0906A31108B6DC486411CC78 (AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B * __this, int32_t ___droppedSampleFrameCount0, const RuntimeMethod* method) { bool V_0 = false; { SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * L_0 = __this->get_sampleFramesOverflow_1(); V_0 = (bool)((!(((RuntimeObject*)(SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 *)L_0) <= ((RuntimeObject*)(RuntimeObject *)NULL)))? 1 : 0); bool L_1 = V_0; if (!L_1) { goto IL_001c; } } { SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * L_2 = __this->get_sampleFramesOverflow_1(); int32_t L_3 = ___droppedSampleFrameCount0; SampleFramesHandler_Invoke_mCB6172CE3EF20C5E12A697A5CE5EEDED9A3B5779(L_2, __this, L_3, /*hidden argument*/NULL); } IL_001c: { return; } } #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Void UnityEngine.AudioSettings::InvokeOnAudioConfigurationChanged(System.Boolean) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioSettings_InvokeOnAudioConfigurationChanged_m2CBD1FC39E7AE46E07E777990310D1DC40FB980E (bool ___deviceWasChanged0, const RuntimeMethod* method) { static bool s_Il2CppMethodInitialized; if (!s_Il2CppMethodInitialized) { il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_il2cpp_TypeInfo_var); s_Il2CppMethodInitialized = true; } bool V_0 = false; { AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * L_0 = ((AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_StaticFields*)il2cpp_codegen_static_fields_for(AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_il2cpp_TypeInfo_var))->get_OnAudioConfigurationChanged_0(); V_0 = (bool)((!(((RuntimeObject*)(AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A *)L_0) <= ((RuntimeObject*)(RuntimeObject *)NULL)))? 1 : 0); bool L_1 = V_0; if (!L_1) { goto IL_0019; } } { AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * L_2 = ((AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_StaticFields*)il2cpp_codegen_static_fields_for(AudioSettings_t1941E7DE9FEF65F7742713EB862D3025244FCB08_il2cpp_TypeInfo_var))->get_OnAudioConfigurationChanged_0(); bool L_3 = ___deviceWasChanged0; AudioConfigurationChangeHandler_Invoke_mDC001A19067B6A02B0DE21A4D66FC8D82529F911(L_2, L_3, /*hidden argument*/NULL); } IL_0019: { return; } } #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif IL2CPP_EXTERN_C void DelegatePInvokeWrapper_PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B (PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * __this, SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* ___data0, const RuntimeMethod* method) { typedef void (DEFAULT_CALL *PInvokeFunc)(float*); PInvokeFunc il2cppPInvokeFunc = reinterpret_cast<PInvokeFunc>(((RuntimeDelegate*)__this)->method->nativeFunction); // Marshaling of parameter '___data0' to native representation float* ____data0_marshaled = NULL; if (___data0 != NULL) { ____data0_marshaled = reinterpret_cast<float*>((___data0)->GetAddressAtUnchecked(0)); } // Native function invocation il2cppPInvokeFunc(____data0_marshaled); } // System.Void UnityEngine.AudioClip/PCMReaderCallback::.ctor(System.Object,System.IntPtr) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PCMReaderCallback__ctor_mCA9CC5271DE0E4083B85759CA74EED1C1CD219F7 (PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * __this, RuntimeObject * ___object0, intptr_t ___method1, const RuntimeMethod* method) { __this->set_method_ptr_0(il2cpp_codegen_get_method_pointer((RuntimeMethod*)___method1)); __this->set_method_3(___method1); __this->set_m_target_2(___object0); } // System.Void UnityEngine.AudioClip/PCMReaderCallback::Invoke(System.Single[]) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PCMReaderCallback_Invoke_mE5E7A777A52B9627F9A6A57A140E5C4AAB5A1387 (PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * __this, SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* ___data0, const RuntimeMethod* method) { DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8* delegateArrayToInvoke = __this->get_delegates_11(); Delegate_t** delegatesToInvoke; il2cpp_array_size_t length; if (delegateArrayToInvoke != NULL) { length = delegateArrayToInvoke->max_length; delegatesToInvoke = reinterpret_cast<Delegate_t**>(delegateArrayToInvoke->GetAddressAtUnchecked(0)); } else { length = 1; delegatesToInvoke = reinterpret_cast<Delegate_t**>(&__this); } for (il2cpp_array_size_t i = 0; i < length; i++) { Delegate_t* currentDelegate = delegatesToInvoke[i]; Il2CppMethodPointer targetMethodPointer = currentDelegate->get_method_ptr_0(); RuntimeObject* targetThis = currentDelegate->get_m_target_2(); RuntimeMethod* targetMethod = (RuntimeMethod*)(currentDelegate->get_method_3()); if (!il2cpp_codegen_method_is_virtual(targetMethod)) { il2cpp_codegen_raise_execution_engine_exception_if_method_is_not_found(targetMethod); } bool ___methodIsStatic = MethodIsStatic(targetMethod); int ___parameterCount = il2cpp_codegen_method_parameter_count(targetMethod); if (___methodIsStatic) { if (___parameterCount == 1) { // open typedef void (*FunctionPointerType) (SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA*, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(___data0, targetMethod); } else { // closed typedef void (*FunctionPointerType) (void*, SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA*, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(targetThis, ___data0, targetMethod); } } else if (___parameterCount != 1) { // open if (il2cpp_codegen_method_is_virtual(targetMethod) && il2cpp_codegen_delegate_has_invoker((Il2CppDelegate*)__this)) { if (il2cpp_codegen_method_is_generic_instance(targetMethod)) { if (il2cpp_codegen_method_is_interface_method(targetMethod)) GenericInterfaceActionInvoker0::Invoke(targetMethod, ___data0); else GenericVirtActionInvoker0::Invoke(targetMethod, ___data0); } else { if (il2cpp_codegen_method_is_interface_method(targetMethod)) InterfaceActionInvoker0::Invoke(il2cpp_codegen_method_get_slot(targetMethod), il2cpp_codegen_method_get_declaring_type(targetMethod), ___data0); else VirtActionInvoker0::Invoke(il2cpp_codegen_method_get_slot(targetMethod), ___data0); } } else { typedef void (*FunctionPointerType) (SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA*, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(___data0, targetMethod); } } else { // closed if (targetThis != NULL && il2cpp_codegen_method_is_virtual(targetMethod) && !il2cpp_codegen_object_is_of_sealed_type(targetThis) && il2cpp_codegen_delegate_has_invoker((Il2CppDelegate*)__this)) { if (il2cpp_codegen_method_is_generic_instance(targetMethod)) { if (il2cpp_codegen_method_is_interface_method(targetMethod)) GenericInterfaceActionInvoker1< SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* >::Invoke(targetMethod, targetThis, ___data0); else GenericVirtActionInvoker1< SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* >::Invoke(targetMethod, targetThis, ___data0); } else { if (il2cpp_codegen_method_is_interface_method(targetMethod)) InterfaceActionInvoker1< SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), il2cpp_codegen_method_get_declaring_type(targetMethod), targetThis, ___data0); else VirtActionInvoker1< SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), targetThis, ___data0); } } else { if (targetThis == NULL) { typedef void (*FunctionPointerType) (SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA*, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(___data0, targetMethod); } else { typedef void (*FunctionPointerType) (void*, SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA*, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(targetThis, ___data0, targetMethod); } } } } } // System.IAsyncResult UnityEngine.AudioClip/PCMReaderCallback::BeginInvoke(System.Single[],System.AsyncCallback,System.Object) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RuntimeObject* PCMReaderCallback_BeginInvoke_mA4B5DF478312B7B7A00E13D869DF0AD4E01795A9 (PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * __this, SingleU5BU5D_t47E8DBF5B597C122478D1FFBD9DD57399A0650FA* ___data0, AsyncCallback_tA7921BEF974919C46FF8F9D9867C567B200BB0EA * ___callback1, RuntimeObject * ___object2, const RuntimeMethod* method) { void *__d_args[2] = {0}; __d_args[0] = ___data0; return (RuntimeObject*)il2cpp_codegen_delegate_begin_invoke((RuntimeDelegate*)__this, __d_args, (RuntimeDelegate*)___callback1, (RuntimeObject*)___object2);; } // System.Void UnityEngine.AudioClip/PCMReaderCallback::EndInvoke(System.IAsyncResult) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PCMReaderCallback_EndInvoke_m79DD97AB2919A10EBC91F78331213523EA5494DE (PCMReaderCallback_t9CA1437D36509A9FAC5EDD8FF2BC3259C24D0E0B * __this, RuntimeObject* ___result0, const RuntimeMethod* method) { il2cpp_codegen_delegate_end_invoke((Il2CppAsyncResult*) ___result0, 0); } #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif IL2CPP_EXTERN_C void DelegatePInvokeWrapper_PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C (PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * __this, int32_t ___position0, const RuntimeMethod* method) { typedef void (DEFAULT_CALL *PInvokeFunc)(int32_t); PInvokeFunc il2cppPInvokeFunc = reinterpret_cast<PInvokeFunc>(((RuntimeDelegate*)__this)->method->nativeFunction); // Native function invocation il2cppPInvokeFunc(___position0); } // System.Void UnityEngine.AudioClip/PCMSetPositionCallback::.ctor(System.Object,System.IntPtr) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PCMSetPositionCallback__ctor_m0204C8557D7FB9E95F33168EDFD64182D9342002 (PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * __this, RuntimeObject * ___object0, intptr_t ___method1, const RuntimeMethod* method) { __this->set_method_ptr_0(il2cpp_codegen_get_method_pointer((RuntimeMethod*)___method1)); __this->set_method_3(___method1); __this->set_m_target_2(___object0); } // System.Void UnityEngine.AudioClip/PCMSetPositionCallback::Invoke(System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PCMSetPositionCallback_Invoke_m1FBFFA5FC15B57601D6D13F4A574F7CAD2A93B7E (PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * __this, int32_t ___position0, const RuntimeMethod* method) { DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8* delegateArrayToInvoke = __this->get_delegates_11(); Delegate_t** delegatesToInvoke; il2cpp_array_size_t length; if (delegateArrayToInvoke != NULL) { length = delegateArrayToInvoke->max_length; delegatesToInvoke = reinterpret_cast<Delegate_t**>(delegateArrayToInvoke->GetAddressAtUnchecked(0)); } else { length = 1; delegatesToInvoke = reinterpret_cast<Delegate_t**>(&__this); } for (il2cpp_array_size_t i = 0; i < length; i++) { Delegate_t* currentDelegate = delegatesToInvoke[i]; Il2CppMethodPointer targetMethodPointer = currentDelegate->get_method_ptr_0(); RuntimeObject* targetThis = currentDelegate->get_m_target_2(); RuntimeMethod* targetMethod = (RuntimeMethod*)(currentDelegate->get_method_3()); if (!il2cpp_codegen_method_is_virtual(targetMethod)) { il2cpp_codegen_raise_execution_engine_exception_if_method_is_not_found(targetMethod); } bool ___methodIsStatic = MethodIsStatic(targetMethod); int ___parameterCount = il2cpp_codegen_method_parameter_count(targetMethod); if (___methodIsStatic) { if (___parameterCount == 1) { // open typedef void (*FunctionPointerType) (int32_t, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(___position0, targetMethod); } else { // closed typedef void (*FunctionPointerType) (void*, int32_t, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(targetThis, ___position0, targetMethod); } } else { // closed if (targetThis != NULL && il2cpp_codegen_method_is_virtual(targetMethod) && !il2cpp_codegen_object_is_of_sealed_type(targetThis) && il2cpp_codegen_delegate_has_invoker((Il2CppDelegate*)__this)) { if (il2cpp_codegen_method_is_generic_instance(targetMethod)) { if (il2cpp_codegen_method_is_interface_method(targetMethod)) GenericInterfaceActionInvoker1< int32_t >::Invoke(targetMethod, targetThis, ___position0); else GenericVirtActionInvoker1< int32_t >::Invoke(targetMethod, targetThis, ___position0); } else { if (il2cpp_codegen_method_is_interface_method(targetMethod)) InterfaceActionInvoker1< int32_t >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), il2cpp_codegen_method_get_declaring_type(targetMethod), targetThis, ___position0); else VirtActionInvoker1< int32_t >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), targetThis, ___position0); } } else { typedef void (*FunctionPointerType) (void*, int32_t, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(targetThis, ___position0, targetMethod); } } } } // System.IAsyncResult UnityEngine.AudioClip/PCMSetPositionCallback::BeginInvoke(System.Int32,System.AsyncCallback,System.Object) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RuntimeObject* PCMSetPositionCallback_BeginInvoke_mF8CA8E07FDAF6B0821D2F1AE8F8545DC0FADC3A3 (PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * __this, int32_t ___position0, AsyncCallback_tA7921BEF974919C46FF8F9D9867C567B200BB0EA * ___callback1, RuntimeObject * ___object2, const RuntimeMethod* method) { static bool s_Il2CppMethodInitialized; if (!s_Il2CppMethodInitialized) { il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046_il2cpp_TypeInfo_var); s_Il2CppMethodInitialized = true; } void *__d_args[2] = {0}; __d_args[0] = Box(Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046_il2cpp_TypeInfo_var, &___position0); return (RuntimeObject*)il2cpp_codegen_delegate_begin_invoke((RuntimeDelegate*)__this, __d_args, (RuntimeDelegate*)___callback1, (RuntimeObject*)___object2);; } // System.Void UnityEngine.AudioClip/PCMSetPositionCallback::EndInvoke(System.IAsyncResult) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PCMSetPositionCallback_EndInvoke_m7096B994374E95A90C84B87625494BE1076B8574 (PCMSetPositionCallback_tBDD99E7C0697687F1E7B06CDD5DE444A3709CF4C * __this, RuntimeObject* ___result0, const RuntimeMethod* method) { il2cpp_codegen_delegate_end_invoke((Il2CppAsyncResult*) ___result0, 0); } #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Void UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler::.ctor(System.Object,System.IntPtr) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void SampleFramesHandler__ctor_m389B32B949592BFD1BA53D0C0983CA6B5BA6AAC7 (SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * __this, RuntimeObject * ___object0, intptr_t ___method1, const RuntimeMethod* method) { __this->set_method_ptr_0(il2cpp_codegen_get_method_pointer((RuntimeMethod*)___method1)); __this->set_method_3(___method1); __this->set_m_target_2(___object0); } // System.Void UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler::Invoke(UnityEngine.Experimental.Audio.AudioSampleProvider,System.UInt32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void SampleFramesHandler_Invoke_mCB6172CE3EF20C5E12A697A5CE5EEDED9A3B5779 (SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * __this, AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B * ___provider0, uint32_t ___sampleFrameCount1, const RuntimeMethod* method) { DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8* delegateArrayToInvoke = __this->get_delegates_11(); Delegate_t** delegatesToInvoke; il2cpp_array_size_t length; if (delegateArrayToInvoke != NULL) { length = delegateArrayToInvoke->max_length; delegatesToInvoke = reinterpret_cast<Delegate_t**>(delegateArrayToInvoke->GetAddressAtUnchecked(0)); } else { length = 1; delegatesToInvoke = reinterpret_cast<Delegate_t**>(&__this); } for (il2cpp_array_size_t i = 0; i < length; i++) { Delegate_t* currentDelegate = delegatesToInvoke[i]; Il2CppMethodPointer targetMethodPointer = currentDelegate->get_method_ptr_0(); RuntimeObject* targetThis = currentDelegate->get_m_target_2(); RuntimeMethod* targetMethod = (RuntimeMethod*)(currentDelegate->get_method_3()); if (!il2cpp_codegen_method_is_virtual(targetMethod)) { il2cpp_codegen_raise_execution_engine_exception_if_method_is_not_found(targetMethod); } bool ___methodIsStatic = MethodIsStatic(targetMethod); int ___parameterCount = il2cpp_codegen_method_parameter_count(targetMethod); if (___methodIsStatic) { if (___parameterCount == 2) { // open typedef void (*FunctionPointerType) (AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B *, uint32_t, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(___provider0, ___sampleFrameCount1, targetMethod); } else { // closed typedef void (*FunctionPointerType) (void*, AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B *, uint32_t, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(targetThis, ___provider0, ___sampleFrameCount1, targetMethod); } } else if (___parameterCount != 2) { // open if (il2cpp_codegen_method_is_virtual(targetMethod) && il2cpp_codegen_delegate_has_invoker((Il2CppDelegate*)__this)) { if (il2cpp_codegen_method_is_generic_instance(targetMethod)) { if (il2cpp_codegen_method_is_interface_method(targetMethod)) GenericInterfaceActionInvoker1< uint32_t >::Invoke(targetMethod, ___provider0, ___sampleFrameCount1); else GenericVirtActionInvoker1< uint32_t >::Invoke(targetMethod, ___provider0, ___sampleFrameCount1); } else { if (il2cpp_codegen_method_is_interface_method(targetMethod)) InterfaceActionInvoker1< uint32_t >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), il2cpp_codegen_method_get_declaring_type(targetMethod), ___provider0, ___sampleFrameCount1); else VirtActionInvoker1< uint32_t >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), ___provider0, ___sampleFrameCount1); } } else { typedef void (*FunctionPointerType) (AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B *, uint32_t, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(___provider0, ___sampleFrameCount1, targetMethod); } } else { // closed if (targetThis != NULL && il2cpp_codegen_method_is_virtual(targetMethod) && !il2cpp_codegen_object_is_of_sealed_type(targetThis) && il2cpp_codegen_delegate_has_invoker((Il2CppDelegate*)__this)) { if (il2cpp_codegen_method_is_generic_instance(targetMethod)) { if (il2cpp_codegen_method_is_interface_method(targetMethod)) GenericInterfaceActionInvoker2< AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B *, uint32_t >::Invoke(targetMethod, targetThis, ___provider0, ___sampleFrameCount1); else GenericVirtActionInvoker2< AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B *, uint32_t >::Invoke(targetMethod, targetThis, ___provider0, ___sampleFrameCount1); } else { if (il2cpp_codegen_method_is_interface_method(targetMethod)) InterfaceActionInvoker2< AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B *, uint32_t >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), il2cpp_codegen_method_get_declaring_type(targetMethod), targetThis, ___provider0, ___sampleFrameCount1); else VirtActionInvoker2< AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B *, uint32_t >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), targetThis, ___provider0, ___sampleFrameCount1); } } else { if (targetThis == NULL) { typedef void (*FunctionPointerType) (AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B *, uint32_t, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(___provider0, ___sampleFrameCount1, targetMethod); } else { typedef void (*FunctionPointerType) (void*, AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B *, uint32_t, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(targetThis, ___provider0, ___sampleFrameCount1, targetMethod); } } } } } // System.IAsyncResult UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler::BeginInvoke(UnityEngine.Experimental.Audio.AudioSampleProvider,System.UInt32,System.AsyncCallback,System.Object) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RuntimeObject* SampleFramesHandler_BeginInvoke_m79D52B9AB6F6E72A9A9260F6608F7FA9F6A10ADC (SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * __this, AudioSampleProvider_tD8B613D55D09D6CE86B851A5D8F33560FFCC705B * ___provider0, uint32_t ___sampleFrameCount1, AsyncCallback_tA7921BEF974919C46FF8F9D9867C567B200BB0EA * ___callback2, RuntimeObject * ___object3, const RuntimeMethod* method) { static bool s_Il2CppMethodInitialized; if (!s_Il2CppMethodInitialized) { il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&UInt32_tE60352A06233E4E69DD198BCC67142159F686B15_il2cpp_TypeInfo_var); s_Il2CppMethodInitialized = true; } void *__d_args[3] = {0}; __d_args[0] = ___provider0; __d_args[1] = Box(UInt32_tE60352A06233E4E69DD198BCC67142159F686B15_il2cpp_TypeInfo_var, &___sampleFrameCount1); return (RuntimeObject*)il2cpp_codegen_delegate_begin_invoke((RuntimeDelegate*)__this, __d_args, (RuntimeDelegate*)___callback2, (RuntimeObject*)___object3);; } // System.Void UnityEngine.Experimental.Audio.AudioSampleProvider/SampleFramesHandler::EndInvoke(System.IAsyncResult) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void SampleFramesHandler_EndInvoke_mC5357233A55B232AC8507FA4A04E06271EDE0309 (SampleFramesHandler_tCF0215103F7BD1AD5397731D86079D6E68AC9487 * __this, RuntimeObject* ___result0, const RuntimeMethod* method) { il2cpp_codegen_delegate_end_invoke((Il2CppAsyncResult*) ___result0, 0); } #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif IL2CPP_EXTERN_C void DelegatePInvokeWrapper_AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A (AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * __this, bool ___deviceWasChanged0, const RuntimeMethod* method) { typedef void (DEFAULT_CALL *PInvokeFunc)(int32_t); PInvokeFunc il2cppPInvokeFunc = reinterpret_cast<PInvokeFunc>(((RuntimeDelegate*)__this)->method->nativeFunction); // Native function invocation il2cppPInvokeFunc(static_cast<int32_t>(___deviceWasChanged0)); } // System.Void UnityEngine.AudioSettings/AudioConfigurationChangeHandler::.ctor(System.Object,System.IntPtr) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioConfigurationChangeHandler__ctor_mB63AFBABA4712DF64F06A65CC7CE3C9E8C58080B (AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * __this, RuntimeObject * ___object0, intptr_t ___method1, const RuntimeMethod* method) { __this->set_method_ptr_0(il2cpp_codegen_get_method_pointer((RuntimeMethod*)___method1)); __this->set_method_3(___method1); __this->set_m_target_2(___object0); } // System.Void UnityEngine.AudioSettings/AudioConfigurationChangeHandler::Invoke(System.Boolean) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioConfigurationChangeHandler_Invoke_mDC001A19067B6A02B0DE21A4D66FC8D82529F911 (AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * __this, bool ___deviceWasChanged0, const RuntimeMethod* method) { DelegateU5BU5D_t677D8FE08A5F99E8EE49150B73966CD6E9BF7DB8* delegateArrayToInvoke = __this->get_delegates_11(); Delegate_t** delegatesToInvoke; il2cpp_array_size_t length; if (delegateArrayToInvoke != NULL) { length = delegateArrayToInvoke->max_length; delegatesToInvoke = reinterpret_cast<Delegate_t**>(delegateArrayToInvoke->GetAddressAtUnchecked(0)); } else { length = 1; delegatesToInvoke = reinterpret_cast<Delegate_t**>(&__this); } for (il2cpp_array_size_t i = 0; i < length; i++) { Delegate_t* currentDelegate = delegatesToInvoke[i]; Il2CppMethodPointer targetMethodPointer = currentDelegate->get_method_ptr_0(); RuntimeObject* targetThis = currentDelegate->get_m_target_2(); RuntimeMethod* targetMethod = (RuntimeMethod*)(currentDelegate->get_method_3()); if (!il2cpp_codegen_method_is_virtual(targetMethod)) { il2cpp_codegen_raise_execution_engine_exception_if_method_is_not_found(targetMethod); } bool ___methodIsStatic = MethodIsStatic(targetMethod); int ___parameterCount = il2cpp_codegen_method_parameter_count(targetMethod); if (___methodIsStatic) { if (___parameterCount == 1) { // open typedef void (*FunctionPointerType) (bool, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(___deviceWasChanged0, targetMethod); } else { // closed typedef void (*FunctionPointerType) (void*, bool, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(targetThis, ___deviceWasChanged0, targetMethod); } } else { // closed if (targetThis != NULL && il2cpp_codegen_method_is_virtual(targetMethod) && !il2cpp_codegen_object_is_of_sealed_type(targetThis) && il2cpp_codegen_delegate_has_invoker((Il2CppDelegate*)__this)) { if (il2cpp_codegen_method_is_generic_instance(targetMethod)) { if (il2cpp_codegen_method_is_interface_method(targetMethod)) GenericInterfaceActionInvoker1< bool >::Invoke(targetMethod, targetThis, ___deviceWasChanged0); else GenericVirtActionInvoker1< bool >::Invoke(targetMethod, targetThis, ___deviceWasChanged0); } else { if (il2cpp_codegen_method_is_interface_method(targetMethod)) InterfaceActionInvoker1< bool >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), il2cpp_codegen_method_get_declaring_type(targetMethod), targetThis, ___deviceWasChanged0); else VirtActionInvoker1< bool >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), targetThis, ___deviceWasChanged0); } } else { typedef void (*FunctionPointerType) (void*, bool, const RuntimeMethod*); ((FunctionPointerType)targetMethodPointer)(targetThis, ___deviceWasChanged0, targetMethod); } } } } // System.IAsyncResult UnityEngine.AudioSettings/AudioConfigurationChangeHandler::BeginInvoke(System.Boolean,System.AsyncCallback,System.Object) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RuntimeObject* AudioConfigurationChangeHandler_BeginInvoke_m2F17366BD1D34B7BB9FC60C1EF34EDC074D0003B (AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * __this, bool ___deviceWasChanged0, AsyncCallback_tA7921BEF974919C46FF8F9D9867C567B200BB0EA * ___callback1, RuntimeObject * ___object2, const RuntimeMethod* method) { static bool s_Il2CppMethodInitialized; if (!s_Il2CppMethodInitialized) { il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_il2cpp_TypeInfo_var); s_Il2CppMethodInitialized = true; } void *__d_args[2] = {0}; __d_args[0] = Box(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_il2cpp_TypeInfo_var, &___deviceWasChanged0); return (RuntimeObject*)il2cpp_codegen_delegate_begin_invoke((RuntimeDelegate*)__this, __d_args, (RuntimeDelegate*)___callback1, (RuntimeObject*)___object2);; } // System.Void UnityEngine.AudioSettings/AudioConfigurationChangeHandler::EndInvoke(System.IAsyncResult) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AudioConfigurationChangeHandler_EndInvoke_m78A4BB19DA6FBEACEC4F57A51D8076A337E02F4C (AudioConfigurationChangeHandler_t1A997C51DF7B553A94DAD358F8D968308994774A * __this, RuntimeObject* ___result0, const RuntimeMethod* method) { il2cpp_codegen_delegate_end_invoke((Il2CppAsyncResult*) ___result0, 0); } #ifdef __clang__ #pragma clang diagnostic pop #endif
[ "personalusage123@gmail.com" ]
personalusage123@gmail.com
e9a65102ec6843c60fd934dafb73c6c6f0337401
42c9fc81ffbdb22bfde3976578337a1fe5f17c2a
/transform/DepthEstimate/pnp/dense_mono/build_depth.h
fafd19da72029519c7cd422f041ac379a4060d06
[ "MIT" ]
permissive
LiuFG/UpdatingHDmapByMonoCamera
988524461287bfa8b663cba756a787e4440268ef
dc8f06795a12669da1a8096e38851f78b2e26a62
refs/heads/master
2022-06-01T08:33:53.034821
2020-04-26T05:32:38
2020-04-26T05:32:38
258,131,871
0
0
MIT
2020-04-26T05:32:43
2020-04-23T07:49:14
Python
UTF-8
C++
false
false
11,714
h
/* Author: Joey. Created Date: 7/30/2019. Modified Date: 8/1/2019. Description: This is a class to be constructed from: 1. ref 目标frame(要做深度估计的) 2. currs 相邻frames(分别与目标frame形成对以估计深度) 3. pose_ref 目标frame的位资 4. poses_curr 相邻frames对应的位资 5. points_target 目标区域的像素点坐标 Then it can compute the depth of the target frame(ref) by using its internal method: build_depthMap. */ #ifndef __DepthMapping_H__ #define __DepthMapping_H__ #include <iostream> #include <vector> #include <fstream> #include <sstream> using namespace std; #include <boost/timer.hpp> // for sophus #include <sophus/se3.h> using Sophus::SE3; // for eigen #include <Eigen/Core> #include <Eigen/Geometry> using namespace Eigen; #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> using namespace cv; #include "consts.h" class DepthMapping { private: vector<Point_label> points_target; //target region points Mat ref; //ref image SE3 pose_ref_TWC; //ref_pose vector<Mat> currs; //curr images vector<Pose_id> poses_curr_TWC; //curr poses public: // CONSTRUCTOR DepthMapping(Mat& ref, SE3& pose_ref, vector<Mat>& currs, vector<Pose_id>& poses_curr, vector<Point_label> points) { this->ref = ref; this->pose_ref_TWC = pose_ref; this->currs = currs; this->poses_curr_TWC = poses_curr; this->points_target = points; cout << "neighbors size: " << currs.size() << endl; } // main method bool build_depthMap(Mat& depth, Mat& depth_cov) { for (int ind = 0; ind < currs.size(); ind++) { cout << " *** loop " << ind << " *** " << endl; Mat& curr = currs[ind]; if (curr.data == nullptr) continue; SE3 pose_curr_TWC = poses_curr_TWC[ind].tf; SE3 pose_T_C_R = pose_curr_TWC.inverse() * pose_ref_TWC; update( ref, curr, pose_T_C_R, depth, depth_cov ); plotDepth( depth ); //updata depth picture imshow("image", curr); waitKey(1); } return true; } // 对整个深度图进行更新 bool update(const Mat& ref, const Mat& curr, const SE3& T_C_R, Mat& depth, Mat& depth_cov ){ int match_count = 0, converge_count = 0, diverge_count = 0; int total = (width - boarder) * (height - boarder); for (Point_label p : points_target) { int x = p.x; int y = p.y; // 遍历每个像素 if ( depth_cov.ptr<double>(y)[x] < min_cov) { // 深度已收敛 converge_count++; continue; } if ( depth_cov.ptr<double>(y)[x] > max_cov) { // 深度已发散 diverge_count++; continue; } // 在极线上搜索 (x,y) 的匹配 Vector2d pt_curr; bool ret = epipolarSearch ( ref, curr, T_C_R, Vector2d(x,y), depth.ptr<double>(y)[x], sqrt(depth_cov.ptr<double>(y)[x]),pt_curr); if ( ret == false ) { // 匹配失败 continue; } // 取消该注释以显示匹配 match_count++; // showEpipolarMatch( ref, curr, Vector2d(x,y), pt_curr ); // 匹配成功,更新深度图 updateDepthFilter( Vector2d(x,y), pt_curr, T_C_R, depth, depth_cov ); } cout << "match_count: " << match_count << endl; printf("found %.2f%% matches! ", (float)match_count / total * 100); printf("%.2f%% already converged! ", (float)converge_count / total * 100); printf("%.2f%% already diverged! \n", (float)diverge_count / total * 100); } // 极线搜索 bool epipolarSearch(const Mat& ref, const Mat& curr, const SE3& T_C_R, const Vector2d& pt_ref, const double& depth_mu, const double& depth_cov, Vector2d& pt_curr ) { Vector3d f_ref = px2cam( pt_ref ); f_ref.normalize(); //归一化到深度为1的平面 Vector3d P_ref = f_ref*depth_mu; // 参考帧的 P 向量 Vector2d px_mean_curr = cam2px( T_C_R*P_ref ); // 按深度均值投影的像素 double d_min = depth_mu-3*depth_cov, d_max = depth_mu+3*depth_cov; if ( d_min<0.1 ) d_min = 0.1; Vector2d px_min_curr = cam2px( T_C_R*(f_ref*d_min) ); // 按最小深度投影的像素 Vector2d px_max_curr = cam2px( T_C_R*(f_ref*d_max) ); // 按最大深度投影的像素 Vector2d epipolar_line = px_max_curr - px_min_curr; // 极线(线段形式) Vector2d epipolar_direction = epipolar_line; // 极线方向 epipolar_direction.normalize(); double half_length = 0.5*epipolar_line.norm(); // 极线线段的半长度 if ( half_length>100 ) half_length = 100; // 我们不希望搜索太多东西 // 取消此句注释以显示极线(线段) // showEpipolarLine( ref, curr, pt_ref, px_min_curr, px_max_curr ); // 在极线上搜索,以深度均值点为中心,左右各取半长度 double best_ncc = -1.0; Vector2d best_px_curr; for ( double l=-half_length; l<=half_length; l+=0.7 ) // l+=sqrt(2) { Vector2d px_curr = px_mean_curr + l*epipolar_direction; // 待匹配点 if ( !inside(px_curr) ) continue; // 计算待匹配点与参考帧的 NCC double ncc = NCC( ref, curr, pt_ref, px_curr ); if ( ncc>best_ncc ) { best_ncc = ncc; best_px_curr = px_curr; } } if ( best_ncc < 0.85f ) // 只相信 NCC 很高的匹配 return false; pt_curr = best_px_curr; //got the matched px_curr return true; } //helper function for epipolar search: computing ncc double NCC (const Mat& ref, const Mat& curr, const Vector2d& pt_ref, const Vector2d& pt_curr) { // 零均值-归一化互相关 // 先算均值 double mean_ref = 0, mean_curr = 0; vector<double> values_ref, values_curr; // 参考帧和当前帧的均值 for ( int x=-ncc_window_size; x<=ncc_window_size; x++ ) for ( int y=-ncc_window_size; y<=ncc_window_size; y++ ) { double value_ref = double(ref.ptr<uchar>( int(y+pt_ref(1,0)) )[ int(x+pt_ref(0,0)) ])/255.0; mean_ref += value_ref; double value_curr = getBilinearInterpolatedValue( curr, pt_curr+Vector2d(x,y) ); //macth到的curr上的点不一定是integer mean_curr += value_curr; values_ref.push_back(value_ref); values_curr.push_back(value_curr); } mean_ref /= ncc_area; mean_curr /= ncc_area; // 计算 Zero mean NCC (去均值化的) double numerator = 0, demoniator1 = 0, demoniator2 = 0; for ( int i=0; i<values_ref.size(); i++ ) { double n = (values_ref[i]-mean_ref) * (values_curr[i]-mean_curr); numerator += n; demoniator1 += (values_ref[i]-mean_ref)*(values_ref[i]-mean_ref); demoniator2 += (values_curr[i]-mean_curr)*(values_curr[i]-mean_curr); } return numerator / sqrt( demoniator1*demoniator2+1e-10 ); // 防止分母出现零 } // helper function for NCC: 双线性灰度插值 inline double getBilinearInterpolatedValue( const Mat& img, const Vector2d& pt ) { uchar* d = & img.data[ int(pt(1,0))*img.step+int(pt(0,0)) ]; double xx = pt(0,0) - floor(pt(0,0)); double yy = pt(1,0) - floor(pt(1,0)); return (( 1-xx ) * ( 1-yy ) * double(d[0]) + xx* ( 1-yy ) * double(d[1]) + ( 1-xx ) *yy* double(d[img.step]) + xx*yy*double(d[img.step+1]))/255.0; } //helper function for update: 三角化测量 + 高斯融合 bool updateDepthFilter(const Vector2d& pt_ref, const Vector2d& pt_curr, const SE3& T_C_R, Mat& depth, Mat& depth_cov) { // 用三角化计算深度 SE3 T_R_C = T_C_R.inverse(); Vector3d f_ref = px2cam( pt_ref ); f_ref.normalize(); Vector3d f_curr = px2cam( pt_curr ); f_curr.normalize(); // 方程 // d_ref * f_ref = d_cur * ( R_RC * f_cur ) + t_RC // => [ f_ref^T f_ref, -f_ref^T f_cur ] [d_ref] = [f_ref^T t] // [ f_cur^T f_ref, -f_cur^T f_cur ] [d_cur] = [f_cur^T t] // 二阶方程用克莱默法则求解并解之 Vector3d t = T_R_C.translation(); Vector3d f2 = T_R_C.rotation_matrix() * f_curr; Vector2d b = Vector2d ( t.dot ( f_ref ), t.dot ( f2 ) ); double A[4]; A[0] = f_ref.dot ( f_ref ); A[2] = f_ref.dot ( f2 ); A[1] = -A[2]; A[3] = - f2.dot ( f2 ); double d = A[0]*A[3]-A[1]*A[2]; Vector2d lambdavec = Vector2d ( A[3] * b ( 0,0 ) - A[1] * b ( 1,0 ), -A[2] * b ( 0,0 ) + A[0] * b ( 1,0 )) /d; Vector3d xm = lambdavec ( 0,0 ) * f_ref; Vector3d xn = t + lambdavec ( 1,0 ) * f2; Vector3d d_esti = ( xm+xn ) / 2.0; // 三角化算得的深度向量 double depth_estimation = d_esti.norm(); // 深度值 // 计算不确定性(以一个像素为误差) Vector3d p = f_ref*depth_estimation; Vector3d a = p - t; double t_norm = t.norm(); double a_norm = a.norm(); double alpha = acos( f_ref.dot(t)/t_norm ); double beta = acos( -a.dot(t)/(a_norm*t_norm)); double beta_prime = beta + atan(1/fx); double gamma = M_PI - alpha - beta_prime; double p_prime = t_norm * sin(beta_prime) / sin(gamma); double d_cov = p_prime - depth_estimation; double d_cov2 = d_cov*d_cov; // 高斯融合 double mu = depth.ptr<double>( int(pt_ref(1,0)) )[ int(pt_ref(0,0)) ]; double sigma2 = depth_cov.ptr<double>( int(pt_ref(1,0)) )[ int(pt_ref(0,0)) ]; double mu_fuse = (d_cov2*mu+sigma2*depth_estimation) / ( sigma2+d_cov2); double sigma_fuse2 = ( sigma2 * d_cov2 ) / ( sigma2 + d_cov2 ); depth.ptr<double>( int(pt_ref(1,0)) )[ int(pt_ref(0,0)) ] = mu_fuse; depth_cov.ptr<double>( int(pt_ref(1,0)) )[ int(pt_ref(0,0)) ] = sigma_fuse2; return true; } // 作图工具 void plotDepth(const Mat& depth) { imshow( "depth", depth*0.4 ); waitKey(1); } // 像素到相机坐标系 (pixels to m) inline Vector3d px2cam ( const Vector2d px ) { return Vector3d ( (px(0,0) - cx)/fx, (px(1,0) - cy)/fy, 1 ); } // 相机坐标系到像素 inline Vector2d cam2px ( const Vector3d p_cam ) { return Vector2d ( p_cam(0,0)*fx/p_cam(2,0) + cx, p_cam(1,0)*fy/p_cam(2,0) + cy ); } // 检测一个点是否在图像边框内 inline bool inside( const Vector2d& pt ) { return pt(0,0) >= boarder && pt(1,0)>=boarder && pt(0,0)+boarder<width && pt(1,0)+boarder<=height; } }; #endif
[ "2022087641@qq.com" ]
2022087641@qq.com
51e8286e75c9416d2d2c94e2ebf36f5f7e3a1354
7e79e0be56f612288e9783582c7b65a1a6a53397
/problem-solutions/codeforces/252/B.cpp
2588454b5068570cd79d9b2c64fb8d056fc0363b
[]
no_license
gcamargo96/Competitive-Programming
a643f492b429989c2d13d7d750c6124e99373771
0325097de60e693009094990d408ee8f3e8bb18a
refs/heads/master
2020-07-14T10:27:26.572439
2019-08-24T15:11:20
2019-08-24T15:11:20
66,391,304
0
0
null
null
null
null
UTF-8
C++
false
false
684
cpp
#include <bits/stdc++.h> using namespace std; #define ll long long #define ii pair<int,int> #define fi first #define se second #define pb push_back #define mp make_pair #define endl "\n" #define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i)) int days[3001]; int main() { int n, v; scanf("%d%d", &n, &v); for (int i = 0; i < n; ++ i) { int a, b; scanf("%d%d", &a, &b); days[a - 1] += b; } int ant = 0, ans = 0; for (int i = 0; i <= 3000; ++ i) { int antn = std :: min(ant, v); int sbr = std :: min(days[i], v - antn); ans += antn + sbr; ant = days[i] - sbr; } printf("%d\n", ans); return 0; }
[ "gacamargo1.000@gmail.com" ]
gacamargo1.000@gmail.com
0c2cd59c3d13bae388af303f6fc5f47e2f535ca5
84a557805488ebd5fedcef318d4af5f308d4bb70
/main_play.hpp
431d342b7050f09ee33a7ebe777fc9866a4ec6d1
[ "CC-BY-4.0" ]
permissive
GenBrg/MagicCastlevania
42e3e49b25d60e240bce335d755650f2fee1f6c1
76ed248d4f0362ea92d29a159a2027d5b16c8a7b
refs/heads/main
2023-01-30T07:44:33.987324
2020-12-12T03:41:39
2020-12-12T03:41:39
307,784,734
3
0
null
null
null
null
UTF-8
C++
false
false
102
hpp
#pragma once #include "PlayMode.hpp" #include <memory> extern std::shared_ptr< PlayMode > main_play;
[ "jianxiangli1996@gmail.com" ]
jianxiangli1996@gmail.com
def370c58a73f8285d6d28bb7f51c9ee938e3334
69e2689bcfc9c876595b742d12013657662a6f65
/Codigo/WEMOS/Capбtulo 11/MQTTSirena/MQTTSirena.ino
00db388c1d2726233175f757b798403addd131f5
[]
no_license
Marcombo/Processing-interfaces-de-usuario-aplicaciones-de-vision-artificial-IoT-Arduino-ESP8266
91ea44a1a1cb66d49c6a2bae9bf9ecd1fdcdcd9a
e54960281f387de5d09b4005650d6ee872205a7b
refs/heads/main
2023-02-17T05:35:52.555093
2021-01-11T10:08:06
2021-01-11T10:08:06
328,616,518
1
3
null
null
null
null
UTF-8
C++
false
false
2,204
ino
#include <ESP8266WiFi.h> #include <PubSubClient.h> const char* ssid = "*************"; // SSID de la red WIFI a la que desea conectarse const char* password = "*******************"; // contraseña de dicha red const char* mqtt_server = "test.mosquitto.org"; const char* tema = "marcombo_alarma_movimiento"; WiFiClient clienteWIFI; PubSubClient clienteMQTT(clienteWIFI); int pinRele = 13; int pinPulsador = 12; boolean releActivado = false; void setup() { pinMode(pinPulsador, INPUT); pinMode(pinRele, OUTPUT); digitalWrite(pinRele, LOW); Serial.begin(115200); //Inicializamos la conexión WIFI Serial.print("Conectando a " + String(ssid) + " "); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(" Conectado"); //Establecerá el broker que utilizará clienteMQTT.setServer(mqtt_server, 1883); //Establecerá la función a la que se va a llamar cuando llegue un mensaje del broker clienteMQTT.setCallback(callback); } void callback(char* tema, byte* contenido, unsigned int longitudContenido) { String mensaje = ""; Serial.print("Ha llegado un mensaje con el tema: "); Serial.print(tema); Serial.print(" y el contenido: "); for (int i = 0; i < longitudContenido; i++) { mensaje = mensaje + (char)contenido[i]; Serial.print((char)contenido[i]); } Serial.println(); //Activa o desactiva el rele if (mensaje == "ON"){ digitalWrite(pinRele, HIGH); releActivado = true; } else if (mensaje == "OFF"){ digitalWrite(pinRele, LOW); releActivado = false; } } void loop() { //Si se presiona el pulsador se desactiva el relé if(digitalRead(pinPulsador) && releActivado){ digitalWrite(pinRele, LOW); clienteMQTT.publish(tema, "OFF"); releActivado = false; } //Establecerá la conexión con el broker while (!clienteMQTT.connected()) { Serial.print("Conectando al broker ..."); if (clienteMQTT.connect("wemos")) { Serial.println("Conectado al broker."); clienteMQTT.subscribe(tema); } else { delay(5000); } } // Cliente escuchando clienteMQTT.loop(); }
[ "ferri.fc@gmail.com" ]
ferri.fc@gmail.com
23e829e23a6708aac123b053ee6343ee322596a9
1b9eaf067ac375513d12f23fde56a59dede0e08a
/Lib/Kvaser/Canlib/Samples/NET/vs2005/CANdump_CLR/CLRcandump.cpp
8a909b57b087452b09195b55afedbe525ec22ebe
[]
no_license
hjhdog1/move_and_track
ca6345d86b5c96666084714d8cfa0437e81412d4
c340786f02cf2fe1a6195027865722aa9d489c20
refs/heads/master
2020-05-18T14:34:53.321980
2017-04-07T00:30:49
2017-04-07T00:30:49
84,249,922
2
3
null
null
null
null
UTF-8
C++
false
false
10,475
cpp
// CLRcandump.cpp : main project file. #include "stdafx.h" #include "stdlib.h" using namespace System; using namespace System::IO; using namespace canlibCLSNET; // // Global variables for the command-line options. // static int quiet = 0; // Defines the verbosity. static bool logToFile = false; static bool allowVirtual = false; static long int msgCount = 0; static long int overRuns = 0; static __int64 timeOffset = 0; static void DisplayHelp(void) { Console::Write("\nCANLIB Dump Program\n"); Console::Write("(Part of the CANLIB SDK from KVASER AB - http://www.kvaser.se)\n"); Console::Write("\n"); Console::Write("This is a sample program that just dumps all incoming messages to the screen\n"); Console::Write("or a file.\n"); Console::Write("\nUsage: candump [flags] [filename]\n"); Console::Write(" -X Listen to CAN channel number X.\n"); Console::Write(" -B<value> Set the bitrate. Value is any of 1000,500,250,125.\n"); Console::Write(" Default bitrate is 125 kbit/s.\n"); Console::Write(" -h Print this help text.\n"); Console::Write(" -q Be more quiet than usual.\n"); Console::Write(" -v Allow use of virtual channel.\n"); Console::Write("\nIf no filename is specified, standard output is used.\n\n"); Console::Write("The following keys can be used during logging:\n"); Console::Write(" ESC Stop logging.\n"); Console::Write(" Q Be more quiet.\n"); Console::Write(" q Be less quiet.\n"); Console::Write("\nExample:\n"); Console::Write("candump -B250 -0 logfile.log\n"); Console::Write(" would set CAN channel 0 to 250 kbit/s and log to logfile.log\n"); Environment::Exit(0); } void ReportError(String^ funcName, Canlib::canStatus status) { IO::TextWriter^ errOutput = Console::Error; String^ errString; Canlib::canGetErrorText(status, errString); errOutput->WriteLine("{0}: failed, status = {1} ({2})", funcName, status, errString); } int PrepareChannel(int channel, int bitrate) { Canlib::canStatus retStatus; // initialize the API library Canlib::canInitializeLibrary(); // // First, open a handle to the CAN circuit. Specifying // canOPEN_EXCLUSIVE ensures we get a circuit that noone else // is using. // int flags = Canlib::canOPEN_EXCLUSIVE | ((allowVirtual) ? Canlib::canOPEN_ACCEPT_VIRTUAL : 0); int hnd = Canlib::canOpenChannel(channel, flags); if (hnd < 0) { retStatus = (Canlib::canStatus)hnd; ReportError("canOpenChannel", retStatus); Environment::Exit(1); } // // Using our new shiny handle, we specify the baud rate // using one of the convenient canBITRATE_xxx constants. // // The bit layout is in depth discussed in most CAN // controller data sheets, and on the web at // http://www.kvaser.se. // if ((retStatus = Canlib::canSetBusParams(hnd, bitrate, 0, 0, 0, 0, 0)) != Canlib::canStatus::canOK) { ReportError("canSetBusParams", retStatus); Canlib::canClose(hnd); Environment::Exit(1); } // // Then we start the ball rolling. // if ((retStatus = Canlib::canBusOn(hnd)) != Canlib::canStatus::canOK) { ReportError("canBusOn", retStatus); Canlib::canClose(hnd); Environment::Exit(1); } // Return the handle; our caller will need it for // further exercising the CAN controller. return hnd; } void DisplayLeadIn(int handle) { if (quiet == 0) { using namespace System::Globalization; DateTime dt = DateTime::Now; // setup our timer offset timeOffset = Canlib::canReadTimer(handle); Console::WriteLine("; Logging started at {0}", dt.ToString("U", DateTimeFormatInfo::InvariantInfo)); Console::WriteLine("; (x = Extended Id, R = Remote Frame, o = Overrun, N = NERR)"); Console::WriteLine("; Ident xRoN DLC Data 0.....................7 Time"); } } void DisplaySummary(int handle) { if (quiet == 0) { using namespace System::Globalization; DateTime dt = DateTime::Now; Console::WriteLine("; Logging ended at {0}", dt.ToString("U", DateTimeFormatInfo::InvariantInfo)); Console::WriteLine("; {0} messages received.", msgCount); Console::WriteLine("; {0} overrun conditions detected.", overRuns); } } void EmptyReceiveBuffer(int handle) { Canlib::canStatus status; int id, dlc, flags; array <unsigned char, 1> ^msg = gcnew array<unsigned char>(8); __int64 time; __int64 adjTime, timeFrac, timeInt; int i; // // Read a message. // while ((status = Canlib::canRead(handle, id, msg, dlc, flags, time)) == Canlib::canStatus::canOK) { if (quiet <= 1) { if ((flags & Canlib::canMSG_ERROR_FRAME) == 0) { // A message real message so print identifier and flags. Console::Write("{0:X8} {1}{2}{3}{4} {5:G2} ", id, (flags & Canlib::canMSG_EXT) ? "x" : " ", (flags & Canlib::canMSG_RTR) ? "R" : " ", (flags & Canlib::canMSGERR_OVERRUN) ? "o" : " ", (flags & Canlib::canMSG_NERR) ? "N" : " ", // TJA 1053/1054 transceivers only dlc); // Print the data bytes, but not for Remote Frames. // Print at most 8 bytes - the DLC might be larger // but there are never more than 8 bytes in a // message. if (dlc > 8) dlc = 8; if ((flags & Canlib::canMSG_RTR) == 0) { for (i = 0; i < dlc; i++) Console::Write("{0:X2} ", msg[i]); for (; i < 8; i++) Console::Write(" "); } else { Console::Write(" "); } msgCount++; } else { // An error frame. // CANLIB will set the id to something controller // dependent. Console::Write(" Error Frames "); } // Print the time stamp, formatted as seconds. adjTime = time - timeOffset; if (adjTime < 0) { // negative values may occur due to time between BusOn call and ReadTimer call. timeFrac = (-adjTime) % 1000; timeInt = (-adjTime) / 1000; Console::WriteLine(" -{0,5}.{1:D3}", timeInt, timeFrac); } else { timeFrac = adjTime % 1000; timeInt = adjTime / 1000; Console::WriteLine(" {0,6}.{1:D3}", timeInt, timeFrac); } // Keep some statistics. if (flags & Canlib::canMSGERR_OVERRUN) overRuns++; } // // When there are no more messages in the queue, // stat will be equal to canERR_NOMSG. // } if (status != Canlib::canStatus::canERR_NOMSG) { ReportError("canRead", status); } } void RecordMessages(int handle) { bool finished = false; IO::TextWriter^ errOutput = Console::Error; while (!finished) { while (!Console::KeyAvailable) { EmptyReceiveBuffer(handle); Threading::Thread::Sleep(50); } ConsoleKeyInfo cki; cki = Console::ReadKey(true); switch (cki.Key) { case ConsoleKey::Escape: finished = true; break; case ConsoleKey::Q: if ((int)(cki.Modifiers & ConsoleModifiers::Shift)) { if (quiet < 5) quiet++; } else { if (quiet > 0) quiet--; } errOutput->WriteLine("New quiet level = {0}", quiet); break; } } } int main(array<System::String ^> ^args) { int bitrate = Canlib::canBITRATE_125K; // Selected bit rate. int channel = 0; // Channel # String^ logFileName = ""; // Name of log file IO::StreamWriter^ filePtr = nullptr; IO::TextWriter^ stdOutput = Console::Out; IO::TextWriter^ errOutput = Console::Error; // Determine the command line arguements. for (int i = 0; i < args->Length; i++) { if (args[i][0] != '-') { logFileName = String::Copy(args[i]); try { filePtr = File::CreateText(logFileName); } catch (IO::IOException^ e) { errOutput->WriteLine(e->Message); DisplayHelp(); } logToFile = true; } else if (args[i][1] == 'h') { // needs help DisplayHelp(); } else if (args[i][1] == 'q') { // shhhhhhh! quiet++; } else if (args[i][1] == 'v') { allowVirtual = true; } else if (args[i][1] == 'B') { // baudrate chosen int tmp = Convert::ToInt32(args[i]->Substring(2)); switch (tmp) { case 1000: bitrate = Canlib::canBITRATE_1M; break; case 500 : bitrate = Canlib::canBITRATE_500K; break; case 250 : bitrate = Canlib::canBITRATE_250K; break; case 125 : bitrate = Canlib::canBITRATE_125K; break; default : DisplayHelp(); break; } } else { // channel number to use channel = Convert::ToInt32(args[i]->Substring(1)); } } int handle = PrepareChannel(channel, bitrate); if ((Canlib::canStatus)handle >= Canlib::canStatus::canOK) { // everything initialized so lets start tracking data if (logToFile) Console::SetOut(filePtr); DisplayLeadIn(handle); RecordMessages(handle); DisplaySummary(handle); // close channel Canlib::canBusOff(handle); Canlib::canClose(handle); // close the log file if (logToFile) filePtr->Close(); } return 0; }
[ "hjhdog1@gmail.com" ]
hjhdog1@gmail.com
e290164453d743476203a682896be11474101f53
2c582bf759c4d52725f6dc37d5f2f9384c128a10
/C++ builder/C++ Builder程序员成长攻略/《C++ Builder程序员成长攻略》-蒙祖强-源代码-4283/~ch8/Example8_3/Example8_3.cpp
3e166fedaec0d9ccaa73ddbdeb5c22c0ef88bbab
[]
no_license
shaoyangjiang/StudyNotes
730a71c0671a5d33ad608bbc0a6f93b18bb634f6
82e507028571877882a1b128aa4fdd931ee5c02f
refs/heads/master
2021-01-12T08:37:14.789534
2016-12-19T01:49:51
2016-12-19T01:49:51
76,633,763
0
0
null
null
null
null
UTF-8
C++
false
false
1,505
cpp
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop //--------------------------------------------------------------------------- USEFORM("Unit1.cpp", MainForm); USEFORM("Browse.cpp", BrowseForm); USEFORM("Insert.cpp", InsertForm); USEFORM("update.cpp", updateForm); USEFORM("Delete.cpp", deleteForm); //--------------------------------------------------------------------------- WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { try { Application->Initialize(); Application->CreateForm(__classid(TMainForm), &MainForm); Application->CreateForm(__classid(TBrowseForm), &BrowseForm); Application->CreateForm(__classid(TInsertForm), &InsertForm); Application->CreateForm(__classid(TupdateForm), &updateForm); Application->CreateForm(__classid(TdeleteForm), &deleteForm); Application->Run(); } catch (Exception &exception) { Application->ShowException(&exception); } catch (...) { try { throw Exception(""); } catch (Exception &exception) { Application->ShowException(&exception); } } return 0; } //---------------------------------------------------------------------------
[ "348293362@qq.com" ]
348293362@qq.com
def7291cb41b08ff4e7c82044644ce90ebd424ca
c0e2fc2049cdb611b44af8c3a656d2cd64b3b62b
/src/File/ParserJsonCPP/json/json_value.cpp
943d8b441c08325e78ff4b53f62529db185a5789
[ "Apache-2.0" ]
permissive
github188/SimpleCode
f9e99fd6f3f73bb8cc6c1eea2a8fd84fff8dd77d
781500a3b820e979db64672e3f2b1dc6151c5246
refs/heads/master
2021-01-19T22:53:56.256905
2016-02-02T08:02:43
2016-02-02T08:02:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
39,933
cpp
#include <iostream> #include <json/value.h> #include <json/writer.h> #include <utility> #include <stdexcept> #include <cstring> #include <cassert> #ifdef JSON_USE_CPPTL # include <cpptl/conststring.h> #endif #include <cstddef> // size_t #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR # include "json_batchallocator.h" #endif // #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR #define JSON_ASSERT_UNREACHABLE assert( false ) #define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw #define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) throw std::runtime_error( message ); namespace Json { const Value Value::null; const Int Value::minInt = Int( ~(UInt(-1) / 2) ); const Int Value::maxInt = Int( UInt(-1) / 2 ); const UInt Value::maxUInt = UInt(-1); // A "safe" implementation of strdup. Allow null pointer to be passed. // Also avoid warning on msvc80. // //inline char *safeStringDup( const char *czstring ) //{ // if ( czstring ) // { // const size_t length = (unsigned int)( strlen(czstring) + 1 ); // char *newString = static_cast<char *>( malloc( length ) ); // memcpy( newString, czstring, length ); // return newString; // } // return 0; //} // //inline char *safeStringDup( const std::string &str ) //{ // if ( !str.empty() ) // { // const size_t length = str.length(); // char *newString = static_cast<char *>( malloc( length + 1 ) ); // memcpy( newString, str.c_str(), length ); // newString[length] = 0; // return newString; // } // return 0; //} ValueAllocator::~ValueAllocator() { } class DefaultValueAllocator : public ValueAllocator { public: virtual ~DefaultValueAllocator() { } virtual char *makeMemberName( const char *memberName ) { return duplicateStringValue( memberName ); } virtual void releaseMemberName( char *memberName ) { releaseStringValue( memberName ); } virtual char *duplicateStringValue( const char *value, unsigned int length = unknown ) { //@todo invesgate this old optimization //if ( !value || value[0] == 0 ) // return 0; if ( length == unknown ) length = (unsigned int)strlen(value); char *newString = static_cast<char *>( malloc( length + 1 ) ); memcpy( newString, value, length ); newString[length] = 0; return newString; } virtual void releaseStringValue( char *value ) { if ( value ) free( value ); } }; static ValueAllocator *&valueAllocator() { static DefaultValueAllocator defaultAllocator; static ValueAllocator *valueAllocator = &defaultAllocator; return valueAllocator; } static struct DummyValueAllocatorInitializer { DummyValueAllocatorInitializer() { valueAllocator(); // ensure valueAllocator() statics are initialized before main(). } } dummyValueAllocatorInitializer; // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // ValueInternals... // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// #ifdef JSON_VALUE_USE_INTERNAL_MAP # include "json_internalarray.inl" # include "json_internalmap.inl" #endif // JSON_VALUE_USE_INTERNAL_MAP # include "json_valueiterator.inl" // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class Value::CommentInfo // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// Value::CommentInfo::CommentInfo() : comment_( 0 ) { } Value::CommentInfo::~CommentInfo() { if ( comment_ ) valueAllocator()->releaseStringValue( comment_ ); } void Value::CommentInfo::setComment( const char *text ) { if ( comment_ ) valueAllocator()->releaseStringValue( comment_ ); JSON_ASSERT( text ); JSON_ASSERT_MESSAGE( text[0] == '\0' || text[0] == '/', "Comments must start with /"); // It seems that /**/ style comments are acceptable as well. comment_ = valueAllocator()->duplicateStringValue( text ); } // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class Value::CZString // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// # ifndef JSON_VALUE_USE_INTERNAL_MAP // Notes: index_ indicates if the string was allocated when // a string is stored. Value::CZString::CZString( int index ) : cstr_( 0 ) , index_( index ) { } Value::CZString::CZString( const char *cstr, DuplicationPolicy allocate ) : cstr_( allocate == duplicate ? valueAllocator()->makeMemberName(cstr) : cstr ) , index_( allocate ) { } Value::CZString::CZString( const CZString &other ) : cstr_( other.index_ != noDuplication &&other.cstr_ != 0 ? valueAllocator()->makeMemberName( other.cstr_ ) : other.cstr_ ) , index_( other.cstr_ ? (other.index_ == noDuplication ? noDuplication : duplicate) : other.index_ ) { } Value::CZString::~CZString() { if ( cstr_ && index_ == duplicate ) valueAllocator()->releaseMemberName( const_cast<char *>( cstr_ ) ); } void Value::CZString::swap( CZString &other ) { std::swap( cstr_, other.cstr_ ); std::swap( index_, other.index_ ); } Value::CZString & Value::CZString::operator =( const CZString &other ) { CZString temp( other ); swap( temp ); return *this; } bool Value::CZString::operator<( const CZString &other ) const { if ( cstr_ ) return strcmp( cstr_, other.cstr_ ) < 0; return index_ < other.index_; } bool Value::CZString::operator==( const CZString &other ) const { if ( cstr_ ) return strcmp( cstr_, other.cstr_ ) == 0; return index_ == other.index_; } int Value::CZString::index() const { return index_; } const char * Value::CZString::c_str() const { return cstr_; } bool Value::CZString::isStaticString() const { return index_ == noDuplication; } #endif // ifndef JSON_VALUE_USE_INTERNAL_MAP // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // class Value::Value // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// /*! \internal Default constructor initialization must be equivalent to: * memset( this, 0, sizeof(Value) ) * This optimization is used in ValueInternalMap fast allocator. */ Value::Value( ValueType type ) : type_( type ) , allocated_( 0 ) , comments_( 0 ) # ifdef JSON_VALUE_USE_INTERNAL_MAP , itemIsUsed_( 0 ) #endif { switch ( type ) { case nullValue: break; case intValue: case uintValue: value_.int_ = 0; break; case realValue: value_.real_ = 0.0; break; case stringValue: value_.string_ = 0; break; #ifndef JSON_VALUE_USE_INTERNAL_MAP case arrayValue: case objectValue: value_.map_ = new ObjectValues(); break; #else case arrayValue: value_.array_ = arrayAllocator()->newArray(); break; case objectValue: value_.map_ = mapAllocator()->newMap(); break; #endif case booleanValue: value_.bool_ = false; break; default: JSON_ASSERT_UNREACHABLE; } } Value::Value( Int value ) : type_( intValue ) , comments_( 0 ) # ifdef JSON_VALUE_USE_INTERNAL_MAP , itemIsUsed_( 0 ) #endif { value_.int_ = value; } Value::Value( UInt value ) : type_( uintValue ) , comments_( 0 ) # ifdef JSON_VALUE_USE_INTERNAL_MAP , itemIsUsed_( 0 ) #endif { value_.uint_ = value; } Value::Value( double value ) : type_( realValue ) , comments_( 0 ) # ifdef JSON_VALUE_USE_INTERNAL_MAP , itemIsUsed_( 0 ) #endif { value_.real_ = value; } Value::Value( const char *value ) : type_( stringValue ) , allocated_( true ) , comments_( 0 ) # ifdef JSON_VALUE_USE_INTERNAL_MAP , itemIsUsed_( 0 ) #endif { value_.string_ = valueAllocator()->duplicateStringValue( value ); } Value::Value( const char *beginValue, const char *endValue ) : type_( stringValue ) , allocated_( true ) , comments_( 0 ) # ifdef JSON_VALUE_USE_INTERNAL_MAP , itemIsUsed_( 0 ) #endif { value_.string_ = valueAllocator()->duplicateStringValue( beginValue, UInt(endValue - beginValue) ); } Value::Value( const std::string &value ) : type_( stringValue ) , allocated_( true ) , comments_( 0 ) # ifdef JSON_VALUE_USE_INTERNAL_MAP , itemIsUsed_( 0 ) #endif { value_.string_ = valueAllocator()->duplicateStringValue( value.c_str(), (unsigned int)value.length() ); } Value::Value( const StaticString &value ) : type_( stringValue ) , allocated_( false ) , comments_( 0 ) # ifdef JSON_VALUE_USE_INTERNAL_MAP , itemIsUsed_( 0 ) #endif { value_.string_ = const_cast<char *>( value.c_str() ); } # ifdef JSON_USE_CPPTL Value::Value( const CppTL::ConstString &value ) : type_( stringValue ) , allocated_( true ) , comments_( 0 ) # ifdef JSON_VALUE_USE_INTERNAL_MAP , itemIsUsed_( 0 ) #endif { value_.string_ = valueAllocator()->duplicateStringValue( value, value.length() ); } # endif Value::Value( bool value ) : type_( booleanValue ) , comments_( 0 ) # ifdef JSON_VALUE_USE_INTERNAL_MAP , itemIsUsed_( 0 ) #endif { value_.bool_ = value; } Value::Value( const Value &other ) : type_( other.type_ ) , comments_( 0 ) # ifdef JSON_VALUE_USE_INTERNAL_MAP , itemIsUsed_( 0 ) #endif { switch ( type_ ) { case nullValue: case intValue: case uintValue: case realValue: case booleanValue: value_ = other.value_; break; case stringValue: if ( other.value_.string_ ) { value_.string_ = valueAllocator()->duplicateStringValue( other.value_.string_ ); allocated_ = true; } else value_.string_ = 0; break; #ifndef JSON_VALUE_USE_INTERNAL_MAP case arrayValue: case objectValue: value_.map_ = new ObjectValues( *other.value_.map_ ); break; #else case arrayValue: value_.array_ = arrayAllocator()->newArrayCopy( *other.value_.array_ ); break; case objectValue: value_.map_ = mapAllocator()->newMapCopy( *other.value_.map_ ); break; #endif default: JSON_ASSERT_UNREACHABLE; } if ( other.comments_ ) { comments_ = new CommentInfo[numberOfCommentPlacement]; for ( int comment = 0; comment < numberOfCommentPlacement; ++comment ) { const CommentInfo &otherComment = other.comments_[comment]; if ( otherComment.comment_ ) comments_[comment].setComment( otherComment.comment_ ); } } } Value::~Value() { switch ( type_ ) { case nullValue: case intValue: case uintValue: case realValue: case booleanValue: break; case stringValue: if ( allocated_ ) valueAllocator()->releaseStringValue( value_.string_ ); break; #ifndef JSON_VALUE_USE_INTERNAL_MAP case arrayValue: case objectValue: delete value_.map_; break; #else case arrayValue: arrayAllocator()->destructArray( value_.array_ ); break; case objectValue: mapAllocator()->destructMap( value_.map_ ); break; #endif default: JSON_ASSERT_UNREACHABLE; } if ( comments_ ) delete[] comments_; } Value & Value::operator=( const Value &other ) { Value temp( other ); swap( temp ); return *this; } void Value::swap( Value &other ) { ValueType temp = type_; type_ = other.type_; other.type_ = temp; std::swap( value_, other.value_ ); int temp2 = allocated_; allocated_ = other.allocated_; other.allocated_ = temp2; } ValueType Value::type() const { return type_; } int Value::compare( const Value &other ) { /* int typeDelta = other.type_ - type_; switch ( type_ ) { case nullValue: return other.type_ == type_; case intValue: if ( other.type_.isNumeric() case uintValue: case realValue: case booleanValue: break; case stringValue, break; case arrayValue: delete value_.array_; break; case objectValue: delete value_.map_; default: JSON_ASSERT_UNREACHABLE; } */ return 0; // unreachable } bool Value::operator <( const Value &other ) const { int typeDelta = type_ - other.type_; if ( typeDelta ) return typeDelta < 0 ? true : false; switch ( type_ ) { case nullValue: return false; case intValue: return value_.int_ < other.value_.int_; case uintValue: return value_.uint_ < other.value_.uint_; case realValue: return value_.real_ < other.value_.real_; case booleanValue: return value_.bool_ < other.value_.bool_; case stringValue: return ( value_.string_ == 0 && other.value_.string_ ) || ( other.value_.string_ && value_.string_ && strcmp( value_.string_, other.value_.string_ ) < 0 ); #ifndef JSON_VALUE_USE_INTERNAL_MAP case arrayValue: case objectValue: { int delta = int( value_.map_->size() - other.value_.map_->size() ); if ( delta ) return delta < 0; return (*value_.map_) < (*other.value_.map_); } #else case arrayValue: return value_.array_->compare( *(other.value_.array_) ) < 0; case objectValue: return value_.map_->compare( *(other.value_.map_) ) < 0; #endif default: JSON_ASSERT_UNREACHABLE; } return 0; // unreachable } bool Value::operator <=( const Value &other ) const { return !(other > *this); } bool Value::operator >=( const Value &other ) const { return !(*this < other); } bool Value::operator >( const Value &other ) const { return other < *this; } bool Value::operator ==( const Value &other ) const { //if ( type_ != other.type_ ) // GCC 2.95.3 says: // attempt to take address of bit-field structure member `Json::Value::type_' // Beats me, but a temp solves the problem. int temp = other.type_; if ( type_ != temp ) return false; switch ( type_ ) { case nullValue: return true; case intValue: return value_.int_ == other.value_.int_; case uintValue: return value_.uint_ == other.value_.uint_; case realValue: return value_.real_ == other.value_.real_; case booleanValue: return value_.bool_ == other.value_.bool_; case stringValue: return ( value_.string_ == other.value_.string_ ) || ( other.value_.string_ && value_.string_ && strcmp( value_.string_, other.value_.string_ ) == 0 ); #ifndef JSON_VALUE_USE_INTERNAL_MAP case arrayValue: case objectValue: return value_.map_->size() == other.value_.map_->size() && (*value_.map_) == (*other.value_.map_); #else case arrayValue: return value_.array_->compare( *(other.value_.array_) ) == 0; case objectValue: return value_.map_->compare( *(other.value_.map_) ) == 0; #endif default: JSON_ASSERT_UNREACHABLE; } return 0; // unreachable } bool Value::operator !=( const Value &other ) const { return !( *this == other ); } const char * Value::asCString() const { JSON_ASSERT( type_ == stringValue ); return value_.string_; } std::string Value::asString() const { switch ( type_ ) { case nullValue: return ""; case stringValue: return value_.string_ ? value_.string_ : ""; case booleanValue: return value_.bool_ ? "true" : "false"; case intValue: case uintValue: case realValue: case arrayValue: case objectValue: JSON_ASSERT_MESSAGE( false, "Type is not convertible to string" ); default: JSON_ASSERT_UNREACHABLE; } return ""; // unreachable } # ifdef JSON_USE_CPPTL CppTL::ConstString Value::asConstString() const { return CppTL::ConstString( asString().c_str() ); } # endif Value::Int Value::asInt() const { switch ( type_ ) { case nullValue: return 0; case intValue: return value_.int_; case uintValue: JSON_ASSERT_MESSAGE( value_.uint_ < (unsigned)maxInt, "integer out of signed integer range" ); return value_.uint_; case realValue: JSON_ASSERT_MESSAGE( value_.real_ >= minInt && value_.real_ <= maxInt, "Real out of signed integer range" ); return Int( value_.real_ ); case booleanValue: return value_.bool_ ? 1 : 0; case stringValue: case arrayValue: case objectValue: JSON_ASSERT_MESSAGE( false, "Type is not convertible to int" ); default: JSON_ASSERT_UNREACHABLE; } return 0; // unreachable; } Value::UInt Value::asUInt() const { switch ( type_ ) { case nullValue: return 0; case intValue: JSON_ASSERT_MESSAGE( value_.int_ >= 0, "Negative integer can not be converted to unsigned integer" ); return value_.int_; case uintValue: return value_.uint_; case realValue: JSON_ASSERT_MESSAGE( value_.real_ >= 0 && value_.real_ <= maxUInt, "Real out of unsigned integer range" ); return UInt( value_.real_ ); case booleanValue: return value_.bool_ ? 1 : 0; case stringValue: case arrayValue: case objectValue: JSON_ASSERT_MESSAGE( false, "Type is not convertible to uint" ); default: JSON_ASSERT_UNREACHABLE; } return 0; // unreachable; } double Value::asDouble() const { switch ( type_ ) { case nullValue: return 0.0; case intValue: return value_.int_; case uintValue: return value_.uint_; case realValue: return value_.real_; case booleanValue: return value_.bool_ ? 1.0 : 0.0; case stringValue: case arrayValue: case objectValue: JSON_ASSERT_MESSAGE( false, "Type is not convertible to double" ); default: JSON_ASSERT_UNREACHABLE; } return 0; // unreachable; } bool Value::asBool() const { switch ( type_ ) { case nullValue: return false; case intValue: case uintValue: return value_.int_ != 0; case realValue: return value_.real_ != 0.0; case booleanValue: return value_.bool_; case stringValue: return value_.string_ && value_.string_[0] != 0; case arrayValue: case objectValue: return value_.map_->size() != 0; default: JSON_ASSERT_UNREACHABLE; } return false; // unreachable; } bool Value::isConvertibleTo( ValueType other ) const { switch ( type_ ) { case nullValue: return true; case intValue: return ( other == nullValue && value_.int_ == 0 ) || other == intValue || ( other == uintValue && value_.int_ >= 0 ) || other == realValue || other == stringValue || other == booleanValue; case uintValue: return ( other == nullValue && value_.uint_ == 0 ) || ( other == intValue && value_.uint_ <= (unsigned)maxInt ) || other == uintValue || other == realValue || other == stringValue || other == booleanValue; case realValue: return ( other == nullValue && value_.real_ == 0.0 ) || ( other == intValue && value_.real_ >= minInt && value_.real_ <= maxInt ) || ( other == uintValue && value_.real_ >= 0 && value_.real_ <= maxUInt ) || other == realValue || other == stringValue || other == booleanValue; case booleanValue: return ( other == nullValue && value_.bool_ == false ) || other == intValue || other == uintValue || other == realValue || other == stringValue || other == booleanValue; case stringValue: return other == stringValue || ( other == nullValue && (!value_.string_ || value_.string_[0] == 0) ); case arrayValue: return other == arrayValue || ( other == nullValue && value_.map_->size() == 0 ); case objectValue: return other == objectValue || ( other == nullValue && value_.map_->size() == 0 ); default: JSON_ASSERT_UNREACHABLE; } return false; // unreachable; } /// Number of values in array or object Value::UInt Value::size() const { switch ( type_ ) { case nullValue: case intValue: case uintValue: case realValue: case booleanValue: case stringValue: return 0; #ifndef JSON_VALUE_USE_INTERNAL_MAP case arrayValue: // size of the array is highest index + 1 if ( !value_.map_->empty() ) { ObjectValues::const_iterator itLast = value_.map_->end(); --itLast; return (*itLast).first.index() + 1; } return 0; case objectValue: return Int( value_.map_->size() ); #else case arrayValue: return Int( value_.array_->size() ); case objectValue: return Int( value_.map_->size() ); #endif default: JSON_ASSERT_UNREACHABLE; } return 0; // unreachable; } bool Value::empty() const { if ( isNull() || isArray() || isObject() ) return size() == 0u; else return false; } bool Value::operator!() const { return isNull(); } void Value::clear() { JSON_ASSERT( type_ == nullValue || type_ == arrayValue || type_ == objectValue ); switch ( type_ ) { #ifndef JSON_VALUE_USE_INTERNAL_MAP case arrayValue: case objectValue: value_.map_->clear(); break; #else case arrayValue: value_.array_->clear(); break; case objectValue: value_.map_->clear(); break; #endif default: break; } } void Value::resize( UInt newSize ) { JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); if ( type_ == nullValue ) *this = Value( arrayValue ); #ifndef JSON_VALUE_USE_INTERNAL_MAP UInt oldSize = size(); if ( newSize == 0 ) clear(); else if ( newSize > oldSize ) (*this)[ newSize - 1 ]; else { for ( UInt index = newSize; index < oldSize; ++index ) value_.map_->erase( index ); assert( size() == newSize ); } #else value_.array_->resize( newSize ); #endif } Value & Value::operator[]( UInt index ) { JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); if ( type_ == nullValue ) *this = Value( arrayValue ); #ifndef JSON_VALUE_USE_INTERNAL_MAP CZString key( index ); ObjectValues::iterator it = value_.map_->lower_bound( key ); if ( it != value_.map_->end() && (*it).first == key ) return (*it).second; ObjectValues::value_type defaultValue( key, null ); it = value_.map_->insert( it, defaultValue ); return (*it).second; #else return value_.array_->resolveReference( index ); #endif } const Value & Value::operator[]( UInt index ) const { JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); if ( type_ == nullValue ) return null; #ifndef JSON_VALUE_USE_INTERNAL_MAP CZString key( index ); ObjectValues::const_iterator it = value_.map_->find( key ); if ( it == value_.map_->end() ) return null; return (*it).second; #else Value *value = value_.array_->find( index ); return value ? *value : null; #endif } Value & Value::operator[]( const char *key ) { return resolveReference( key, false ); } Value & Value::resolveReference( const char *key, bool isStatic ) { JSON_ASSERT( type_ == nullValue || type_ == objectValue ); if ( type_ == nullValue ) *this = Value( objectValue ); #ifndef JSON_VALUE_USE_INTERNAL_MAP CZString actualKey( key, isStatic ? CZString::noDuplication : CZString::duplicateOnCopy ); ObjectValues::iterator it = value_.map_->lower_bound( actualKey ); if ( it != value_.map_->end() && (*it).first == actualKey ) return (*it).second; ObjectValues::value_type defaultValue( actualKey, null ); it = value_.map_->insert( it, defaultValue ); Value &value = (*it).second; return value; #else return value_.map_->resolveReference( key, isStatic ); #endif } Value Value::get( UInt index, const Value &defaultValue ) const { const Value *value = &((*this)[index]); return value == &null ? defaultValue : *value; } bool Value::isValidIndex( UInt index ) const { return index < size(); } const Value & Value::operator[]( const char *key ) const { JSON_ASSERT( type_ == nullValue || type_ == objectValue ); if ( type_ == nullValue ) return null; #ifndef JSON_VALUE_USE_INTERNAL_MAP CZString actualKey( key, CZString::noDuplication ); ObjectValues::const_iterator it = value_.map_->find( actualKey ); if ( it == value_.map_->end() ) return null; return (*it).second; #else const Value *value = value_.map_->find( key ); return value ? *value : null; #endif } Value & Value::operator[]( const std::string &key ) { return (*this)[ key.c_str() ]; } const Value & Value::operator[]( const std::string &key ) const { return (*this)[ key.c_str() ]; } Value & Value::operator[]( const StaticString &key ) { return resolveReference( key, true ); } # ifdef JSON_USE_CPPTL Value & Value::operator[]( const CppTL::ConstString &key ) { return (*this)[ key.c_str() ]; } const Value & Value::operator[]( const CppTL::ConstString &key ) const { return (*this)[ key.c_str() ]; } # endif Value & Value::append( const Value &value ) { return (*this)[size()] = value; } Value Value::get( const char *key, const Value &defaultValue ) const { const Value *value = &((*this)[key]); return value == &null ? defaultValue : *value; } Value Value::get( const std::string &key, const Value &defaultValue ) const { return get( key.c_str(), defaultValue ); } Value Value::removeMember( const char *key ) { JSON_ASSERT( type_ == nullValue || type_ == objectValue ); if ( type_ == nullValue ) return null; #ifndef JSON_VALUE_USE_INTERNAL_MAP CZString actualKey( key, CZString::noDuplication ); ObjectValues::iterator it = value_.map_->find( actualKey ); if ( it == value_.map_->end() ) return null; Value old(it->second); value_.map_->erase(it); return old; #else Value *value = value_.map_->find( key ); if (value) { Value old(*value); value_.map_.remove( key ); return old; } else { return null; } #endif } Value Value::removeMember( const std::string &key ) { return removeMember( key.c_str() ); } # ifdef JSON_USE_CPPTL Value Value::get( const CppTL::ConstString &key, const Value &defaultValue ) const { return get( key.c_str(), defaultValue ); } # endif bool Value::isMember( const char *key ) const { const Value *value = &((*this)[key]); return value != &null; } bool Value::isMember( const std::string &key ) const { return isMember( key.c_str() ); } # ifdef JSON_USE_CPPTL bool Value::isMember( const CppTL::ConstString &key ) const { return isMember( key.c_str() ); } #endif Value::Members Value::getMemberNames() const { JSON_ASSERT( type_ == nullValue || type_ == objectValue ); if ( type_ == nullValue ) return Value::Members(); Members members; members.reserve( value_.map_->size() ); #ifndef JSON_VALUE_USE_INTERNAL_MAP ObjectValues::const_iterator it = value_.map_->begin(); ObjectValues::const_iterator itEnd = value_.map_->end(); for ( ; it != itEnd; ++it ) members.push_back( std::string( (*it).first.c_str() ) ); #else ValueInternalMap::IteratorState it; ValueInternalMap::IteratorState itEnd; value_.map_->makeBeginIterator( it ); value_.map_->makeEndIterator( itEnd ); for ( ; !ValueInternalMap::equals( it, itEnd ); ValueInternalMap::increment(it) ) members.push_back( std::string( ValueInternalMap::key( it ) ) ); #endif return members; } // //# ifdef JSON_USE_CPPTL //EnumMemberNames //Value::enumMemberNames() const //{ // if ( type_ == objectValue ) // { // return CppTL::Enum::any( CppTL::Enum::transform( // CppTL::Enum::keys( *(value_.map_), CppTL::Type<const CZString &>() ), // MemberNamesTransform() ) ); // } // return EnumMemberNames(); //} // // //EnumValues //Value::enumValues() const //{ // if ( type_ == objectValue || type_ == arrayValue ) // return CppTL::Enum::anyValues( *(value_.map_), // CppTL::Type<const Value &>() ); // return EnumValues(); //} // //# endif bool Value::isNull() const { return type_ == nullValue; } bool Value::isBool() const { return type_ == booleanValue; } bool Value::isInt() const { return type_ == intValue; } bool Value::isUInt() const { return type_ == uintValue; } bool Value::isIntegral() const { return type_ == intValue || type_ == uintValue || type_ == booleanValue; } bool Value::isDouble() const { return type_ == realValue; } bool Value::isNumeric() const { return isIntegral() || isDouble(); } bool Value::isString() const { return type_ == stringValue; } bool Value::isArray() const { return type_ == nullValue || type_ == arrayValue; } bool Value::isObject() const { return type_ == nullValue || type_ == objectValue; } void Value::setComment( const char *comment, CommentPlacement placement ) { if ( !comments_ ) comments_ = new CommentInfo[numberOfCommentPlacement]; comments_[placement].setComment( comment ); } void Value::setComment( const std::string &comment, CommentPlacement placement ) { setComment( comment.c_str(), placement ); } bool Value::hasComment( CommentPlacement placement ) const { return comments_ != 0 && comments_[placement].comment_ != 0; } std::string Value::getComment( CommentPlacement placement ) const { if ( hasComment(placement) ) return comments_[placement].comment_; return ""; } std::string Value::toStyledString() const { StyledWriter writer; return writer.write( *this ); } Value::const_iterator Value::begin() const { switch ( type_ ) { #ifdef JSON_VALUE_USE_INTERNAL_MAP case arrayValue: if ( value_.array_ ) { ValueInternalArray::IteratorState it; value_.array_->makeBeginIterator( it ); return const_iterator( it ); } break; case objectValue: if ( value_.map_ ) { ValueInternalMap::IteratorState it; value_.map_->makeBeginIterator( it ); return const_iterator( it ); } break; #else case arrayValue: case objectValue: if ( value_.map_ ) return const_iterator( value_.map_->begin() ); break; #endif default: break; } return const_iterator(); } Value::const_iterator Value::end() const { switch ( type_ ) { #ifdef JSON_VALUE_USE_INTERNAL_MAP case arrayValue: if ( value_.array_ ) { ValueInternalArray::IteratorState it; value_.array_->makeEndIterator( it ); return const_iterator( it ); } break; case objectValue: if ( value_.map_ ) { ValueInternalMap::IteratorState it; value_.map_->makeEndIterator( it ); return const_iterator( it ); } break; #else case arrayValue: case objectValue: if ( value_.map_ ) return const_iterator( value_.map_->end() ); break; #endif default: break; } return const_iterator(); } Value::iterator Value::begin() { switch ( type_ ) { #ifdef JSON_VALUE_USE_INTERNAL_MAP case arrayValue: if ( value_.array_ ) { ValueInternalArray::IteratorState it; value_.array_->makeBeginIterator( it ); return iterator( it ); } break; case objectValue: if ( value_.map_ ) { ValueInternalMap::IteratorState it; value_.map_->makeBeginIterator( it ); return iterator( it ); } break; #else case arrayValue: case objectValue: if ( value_.map_ ) return iterator( value_.map_->begin() ); break; #endif default: break; } return iterator(); } Value::iterator Value::end() { switch ( type_ ) { #ifdef JSON_VALUE_USE_INTERNAL_MAP case arrayValue: if ( value_.array_ ) { ValueInternalArray::IteratorState it; value_.array_->makeEndIterator( it ); return iterator( it ); } break; case objectValue: if ( value_.map_ ) { ValueInternalMap::IteratorState it; value_.map_->makeEndIterator( it ); return iterator( it ); } break; #else case arrayValue: case objectValue: if ( value_.map_ ) return iterator( value_.map_->end() ); break; #endif default: break; } return iterator(); } // class PathArgument // ////////////////////////////////////////////////////////////////// PathArgument::PathArgument() : kind_( kindNone ) { } PathArgument::PathArgument( Value::UInt index ) : index_( index ) , kind_( kindIndex ) { } PathArgument::PathArgument( const char *key ) : key_( key ) , kind_( kindKey ) { } PathArgument::PathArgument( const std::string &key ) : key_( key.c_str() ) , kind_( kindKey ) { } // class Path // ////////////////////////////////////////////////////////////////// Path::Path( const std::string &path, const PathArgument &a1, const PathArgument &a2, const PathArgument &a3, const PathArgument &a4, const PathArgument &a5 ) { InArgs in; in.push_back( &a1 ); in.push_back( &a2 ); in.push_back( &a3 ); in.push_back( &a4 ); in.push_back( &a5 ); makePath( path, in ); } void Path::makePath( const std::string &path, const InArgs &in ) { const char *current = path.c_str(); const char *end = current + path.length(); InArgs::const_iterator itInArg = in.begin(); while ( current != end ) { if ( *current == '[' ) { ++current; if ( *current == '%' ) addPathInArg( path, in, itInArg, PathArgument::kindIndex ); else { Value::UInt index = 0; for ( ; current != end && *current >= '0' && *current <= '9'; ++current ) index = index * 10 + Value::UInt(*current - '0'); args_.push_back( index ); } if ( current == end || *current++ != ']' ) invalidPath( path, int(current - path.c_str()) ); } else if ( *current == '%' ) { addPathInArg( path, in, itInArg, PathArgument::kindKey ); ++current; } else if ( *current == '.' ) { ++current; } else { const char *beginName = current; while ( current != end && !strchr( "[.", *current ) ) ++current; args_.push_back( std::string( beginName, current ) ); } } } void Path::addPathInArg( const std::string &path, const InArgs &in, InArgs::const_iterator &itInArg, PathArgument::Kind kind ) { if ( itInArg == in.end() ) { // Error: missing argument %d } else if ( (*itInArg)->kind_ != kind ) { // Error: bad argument type } else { args_.push_back( **itInArg ); } } void Path::invalidPath( const std::string &path, int location ) { // Error: invalid path. } const Value & Path::resolve( const Value &root ) const { const Value *node = &root; for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) { const PathArgument &arg = *it; if ( arg.kind_ == PathArgument::kindIndex ) { if ( !node->isArray() || node->isValidIndex( arg.index_ ) ) { // Error: unable to resolve path (array value expected at position... } node = &((*node)[arg.index_]); } else if ( arg.kind_ == PathArgument::kindKey ) { if ( !node->isObject() ) { // Error: unable to resolve path (object value expected at position...) } node = &((*node)[arg.key_]); if ( node == &Value::null ) { // Error: unable to resolve path (object has no member named '' at position...) } } } return *node; } Value Path::resolve( const Value &root, const Value &defaultValue ) const { const Value *node = &root; for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) { const PathArgument &arg = *it; if ( arg.kind_ == PathArgument::kindIndex ) { if ( !node->isArray() || node->isValidIndex( arg.index_ ) ) return defaultValue; node = &((*node)[arg.index_]); } else if ( arg.kind_ == PathArgument::kindKey ) { if ( !node->isObject() ) return defaultValue; node = &((*node)[arg.key_]); if ( node == &Value::null ) return defaultValue; } } return *node; } Value & Path::make( Value &root ) const { Value *node = &root; for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) { const PathArgument &arg = *it; if ( arg.kind_ == PathArgument::kindIndex ) { if ( !node->isArray() ) { // Error: node is not an array at position ... } node = &((*node)[arg.index_]); } else if ( arg.kind_ == PathArgument::kindKey ) { if ( !node->isObject() ) { // Error: node is not an object at position... } node = &((*node)[arg.key_]); } } return *node; } } // namespace Json
[ "echo_eric@yeah.net" ]
echo_eric@yeah.net
b614e2ad3351d2e86ab759cd2788c41efdcdd157
632f67aef2cf8a30a46aeb2dc1f45c8f3572f7d6
/torch/csrc/jit/tensorexpr/ir.h
65a362ef023fe56e10aebc3935a23e0eccb0ac7f
[ "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "BSL-1.0", "Apache-2.0", "BSD-2-Clause" ]
permissive
mneilly-et/pytorch
b6e9694cbcc045ac741dcc067f021a6ba2059905
604e885925af78106e12a3ffd77687da5891761d
refs/heads/master
2021-09-21T10:21:15.986891
2021-09-04T07:43:25
2021-09-04T07:44:28
228,910,659
0
0
NOASSERTION
2019-12-18T19:47:56
2019-12-18T19:47:55
null
UTF-8
C++
false
false
22,703
h
#pragma once #include <string> #include <vector> #include <c10/util/string_utils.h> #include <torch/csrc/jit/tensorexpr/exceptions.h> #include <torch/csrc/jit/tensorexpr/expr.h> #include <torch/csrc/jit/tensorexpr/fwd_decls.h> #include <torch/csrc/jit/tensorexpr/stmt.h> #include <ATen/core/ivalue.h> namespace torch { namespace jit { namespace tensorexpr { enum CompareSelectOperation { kEQ = 0, kGT, kGE, kLT, kLE, kNE, }; enum CompareSelectBias { kUnbiased, kLikely, kUnlikely, }; inline int getPrecedence(IRNodeType ty) { // Match C++ operator precedence rules, since some pretty-print expressions to // C++. SEE: https://en.cppreference.com/w/cpp/language/operator_precedence switch (ty) { case kPrimitive: return 0; case kCast: case kBitCast: return 2; case kAdd: case kSub: return 6; case kMul: case kDiv: case kMod: return 5; case kMax: case kMin: return 99; case kAnd: return 11; case kOr: return 13; case kLshift: case kRshift: return 7; case kXor: return 12; case kCompareSelect: return 16; default: return 99; } } class Placeholder; class TORCH_API Cast : public ExprNode<Cast> { public: ExprPtr src_value() const { return src_value_; } void set_src_value(ExprPtr src_value) { src_value_ = src_value; } static ExprHandle make(Dtype dtype, const ExprHandle& src_value) { return ExprHandle(alloc<Cast>(dtype, src_value.node())); } Cast(Dtype dtype, ExprPtr src_value) : ExprNodeBase(dtype, kCast), src_value_(src_value) {} bool isConstant() const override { return src_value_->isConstant(); } private: ExprPtr src_value_; }; template <typename T> ExprHandle cast(const ExprHandle& src_value) { return Cast::make(Dtype(ToDtype<T>(), src_value.dtype().lanes()), src_value); } // This is a bitwise cast, akin to bitcast in LLVM class TORCH_API BitCast : public ExprNode<BitCast> { public: ExprPtr src_value() const { return src_value_; } void set_src_value(ExprPtr src_value) { src_value_ = src_value; } static ExprHandle make(Dtype dtype, const ExprHandle& src_value) { return ExprHandle(alloc<BitCast>(dtype, src_value.node())); } BitCast(Dtype dtype, ExprPtr src_value) : ExprNodeBase(dtype, kBitCast), src_value_(src_value) { TORCH_CHECK(src_value_->dtype().byte_size() == dtype.byte_size()); } bool isConstant() const override { return src_value_->isConstant(); } private: ExprPtr src_value_; }; template <typename T> ExprHandle bitcast(const ExprHandle& src_value) { return BitCast::make( Dtype(ToDtype<T>(), src_value.dtype().lanes()), src_value); } // Represent the expression node for binary operators. // A CRTP pattern to share common code among the operators. template <typename Op> class BinaryOpNode : public ExprNode<Op> { public: ExprPtr lhs() const { return this->lhs_; } ExprPtr rhs() const { return this->rhs_; } void set_lhs(ExprPtr lhs) { lhs_ = lhs; } void set_rhs(ExprPtr rhs) { rhs_ = rhs; } static ExprHandle make(const ExprHandle& lhs, const ExprHandle& rhs) { return ExprHandle(alloc<Op>(lhs.node(), rhs.node())); } // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) BinaryOpNode( ExprPtr lhs_v, ExprPtr rhs_v, IRNodeType expr_type, ScalarType ret_type = ScalarType::Undefined) : ExprNode<Op>( // NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage) BinaryOpDtype(lhs_v->dtype(), rhs_v->dtype(), ret_type), expr_type), lhs_(CastIfNeeded(lhs_v, ExprNode<Op>::dtype())), rhs_(CastIfNeeded(rhs_v, ExprNode<Op>::dtype())) {} private: static ExprPtr CastIfNeeded(ExprPtr expr, Dtype dst_dtype) { if (expr->dtype() == dst_dtype) { return expr; } return Cast::make(dst_dtype, ExprHandle(expr)).node(); } ExprPtr lhs_; ExprPtr rhs_; }; namespace detail { template <typename T> void bin_op_deducer(BinaryOpNode<T>); bool bin_op_deducer(...); } // namespace detail class TORCH_API Add : public BinaryOpNode<Add> { public: Add(ExprPtr lhs, ExprPtr rhs) : BinaryOpNode(lhs, rhs, IRNodeType::kAdd) {} }; class TORCH_API Sub : public BinaryOpNode<Sub> { public: Sub(ExprPtr lhs, ExprPtr rhs) : BinaryOpNode(lhs, rhs, IRNodeType::kSub) {} }; class TORCH_API Mul : public BinaryOpNode<Mul> { public: Mul(ExprPtr lhs, ExprPtr rhs) : BinaryOpNode(lhs, rhs, IRNodeType::kMul) {} }; class TORCH_API Div : public BinaryOpNode<Div> { public: Div(ExprPtr lhs, ExprPtr rhs) : BinaryOpNode(lhs, rhs, IRNodeType::kDiv) {} }; class TORCH_API Mod : public BinaryOpNode<Mod> { public: Mod(ExprPtr lhs, ExprPtr rhs) : BinaryOpNode(lhs, rhs, IRNodeType::kMod) {} }; template <typename Op> class BitwiseOpNode : public BinaryOpNode<Op> { public: BitwiseOpNode(ExprPtr lhs, ExprPtr rhs, IRNodeType type) : BinaryOpNode<Op>(lhs, rhs, type) {} static ExprHandle make(const ExprHandle& lhs, const ExprHandle& rhs) { if (!lhs.dtype().is_integral()) { throw unsupported_dtype(); } if (lhs.dtype() != rhs.dtype()) { throw malformed_input("lhs/rhs dtype mismatch"); } return BinaryOpNode<Op>::make(lhs, rhs); } }; class TORCH_API And : public BitwiseOpNode<And> { public: And(ExprPtr lhs, ExprPtr rhs) : BitwiseOpNode(lhs, rhs, IRNodeType::kAnd) {} }; class TORCH_API Or : public BitwiseOpNode<Or> { public: Or(ExprPtr lhs, ExprPtr rhs) : BitwiseOpNode(lhs, rhs, IRNodeType::kOr) {} }; class TORCH_API Xor : public BitwiseOpNode<Xor> { public: Xor(ExprPtr lhs, ExprPtr rhs) : BitwiseOpNode(lhs, rhs, IRNodeType::kXor) {} }; class TORCH_API Lshift : public BitwiseOpNode<Lshift> { public: Lshift(ExprPtr lhs, ExprPtr rhs) : BitwiseOpNode(lhs, rhs, IRNodeType::kLshift) {} }; class TORCH_API Rshift : public BitwiseOpNode<Rshift> { public: Rshift(ExprPtr lhs, ExprPtr rhs) : BitwiseOpNode(lhs, rhs, IRNodeType::kRshift) {} }; // TODO: add TORCH_API // Currently adding it results in a compilation error on Windows class Max : public BinaryOpNode<Max> { private: bool propagate_nans_; public: Max(ExprPtr lhs, ExprPtr rhs, bool propagate_nans) : BinaryOpNode(lhs, rhs, IRNodeType::kMax), propagate_nans_(propagate_nans) {} bool propagate_nans() const { return propagate_nans_; } static ExprHandle make(const ExprHandle& lhs, const ExprHandle& rhs) = delete; static ExprHandle make( const ExprHandle& lhs, const ExprHandle& rhs, bool propagate_nans) { return ExprHandle(alloc<Max>(lhs.node(), rhs.node(), propagate_nans)); } }; // TODO: add TORCH_API // Currently adding it results in a compilation error on Windows class Min : public BinaryOpNode<Min> { private: bool propagate_nans_; public: Min(ExprPtr lhs, ExprPtr rhs, bool propagate_nans) : BinaryOpNode(lhs, rhs, IRNodeType::kMin), propagate_nans_(propagate_nans) {} bool propagate_nans() const { return propagate_nans_; } static ExprHandle make(const ExprHandle& lhs, const ExprHandle& rhs) = delete; static ExprHandle make( const ExprHandle& lhs, const ExprHandle& rhs, bool propagate_nans) { return ExprHandle(alloc<Min>(lhs.node(), rhs.node(), propagate_nans)); } }; // Encode typed immediate values e.g. IntImm, FloatImm. #define IMM_DECLARE(Type, Name) \ class TORCH_API Name##Imm : public ExprNode<Name##Imm> { \ public: \ Name##Imm(Type value) \ : ExprNodeBase(k##Name, kPrimitive), value_(value) {} \ bool isConstant() const override { \ return true; \ } \ Type value() const { \ return value_; \ } \ static ExprHandle make(Type value) { \ return ExprHandle(alloc<Name##Imm>(value)); \ } \ \ private: \ Type value_; \ }; AT_FORALL_SCALAR_TYPES_AND3(Bool, Half, BFloat16, IMM_DECLARE); #undef IMM_DECLARE // Get immediate by ScalarType. template <typename T> ExprPtr getImmediateByType(ScalarType immType, T initialVal) { switch (immType) { #define TYPE_CASE(Type, Name) \ case ScalarType::Name: \ return alloc<Name##Imm>(Type(initialVal)); // NOLINTNEXTLINE(bugprone-branch-clone) AT_FORALL_SCALAR_TYPES_AND3(Bool, Half, BFloat16, TYPE_CASE); #undef TYPE_CASE default: throw unsupported_dtype(); } return nullptr; } template <typename T> ExprPtr getImmediateByType(Dtype dtype, T initialVal) { return getImmediateByType<T>(dtype.scalar_type(), initialVal); } template <typename T> ExprPtr immLike(ExprPtr e, T v) { return getImmediateByType<T>(e->dtype(), v); } template <typename T> ExprPtr immLike(ExprHandle e, T v) { return immLike(e.node(), v); } inline c10::optional<int64_t> intValue(ExprPtr e) { #define TYPE_CASE(Type, Name) \ if (auto v = to<Name##Imm>(e)) { \ return v->value(); \ } AT_FORALL_INT_TYPES(TYPE_CASE); #undef TYPE_CASE return c10::nullopt; } inline c10::optional<int64_t> intValue(ExprHandle e) { return intValue(e.node()); } template <typename T> T immediateAs(ExprPtr e) { #define TYPE_CASE(Type, Name) \ if (Name##ImmPtr imm = to<Name##Imm>(e)) { \ return imm->value(); \ } AT_FORALL_SCALAR_TYPES_AND3(Bool, Half, BFloat16, TYPE_CASE); #undef TYPE_CASE throw unsupported_dtype(); return 0; } template <typename T> T immediateAs(ExprHandle e) { return immediateAs<T>(e.node()); } template <typename T> bool immediateEquals(ExprPtr e, T val) { #define TYPE_CASE(Type, Name) \ if (Name##ImmPtr imm = to<Name##Imm>(e)) { \ return imm->value() == val; \ } AT_FORALL_SCALAR_TYPES_AND3(Bool, Half, BFloat16, TYPE_CASE); #undef TYPE_CASE throw unsupported_dtype(); return false; } TORCH_API bool immediateIsNegative(ExprPtr e); // Represents a ramp vector node: // [base, base + 1 * stride, ... , base + (lanes - 1) * stride] class TORCH_API Ramp : public ExprNode<Ramp> { public: ExprPtr base() const { return base_; } ExprPtr stride() const { return stride_; } void set_base(ExprPtr base) { base_ = base; } void set_stride(ExprPtr stride) { stride_ = stride; } static ExprHandle make( const ExprHandle& base, const ExprHandle& stride, int lanes) { if (stride.dtype() != base.dtype()) { throw malformed_input("Bad stride in Ramp"); } return ExprHandle(alloc<Ramp>(base.node(), stride.node(), lanes)); } int lanes() const { return lanes_; } Ramp(ExprPtr base, ExprPtr stride, int lanes) : ExprNodeBase(Dtype(base->dtype(), lanes)), base_(base), stride_(stride), lanes_(lanes) {} private: ExprPtr base_; ExprPtr stride_; int lanes_; }; class TORCH_API Load : public ExprNode<Load> { public: VarPtr base_handle() const { return buf_->base_handle(); } std::vector<ExprPtr> indices() const { return indices_; } ExprPtr flat_index() const { TORCH_CHECK(indices_.size() == 1, "Indices haven't been flattened."); return indices_[0]; } BufPtr buf() const { return buf_; } void set_buf(BufPtr buf) { buf_ = buf; } void set_indices(std::vector<ExprPtr> indices) { indices_ = indices; } static ExprHandle make( Dtype dtype, const BufHandle& buf, const std::vector<ExprHandle>& indices); static ExprHandle make( const BufHandle& buf, const std::vector<ExprHandle>& indices); Load(Dtype dtype, BufPtr base_handle, std::vector<ExprPtr> indices); Load(BufPtr base_handle, const std::vector<ExprPtr>& indices); private: BufPtr buf_; std::vector<ExprPtr> indices_; }; class TORCH_API Broadcast : public ExprNode<Broadcast> { public: ExprPtr value() const { return value_; } void set_value(ExprPtr value) { value_ = value; } int lanes() const { return lanes_; } static ExprHandle make(const ExprHandle& value, int lanes) { return ExprHandle(alloc<Broadcast>(value.node(), lanes)); } Broadcast(ExprPtr value, int lanes) : ExprNodeBase(Dtype(value->dtype(), lanes)), value_(value), lanes_(lanes) {} private: ExprPtr value_; int lanes_; }; class TORCH_API IfThenElse : public ExprNode<IfThenElse> { public: ExprPtr condition() const { return condition_; } // Lazily evaluated only if condition is true ExprPtr true_value() const { return true_; } // Lazily evaluated only if condition is false ExprPtr false_value() const { return false_; } void set_condition(ExprPtr condition) { condition_ = condition; } void set_true_value(ExprPtr true_value) { true_ = true_value; } void set_false_value(ExprPtr false_value) { false_ = false_value; } static ExprHandle make( const ExprHandle& c, const ExprHandle& t, const ExprHandle& f) { if (!c.dtype().is_integral()) { throw unsupported_dtype(); } if (c.dtype().lanes() != 1) { throw unsupported_dtype(); } if (t.dtype() != f.dtype()) { throw malformed_input("Bad dtype in IfThenElse"); } return ExprHandle(alloc<IfThenElse>(c.node(), t.node(), f.node())); } IfThenElse(ExprPtr c, ExprPtr t, ExprPtr f) : ExprNodeBase(t->dtype()), condition_(c), true_(t), false_(f) {} private: ExprPtr condition_; ExprPtr true_; ExprPtr false_; }; class TORCH_API CompareSelect : public ExprNode<CompareSelect> { public: CompareSelectOperation compare_select_op() const { return compare_op_; } ExprPtr lhs() const { return this->lhs_; } ExprPtr rhs() const { return this->rhs_; } ExprPtr ret_val1() const { return this->ret_val1_; } ExprPtr ret_val2() const { return this->ret_val2_; } void set_lhs(ExprPtr lhs) { lhs_ = lhs; } void set_rhs(ExprPtr rhs) { rhs_ = rhs; } void set_ret_val1(ExprPtr ret_val1) { ret_val1_ = ret_val1; } void set_ret_val2(ExprPtr ret_val2) { ret_val2_ = ret_val2; } CompareSelectBias bias() const { return bias_; } static ExprHandle make( const ExprHandle& lhs, const ExprHandle& rhs, CompareSelectOperation cmp_op, CompareSelectBias bias = kUnbiased) { if (lhs.dtype() != rhs.dtype()) { throw malformed_input("bad dtype in CompareSelect"); } return ExprHandle(alloc<CompareSelect>( lhs.node(), rhs.node(), IntImm::make(1).node(), IntImm::make(0).node(), cmp_op, bias)); } static ExprHandle make( const ExprHandle& lhs, const ExprHandle& rhs, const ExprHandle& ret_val1, const ExprHandle& ret_val2, CompareSelectOperation cmp_op, CompareSelectBias bias = kUnbiased) { if (lhs.dtype() != rhs.dtype() || ret_val1.dtype() != ret_val2.dtype()) { throw malformed_input("bad dtype in CompareSelect"); } return ExprHandle(alloc<CompareSelect>( lhs.node(), rhs.node(), ret_val1.node(), ret_val2.node(), cmp_op, bias)); } CompareSelect( ExprPtr lhs, ExprPtr rhs, ExprPtr ret_val1, ExprPtr ret_val2, CompareSelectOperation cmp_op, CompareSelectBias bias = kUnbiased) : ExprNodeBase(ret_val1->dtype()), lhs_(lhs), rhs_(rhs), ret_val1_(ret_val1), ret_val2_(ret_val2), compare_op_(cmp_op), bias_(bias) {} // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) CompareSelect( ExprPtr lhs, ExprPtr rhs, CompareSelectOperation cmp_op, CompareSelectBias bias = kUnbiased) : ExprNodeBase(kInt), lhs_(lhs), rhs_(rhs), ret_val1_(alloc<IntImm>(1)), ret_val2_(alloc<IntImm>(0)), compare_op_(cmp_op), bias_(bias) {} private: ExprPtr lhs_; ExprPtr rhs_; ExprPtr ret_val1_; ExprPtr ret_val2_; CompareSelectOperation compare_op_; CompareSelectBias bias_; }; enum IntrinsicsOp { kSin, kCos, kTan, kAsin, kAcos, kAtan, kAtan2, kSinh, kCosh, kTanh, kSigmoid, kExp, kExpm1, kAbs, kLog, kLog2, kLog10, kLog1p, kErf, kErfc, kSqrt, kRsqrt, kPow, kCeil, kFloor, kRound, kTrunc, kFmod, kRemainder, kLgamma, kFrac, kIsNan, kRand, // We need more discussions on this. Should we consider stateful? kMaxIntrinsicsOp, }; class TORCH_API Intrinsics : public ExprNode<Intrinsics> { public: static ExprHandle make(IntrinsicsOp op_type, const ExprHandle& v1) { return ExprHandle(alloc<Intrinsics>(op_type, v1.node())); } static ExprHandle make( IntrinsicsOp op_type, const ExprHandle& v1, const ExprHandle& v2) { return ExprHandle(alloc<Intrinsics>(op_type, v1.node(), v2.node())); } static ExprHandle make( IntrinsicsOp op_type, const std::vector<ExprHandle>& params) { // NOLINTNEXTLINE(cppcoreguidelines-init-variables) std::vector<ExprPtr> params_nodes(params.size()); for (size_t i = 0; i < params.size(); i++) { params_nodes[i] = params[i].node(); } return ExprHandle(alloc<Intrinsics>(op_type, params_nodes)); } static ExprHandle make(IntrinsicsOp op_type, Dtype dtype) { return ExprHandle(alloc<Intrinsics>(op_type, dtype)); } IntrinsicsOp op_type() const { return op_type_; } std::string func_name() const { switch (op_type()) { case kSin: return "sin"; case kCos: return "cos"; case kTan: return "tan"; case kAsin: return "asin"; case kAcos: return "acos"; case kAtan: return "atan"; case kAtan2: return "atan2"; case kSinh: return "sinh"; case kCosh: return "cosh"; case kTanh: return "tanh"; case kSigmoid: return "sigmoid"; case kExp: return "exp"; case kAbs: return "abs"; case kLog: return "log"; case kLog2: return "log2"; case kLog10: return "log10"; case kLog1p: return "log1p"; case kErf: return "erf"; case kSqrt: return "sqrt"; case kRsqrt: return "rsqrt"; case kPow: return "pow"; case kCeil: return "ceil"; case kFloor: return "floor"; case kRound: return "round"; case kTrunc: return "trunc"; case kRand: return "rand"; case kFmod: return "fmod"; case kRemainder: return "remainder"; case kLgamma: return "lgamma"; case kExpm1: return "expm1"; case kErfc: return "erfc"; case kFrac: return "frac"; case kIsNan: return "isnan"; default: throw std::runtime_error( "invalid op_type: " + c10::to_string(op_type())); } } // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) Intrinsics(IntrinsicsOp op_type, Dtype dtype) : ExprNodeBase(IntrinsicsDtype(op_type, dtype)), params_({}), op_type_(op_type) { if (OpArgCount(op_type) != 0) { throw malformed_input("bad arg count in Intrinsics"); } } // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) Intrinsics(IntrinsicsOp op_type, ExprPtr v1) : ExprNodeBase(IntrinsicsDtype(op_type, v1->dtype())), params_({v1}), op_type_(op_type) { if (OpArgCount(op_type) != 1) { throw malformed_input("bad arg count in Intrinsics"); } } // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) Intrinsics(IntrinsicsOp op_type, ExprPtr v1, ExprPtr v2) : ExprNodeBase(IntrinsicsDtype(op_type, v1->dtype(), v2->dtype())), params_({v1, v2}), op_type_(op_type) { if (OpArgCount(op_type) != 2) { throw malformed_input("bad arg count in Intrinsics"); } } // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) Intrinsics(IntrinsicsOp op_type, const std::vector<ExprPtr>& params) : ExprNodeBase(IntrinsicsDtype(op_type, params)), params_(params), op_type_(op_type) { if (OpArgCount(op_type) != nparams()) { throw malformed_input("bad arg count in Intrinsics"); } } // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) Intrinsics( IntrinsicsOp op_type, Dtype dtype, const std::vector<ExprPtr>& params) : ExprNodeBase(IntrinsicsDtype(op_type, dtype)), params_(params), op_type_(op_type) { if (OpArgCount(op_type) != nparams()) { throw malformed_input("bad arg count in Intrinsics"); } } bool isPure() const { return op_type_ != kRand; } int nparams() const { return params_.size(); } ExprPtr param(int index) const { return params_[index]; } const std::vector<ExprPtr>& params() const { return params_; } void set_params(std::vector<ExprPtr> params) { params_ = std::move(params); } static int OpArgCount(IntrinsicsOp op_type); private: static Dtype IntrinsicsDtype(IntrinsicsOp op_type, Dtype dt1); static Dtype IntrinsicsDtype(IntrinsicsOp op_type, Dtype dt1, Dtype dt2); static Dtype IntrinsicsDtype( IntrinsicsOp op_type, const std::vector<ExprPtr>& params); std::vector<ExprPtr> params_; IntrinsicsOp op_type_; }; class Polynomial; class Term; class MaxTerm; class MinTerm; TORCH_API std::vector<ExprPtr> ExprHandleVectorToExprVector( const std::vector<ExprHandle>&); TORCH_API std::vector<ExprHandle> ExprVectorToExprHandleVector( const std::vector<ExprPtr>&); TORCH_API std::vector<VarPtr> VarHandleVectorToVarVector( const std::vector<VarHandle>&); TORCH_API std::vector<VarHandle> VarVectorToVarHandleVector( const std::vector<VarPtr>&); TORCH_API ExprPtr flatten_index( const std::vector<ExprPtr>& dims, const std::vector<ExprPtr>& indices); } // namespace tensorexpr } // namespace jit } // namespace torch
[ "facebook-github-bot@users.noreply.github.com" ]
facebook-github-bot@users.noreply.github.com
96d28b2d160e3bbe0f70768e5246931cfc1a5c18
d66bf96db7bf650659fbeed2d535c6c55d1bacbf
/myDB/tool.cpp
de4706109a103596a534b8c6fa9cc0ade80fde54
[]
no_license
136155330/mydb
19dbb8495fcda87a5212fbd7785c3ba16f7fe7d4
adb915b72a04126334b0f3f828317245b334acd2
refs/heads/main
2023-02-02T07:58:39.950856
2020-12-19T15:36:45
2020-12-19T15:36:45
322,878,613
0
0
null
null
null
null
GB18030
C++
false
false
13,864
cpp
#include <algorithm> #include <algorithm> //实现find等方法 #include <string> #include <regex> #include "tool.h" #include "DB.h" using namespace std; string tool::strToUpper(string str) { std::string strTmp = str; transform(strTmp.begin(), strTmp.end(), strTmp.begin(), towupper); return strTmp; } // string.compareNoCase:不区分大小写 bool tool::compareNoCase(std::string strA, const std::string strB) { string str1 = strToUpper(strA); string str2 = strToUpper(strB); return (str1 == str2); } //分割字符串,用在tableService.cpp int tool::split(const string &str, vector<string> &ret_, char sep) { if (str.empty()) { return 0; } string tmp; string::size_type pos_begin = str.find_first_not_of( sep); // 在字符串中查找第一个与str中的字符都不匹配的字符,返回它的位置。搜索从index开始。如果没找到就返回string::nops string::size_type comma_pos = 0; while (pos_begin != string::npos) { comma_pos = str.find(sep, pos_begin); if (comma_pos != string::npos) { tmp = str.substr(pos_begin, comma_pos - pos_begin); pos_begin = comma_pos + 1; } else { tmp = str.substr(pos_begin); pos_begin = comma_pos; } if (!tmp.empty()) { ret_.push_back(tmp); tmp.clear(); } } return 0; } //获取对应属性的位置放到position中(主要功能),返回查询的属性名称(主要是当是*时,返回所有属性) vector<string> tool::GetAttriPosition(Table table, vector<string> attributeName, vector<int> *position) { vector<string> reAttri; vector<Attribute> currentAttributes; vector<Attribute> allAttri = table.attributes; if (attributeName[0] == "*") { //说明查询所有属性 for (int i = 0; i < allAttri.size(); i++) { reAttri.push_back(allAttri[i].name); (*position).push_back(i); } return reAttri; } else { for (int i = 0; i < attributeName.size(); i++) { for (int j = 0; j < allAttri.size(); j++) { if (tool::compareNoCase(attributeName[i], allAttri[j].name)) { position->push_back(j); break; } } } return attributeName; } } vector<string> tool::GetSelectAttri(vector<string> value, vector<int> positions) { vector<string> getValue; int position; for (int i = 0; i < positions.size(); i++) { position = positions[i]; getValue.push_back(*(value.begin() + position)); } return getValue; } //新增 vector<string> tool::opInsert(vector<string> value, vector<int> positions, int length) { vector<string> newValue(length, "NULL");//初始化为length长度为NULL的元素 int position; for (int i = 0; i < positions.size(); i++) { //遍历 position = positions[i]; newValue[position] = value[i]; } return newValue; } string tool::trim(string str) { if (str.empty()) { return str; } str.erase(0, str.find_first_not_of(" ")); str.erase(str.find_last_not_of(" ") + 1); return str; } bool tool::eixtAttri(Table table, vector<string> attrs) { vector<string>::iterator it; vector<Attribute> allAttri = table.attributes; vector<string> allAttriname; //获取表的所有字段名 for (int i = 0; i < allAttri.size(); i++) { allAttriname.push_back(allAttri[i].name); } for (int i = 0; i < attrs.size(); i++) { //遍历attrs 挨个判断是否存在 it = find(allAttriname.begin(), allAttriname.end(), attrs[i]); if (it != allAttriname.end()) { continue; } else { cout << "不存在字段" << attrs[i] << endl; return false; } } return true; } bool tool::eixtTable(DB currentDB, string tablename) { vector<string> allTableName = currentDB.showTables(); vector<string>::iterator it = find(allTableName.begin(), allTableName.end(), tablename); if (it == allTableName.end()) return false; return true; } vector<string> tool::getType(Table table, vector<int> positions) { vector<string> type;//存储属性类型 vector<Attribute> allAttri; allAttri = table.attributes; int position; for (int i = 0; i < positions.size(); i++) { position = positions[i]; type.push_back(allAttri[position].type); } return type; } bool tool::typeExit(string type) { regex e("^char[(](.*?)[)$]", regex_constants::icase); regex e2("^nvarchar[(](.*?)[)$]", regex_constants::icase); smatch sm; if (type == "int" || type == "float" || type == "double" || regex_search(type, sm, e) || regex_search(type, sm, e2)) {//属于能够处理的类型 return true; } else { cout << type << "类型不被支持"; return false; } } bool tool::typeJudge(vector<string> value, vector<string> type) { //匹配char(?) nvarchar(?) int float double regex e("^char[(](.*?)[)$]", regex_constants::icase); regex e2("^nvarchar[(](.*?)[)$]", regex_constants::icase); smatch sm; for (int i = 0; i < type.size(); i++) { istringstream sin(value[i]); //先读value入iss if (type[i] == "int") { int num; string::iterator it; for (it = value[i].begin(); it < value[i].end(); ++it) { if (*it < '0' || *it > '9') { //判断输入的是数字 cout << "第" << i + 1 << "个数据" << value[i] << "的类型为" << type[i] << ",请输入" << type[i] << "类型数据"; return false; } } if (!(sin >> num)) { cout << "超出" << type[i] << "表示范围"; return false; } } else if (type[i] == "float" || type[i] == "double") { float num; string::iterator it; for (it = type[i].begin(); it < type[i].end(); ++it) { if ((*it < '0' && *it > '9') && !(*it == '.')) { //如果不是 数值 和 . 报错 cout << "请输入" << type[i] << "类型数据"; return false; } } if (!(sin >> num)) { cout << "超出" << type[i] << "表示范围"; return false; } } else if (regex_search(type[i], sm, e) || regex_search(type[i], sm, e2)) { int length = value[i].length(); int max = stoi(sm[1]); if (length > max) { cout << "第" << i + 1 << "个数据" << value[i] << "的类型为" << sm[0] << ",长度超长"; return false; } } } return true; } void tool::maxLength(vector<vector<string>> values, vector<int> *colMax) { int max = 0; int tolCol = values[0].size(); //获取总的列数 int tolRow = values.size(); //总列数 int temp; for (int col = 0; col < tolCol; col++) { //列数不变,遍历行 for (int row = 0; row < tolRow; row++) { temp = values[row][col].length(); if (temp > max) { max = temp; } } (*colMax).push_back(max); max = 0; } } vector<vector<string>> tool::descTable(DB currentDB, string tableName) { vector<vector<string>> AttriMessage; //存储返回值,即格式化后的属性信息 vector<Attribute> currentAttris; //存储未格式化的字段信息 Attribute attri; string first[] = {"Field", "Type", "Null", "Key", "Unique"}; vector<string> temp; for (int i = 0; i < first->length(); i++) { //把头标志入容器 temp.push_back(first[i]); } AttriMessage.push_back(temp); for (int i = 0; i < currentDB.tables.size(); i++) { //在DB中查找对应的表 if (tool::compareNoCase(currentDB.tables[i].table_name, tableName)) { currentAttris = currentDB.tables[i].attributes; for (int i = 0; i < currentAttris.size(); i++) { // 遍历说有属性,并格式化 temp.clear(); //清空temp attri = currentAttris[i]; temp.push_back(attri.name); temp.push_back(attri.type); if (attri.is_Not_Null == true) temp.push_back("NO"); else temp.push_back("YES"); if (attri.is_Key == true) temp.push_back("YES"); else temp.push_back(""); if (attri.is_Unique == true) temp.push_back("YES"); else temp.push_back("NO"); AttriMessage.push_back(temp); } } } return AttriMessage; } vector<string> tool::getCol(vector<vector<string>> values, int i) { int rows = values.size(); vector<string> colMessage; //存储一列的信息 for (int row = 0; row < rows; row++) { colMessage.push_back(values[row][i]); } return colMessage; } bool tool::judgeConstraints(vector<string> value, vector<int> positions, Table table) { vector<Attribute> attris = table.attributes; vector<vector<string>> values = table.values; vector<string> colValue; //存储一列的所有信息 int point; //表示要判断的属性的位置 for (int i = 0; i < positions.size(); i++) { point = positions[i]; int flag = 0; //判断满足的个数 // cout<<value[i]<<" "<<point<<" "<<attris[point].name<<endl; if (attris[point].is_Not_Null == true) { //判断是否为空值NULL if (value[i] == "NULL") { cout<<"值"<<value[i]<<"不满足非空约束"; return false; } } if (attris[point].is_Unique == true) { //判断值是否重复 //1.获取该列的所有值 colValue = tool::getCol(values, point); //find 查找是否存在重复 vector<string>::iterator it = find(colValue.begin(), colValue.end(), value[i]); if (it != colValue.end()) { cout<<"值"<<value[i]<<"不满足Unique约束"; return false; } } if (attris[point].is_Key == true) { //没有return false 说明满足前面两个条件,返回true return true; } return true; } } /* 备用 vector<string> Interpreter::split(const string &s, const string &seperator) { vector<string> result; typedef string::size_type string_size; string_size i = 0; while (i != s.size()) { //找到字符串中首个不等于分隔符的字母; int flag = 0; while (i != s.size() && flag == 0) { flag = 1; for (string_size x = 0; x < seperator.size(); ++x) if (s[i] == seperator[x]) { ++i; flag = 0; break; } } //找到又一个分隔符,将两个分隔符之间的字符串取出; flag = 0; string_size j = i; while (j != s.size() && flag == 0) { for (string_size x = 0; x < seperator.size(); ++x) if (s[j] == seperator[x]) { flag = 1; break; } if (flag == 0) ++j; } if (i != j) { result.push_back(s.substr(i, j - i)); i = j; } } return result; }*/ /* //CREATE_TB pattern = "^CREATE{1}.{1,}TABLE{1} {1,}.{1,} {1,}(.*)"; if (regex_match(sql, pattern)) { params.push_back("CREATE_TB"); //提取表名 tbName int id = sql.find("TABLE"); int id2 =sql.find("("); string subs = sql.substr(id+6, id2-(id+6)); params.push_back(subs); //提取()中的部分 int id3 = sql.find(");"); sql = sql.substr(id2+1, id3-(id2+1)); vector<string> allParams; tool::split(sql,allParams,','); for(vector<string>::size_type i=0; i<allParams.size(); i++){ string tmpStr = allParams[i]; vector<string> tmpParams; tool::split(tmpStr,tmpParams,' '); //字段名 params.push_back(tmpParams[0]); //字段类型 params.push_back(tmpParams[1]); //约束类型 if(tmpStr.find("PRIMARY KEY")!=string::npos){ params.push_back("PRIMARY_KEY"); }else if(tmpStr.find("NOT NULL")!=string::npos){ params.push_back("NOT_NULL"); }else if(tmpStr.find("UNIQUE")!=string::npos){ params.push_back("UNIQUE"); }else{ params.push_back("EMPTY"); } } }*/ /* // INSERT pattern = "^INSERT{1} {1,}INTO .{1,}VALUES(.{0,})+"; if (regex_match(sql, pattern)) { int id = sql.find("INTO"); int id2 = sql.find("VALUES") - 1; string subs = "INSERT"; params.push_back(subs); subs = sql.substr(id + 5, id2 - (id + 5)); params.push_back(subs); // 取出')'和'('和 ','在字符串中的下标,方便后面提取参数 vector<int> ids; for (string::size_type i = 0; i < sql.size(); i++) { if (sql.at(i) == '(' || sql.at(i) == ')' || sql.at(i) == ',') { ids.push_back(i); } } // 提取参数 for (int i = 1; i < ids.size(); i++) { subs = sql.substr(ids[i - 1] + 1, ids[i] - (ids[i - 1] + 1)); params.push_back(subs); } }*/
[ "noreply@github.com" ]
noreply@github.com
2b7b09c2ba3c6fe64e379d00fad15d465e0ff3b8
012f0800c635f23d069f0c400768bc58cc1a0574
/hhvm/hhvm-3.17/third-party/thrift/src/thrift/lib/cpp2/test/CompactProtocolBench.cpp
4e5c234aeb1017985029fdab6c98909ee1acee04
[ "Apache-2.0", "Zend-2.0", "BSD-3-Clause", "PHP-3.01" ]
permissive
chrispcx/es-hhvm
c127840387ee17789840ea788e308b711d3986a1
220fd9627b1b168271112d33747a233a91e8a268
refs/heads/master
2021-01-11T18:13:42.713724
2017-02-07T02:02:10
2017-02-07T02:02:10
79,519,670
5
0
null
null
null
null
UTF-8
C++
false
false
4,965
cpp
/* * Copyright 2014 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <thrift/lib/cpp2/protocol/CompactProtocol.h> #include <thrift/lib/cpp2/test/gen-cpp2/CompactProtocolBenchData_types.h> #include <iostream> #include <vector> #include <gflags/gflags.h> #include <glog/logging.h> #include <folly/Benchmark.h> #include <folly/Format.h> #include <folly/Optional.h> #include <thrift/lib/cpp2/protocol/Serializer.h> using namespace std; using namespace folly;; using namespace apache::thrift; using namespace ::cpp2; const size_t kMultExp = 0; Shallow makeShallow() { Shallow data; data.one = 750; data.two = 750 << 22; return data; } Deep makeDeep(size_t triplesz) { Deep data; for (size_t i = 0; i < 16; ++i) { Deep1 data1; for (size_t j = 0; j < 16; ++j) { Deep2 data2; for (size_t k = 0; k < 16; ++k) { data2.datas.push_back(sformat("omg[{}, {}, {}]", i, j, k)); } data1.deeps.push_back(move(data2)); } data.deeps.push_back(move(data1)); } return data; } BENCHMARK(CompactProtocolReader_ctor, kiters) { BenchmarkSuspender braces; size_t iters = kiters << kMultExp; vector<Optional<CompactProtocolReader>> protos(iters); braces.dismiss(); while (iters--) { protos[iters].emplace(); } braces.rehire(); } BENCHMARK(CompactProtocolReader_dtor, kiters) { BenchmarkSuspender braces; size_t iters = kiters << kMultExp; vector<Optional<CompactProtocolReader>> protos(iters); for (auto& proto : protos) { proto.emplace(); } braces.dismiss(); while (iters--) { protos[iters].clear(); } braces.rehire(); } BENCHMARK(CompactProtocolWriter_ctor, kiters) { BenchmarkSuspender braces; size_t iters = kiters << kMultExp; vector<Optional<CompactProtocolWriter>> protos(iters); braces.dismiss(); while (iters--) { protos[iters].emplace(); } braces.rehire(); } BENCHMARK(CompactProtocolWriter_dtor, kiters) { BenchmarkSuspender braces; size_t iters = kiters << kMultExp; vector<Optional<CompactProtocolWriter>> protos(iters); for (auto& proto : protos) { proto.emplace(); } braces.dismiss(); while (iters--) { protos[iters].clear(); } braces.rehire(); } BENCHMARK(CompactProtocolReader_deserialize_empty, kiters) { BenchmarkSuspender braces; size_t iters = kiters << kMultExp; Empty data; CompactSerializer ser; IOBufQueue bufq; ser.serialize(data, &bufq); auto buf = bufq.move(); braces.dismiss(); while (iters--) { CompactSerializer s; Empty empty; s.deserialize(buf.get(), empty); } braces.rehire(); } BENCHMARK(CompactProtocolWriter_serialize_empty, kiters) { BenchmarkSuspender braces; size_t iters = kiters << kMultExp; Empty data; braces.dismiss(); while (iters--) { CompactSerializer ser; IOBufQueue bufq; ser.serialize(data, &bufq); } braces.rehire(); } BENCHMARK(CompactProtocolReader_deserialize_shallow, kiters) { BenchmarkSuspender braces; size_t iters = kiters << kMultExp; Shallow data = makeShallow(); CompactSerializer ser; IOBufQueue bufq; ser.serialize(data, &bufq); auto buf = bufq.move(); braces.dismiss(); while (iters--) { CompactSerializer s; Deep data; s.deserialize(buf.get(), data); } braces.rehire(); } BENCHMARK(CompactProtocolWriter_serialize_shallow, kiters) { BenchmarkSuspender braces; size_t iters = kiters << kMultExp; Shallow data = makeShallow(); braces.dismiss(); while (iters--) { CompactSerializer ser; IOBufQueue bufq; ser.serialize(data, &bufq); } braces.rehire(); } BENCHMARK(CompactProtocolReader_deserialize_deep, kiters) { BenchmarkSuspender braces; size_t iters = kiters << kMultExp; Deep data = makeDeep(16); CompactSerializer ser; IOBufQueue bufq; ser.serialize(data, &bufq); auto buf = bufq.move(); braces.dismiss(); while (iters--) { CompactSerializer s; Deep deep; s.deserialize(buf.get(), deep); } braces.rehire(); } BENCHMARK(CompactProtocolWriter_serialize_deep, kiters) { BenchmarkSuspender braces; size_t iters = kiters << kMultExp; Deep data = makeDeep(16); braces.dismiss(); while (iters--) { CompactSerializer ser; IOBufQueue bufq; ser.serialize(data, &bufq); } braces.rehire(); } int main(int argc, char** argv) { gflags::ParseCommandLineFlags(&argc, &argv, true); google::InitGoogleLogging(argv[0]); runBenchmarks(); return 0; }
[ "peiqiang@huawei.com" ]
peiqiang@huawei.com
5514800d1cb0e37505cca1b39908271b2f1baa11
921670cd7c992e41cb498c19cf1d4928cb20269d
/Project/Bag.cpp
6f62f80b54a52c4d302e544c6900287fc1375e60
[]
no_license
AndreaHabib/CSC326
15fa1e5940887abefb829833d689bcb2cd2ce04e
04075dda07e1d93243a3f9acebc15d8b4df796ab
refs/heads/master
2022-11-17T00:09:04.910365
2020-07-03T21:29:46
2020-07-03T21:29:46
255,419,232
0
0
null
null
null
null
UTF-8
C++
false
false
3,120
cpp
// Created by Frank M. Carrano and Tim Henry. // Copyright (c) 2016 __Pearson Education__. All rights reserved. /** @file Bag.cpp (same as ArrayBag) */ #include "Bag.h" #include <cstddef> #include <tuple> //using namespace std; template<class ItemType> Bag<ItemType>::Bag() : itemCount(0), maxItems(DEFAULT_BAG_SIZE) { } // end default constructor template<class ItemType> int Bag<ItemType>::getCurrentSize() const { return itemCount; } // end getCurrentSize template<class ItemType> bool Bag<ItemType>::isEmpty() const { return itemCount == 0; } // end isEmpty template<class ItemType> bool Bag<ItemType>::add(const ItemType& newEntry) { bool hasRoomToAdd = (itemCount < maxItems); if (hasRoomToAdd) { items[itemCount] = newEntry; itemCount++; } // end if return hasRoomToAdd; } // end add template<class ItemType> bool Bag<ItemType>::remove(const ItemType& anEntry) { int locatedIndex = getIndexOf(anEntry); bool canRemoveItem = !isEmpty() && (locatedIndex > -1); if (canRemoveItem) { itemCount--; items[locatedIndex] = items[itemCount]; } // end if return canRemoveItem; } // end remove template<class ItemType> void Bag<ItemType>::clear() { itemCount = 0; } // end clear template<class ItemType> int Bag<ItemType>::getFrequencyOf(const ItemType& anEntry) const { int frequency = 0; int searchIndex = 0; while (searchIndex < itemCount) { if (items[searchIndex] == anEntry) { frequency++; } // end if searchIndex++; } // end while return frequency; } // end getFrequencyOf template<class ItemType> bool Bag<ItemType>::contains(const ItemType& anEntry) const { return getIndexOf(anEntry) > -1; } // end contains /* ALTERNATE 1 template<class ItemType> bool Bag<ItemType>::contains(const ItemType& anEntry) const { return getFrequencyOf(anEntry) > 0; } // end contains */ /* ALTERNATE 2 template<class ItemType> bool Bag<ItemType>::contains(const ItemType& anEntry) const { bool found = false; for (int i = 0; !found && (i < itemCount); i++) { if (anEntry == items[i]) { found = true; } // end if } // end for return found; } // end contains */ template<class ItemType> std::vector<ItemType> Bag<ItemType>::toVector() const { std::vector<ItemType> bagContents; for (int i = 0; i < itemCount; i++) bagContents.push_back(items[i]); return bagContents; } // end toVector // private template<class ItemType> int Bag<ItemType>::getIndexOf(const ItemType& target) const { bool found = false; int result = -1; int searchIndex = 0; // if the bag is empty, itemCount is zero, so loop is skipped while (!found && (searchIndex < itemCount)) { if (items[searchIndex] == target) { found = true; result = searchIndex; } else { searchIndex++; } // end if } // end while return result; } // end getIndexOf template<class ItemType> void Bag<ItemType>::displayBagContents() { for (int i = 0; i < itemCount; i++) { cout << items[i] << endl; } }
[ "noreply@github.com" ]
noreply@github.com
40f412f7cac2644fde480c4417345ec5c43a97c1
b1394bfee6ede11243b3db93b5f1101c72396be5
/src/inspector/v8-debugger.cc
4aaf5592c7bc03824b9994a84b7475feaa1fcc46
[ "BSD-3-Clause", "bzip2-1.0.6", "SunPro" ]
permissive
clone123/v8
a1e9d0432e98fdccc3fb326e7188415c596d6bc6
42d8a1d89b4ea52ba654fc831c1454aa4844dc73
refs/heads/master
2020-07-23T19:39:00.913166
2016-11-15T07:42:55
2016-11-15T07:43:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
38,875
cc
// Copyright 2016 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/inspector/v8-debugger.h" #include "src/inspector/debugger-script.h" #include "src/inspector/protocol/Protocol.h" #include "src/inspector/script-breakpoint.h" #include "src/inspector/string-util.h" #include "src/inspector/v8-debugger-agent-impl.h" #include "src/inspector/v8-inspector-impl.h" #include "src/inspector/v8-internal-value-type.h" #include "src/inspector/v8-stack-trace-impl.h" #include "src/inspector/v8-value-copier.h" #include "include/v8-util.h" namespace v8_inspector { namespace { static const char v8AsyncTaskEventEnqueue[] = "enqueue"; static const char v8AsyncTaskEventEnqueueRecurring[] = "enqueueRecurring"; static const char v8AsyncTaskEventWillHandle[] = "willHandle"; static const char v8AsyncTaskEventDidHandle[] = "didHandle"; static const char v8AsyncTaskEventCancel[] = "cancel"; inline v8::Local<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) { return value ? v8::True(isolate) : v8::False(isolate); } } // namespace static bool inLiveEditScope = false; v8::MaybeLocal<v8::Value> V8Debugger::callDebuggerMethod( const char* functionName, int argc, v8::Local<v8::Value> argv[]) { v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); DCHECK(m_isolate->InContext()); v8::Local<v8::Context> context = m_isolate->GetCurrentContext(); v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( debuggerScript ->Get(context, toV8StringInternalized(m_isolate, functionName)) .ToLocalChecked()); return function->Call(context, debuggerScript, argc, argv); } V8Debugger::V8Debugger(v8::Isolate* isolate, V8InspectorImpl* inspector) : m_isolate(isolate), m_inspector(inspector), m_lastContextId(0), m_enableCount(0), m_breakpointsActivated(true), m_runningNestedMessageLoop(false), m_ignoreScriptParsedEventsCounter(0), m_maxAsyncCallStackDepth(0), m_pauseOnExceptionsState(v8::DebugInterface::NoBreakOnException) {} V8Debugger::~V8Debugger() {} void V8Debugger::enable() { if (m_enableCount++) return; DCHECK(!enabled()); v8::HandleScope scope(m_isolate); v8::DebugInterface::SetDebugEventListener(m_isolate, &V8Debugger::v8DebugEventCallback, v8::External::New(m_isolate, this)); m_debuggerContext.Reset(m_isolate, v8::DebugInterface::GetDebugContext(m_isolate)); v8::DebugInterface::ChangeBreakOnException( m_isolate, v8::DebugInterface::NoBreakOnException); m_pauseOnExceptionsState = v8::DebugInterface::NoBreakOnException; compileDebuggerScript(); } void V8Debugger::disable() { if (--m_enableCount) return; DCHECK(enabled()); clearBreakpoints(); m_debuggerScript.Reset(); m_debuggerContext.Reset(); allAsyncTasksCanceled(); v8::DebugInterface::SetDebugEventListener(m_isolate, nullptr); } bool V8Debugger::enabled() const { return !m_debuggerScript.IsEmpty(); } // static int V8Debugger::contextId(v8::Local<v8::Context> context) { v8::Local<v8::Value> data = context->GetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex)); if (data.IsEmpty() || !data->IsString()) return 0; String16 dataString = toProtocolString(data.As<v8::String>()); if (dataString.isEmpty()) return 0; size_t commaPos = dataString.find(","); if (commaPos == String16::kNotFound) return 0; size_t commaPos2 = dataString.find(",", commaPos + 1); if (commaPos2 == String16::kNotFound) return 0; return dataString.substring(commaPos + 1, commaPos2 - commaPos - 1) .toInteger(); } // static int V8Debugger::getGroupId(v8::Local<v8::Context> context) { v8::Local<v8::Value> data = context->GetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex)); if (data.IsEmpty() || !data->IsString()) return 0; String16 dataString = toProtocolString(data.As<v8::String>()); if (dataString.isEmpty()) return 0; size_t commaPos = dataString.find(","); if (commaPos == String16::kNotFound) return 0; return dataString.substring(0, commaPos).toInteger(); } void V8Debugger::getCompiledScripts( int contextGroupId, std::vector<std::unique_ptr<V8DebuggerScript>>& result) { v8::HandleScope scope(m_isolate); v8::PersistentValueVector<v8::DebugInterface::Script> scripts(m_isolate); v8::DebugInterface::GetLoadedScripts(m_isolate, scripts); String16 contextPrefix = String16::fromInteger(contextGroupId) + ","; for (size_t i = 0; i < scripts.Size(); ++i) { v8::Local<v8::DebugInterface::Script> script = scripts.Get(i); if (!script->WasCompiled()) continue; v8::ScriptOriginOptions origin = script->OriginOptions(); if (origin.IsEmbedderDebugScript()) continue; v8::Local<v8::String> v8ContextData; if (!script->ContextData().ToLocal(&v8ContextData)) continue; String16 contextData = toProtocolString(v8ContextData); if (contextData.find(contextPrefix) != 0) continue; result.push_back( wrapUnique(new V8DebuggerScript(m_isolate, script, false))); } } String16 V8Debugger::setBreakpoint(const String16& sourceID, const ScriptBreakpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber) { v8::HandleScope scope(m_isolate); v8::Local<v8::Context> context = debuggerContext(); v8::Context::Scope contextScope(context); v8::Local<v8::Object> info = v8::Object::New(m_isolate); bool success = false; success = info->Set(context, toV8StringInternalized(m_isolate, "sourceID"), toV8String(m_isolate, sourceID)) .FromMaybe(false); DCHECK(success); success = info->Set(context, toV8StringInternalized(m_isolate, "lineNumber"), v8::Integer::New(m_isolate, scriptBreakpoint.lineNumber)) .FromMaybe(false); DCHECK(success); success = info->Set(context, toV8StringInternalized(m_isolate, "columnNumber"), v8::Integer::New(m_isolate, scriptBreakpoint.columnNumber)) .FromMaybe(false); DCHECK(success); success = info->Set(context, toV8StringInternalized(m_isolate, "condition"), toV8String(m_isolate, scriptBreakpoint.condition)) .FromMaybe(false); DCHECK(success); v8::Local<v8::Function> setBreakpointFunction = v8::Local<v8::Function>::Cast( m_debuggerScript.Get(m_isolate) ->Get(context, toV8StringInternalized(m_isolate, "setBreakpoint")) .ToLocalChecked()); v8::Local<v8::Value> breakpointId = v8::DebugInterface::Call(debuggerContext(), setBreakpointFunction, info) .ToLocalChecked(); if (!breakpointId->IsString()) return ""; *actualLineNumber = info->Get(context, toV8StringInternalized(m_isolate, "lineNumber")) .ToLocalChecked() ->Int32Value(context) .FromJust(); *actualColumnNumber = info->Get(context, toV8StringInternalized(m_isolate, "columnNumber")) .ToLocalChecked() ->Int32Value(context) .FromJust(); return toProtocolString(breakpointId.As<v8::String>()); } void V8Debugger::removeBreakpoint(const String16& breakpointId) { v8::HandleScope scope(m_isolate); v8::Local<v8::Context> context = debuggerContext(); v8::Context::Scope contextScope(context); v8::Local<v8::Object> info = v8::Object::New(m_isolate); bool success = false; success = info->Set(context, toV8StringInternalized(m_isolate, "breakpointId"), toV8String(m_isolate, breakpointId)) .FromMaybe(false); DCHECK(success); v8::Local<v8::Function> removeBreakpointFunction = v8::Local<v8::Function>::Cast( m_debuggerScript.Get(m_isolate) ->Get(context, toV8StringInternalized(m_isolate, "removeBreakpoint")) .ToLocalChecked()); v8::DebugInterface::Call(debuggerContext(), removeBreakpointFunction, info) .ToLocalChecked(); } void V8Debugger::clearBreakpoints() { v8::HandleScope scope(m_isolate); v8::Local<v8::Context> context = debuggerContext(); v8::Context::Scope contextScope(context); v8::Local<v8::Function> clearBreakpoints = v8::Local<v8::Function>::Cast( m_debuggerScript.Get(m_isolate) ->Get(context, toV8StringInternalized(m_isolate, "clearBreakpoints")) .ToLocalChecked()); v8::DebugInterface::Call(debuggerContext(), clearBreakpoints) .ToLocalChecked(); } void V8Debugger::setBreakpointsActivated(bool activated) { if (!enabled()) { UNREACHABLE(); return; } v8::HandleScope scope(m_isolate); v8::Local<v8::Context> context = debuggerContext(); v8::Context::Scope contextScope(context); v8::Local<v8::Object> info = v8::Object::New(m_isolate); bool success = false; success = info->Set(context, toV8StringInternalized(m_isolate, "enabled"), v8::Boolean::New(m_isolate, activated)) .FromMaybe(false); DCHECK(success); v8::Local<v8::Function> setBreakpointsActivated = v8::Local<v8::Function>::Cast( m_debuggerScript.Get(m_isolate) ->Get(context, toV8StringInternalized(m_isolate, "setBreakpointsActivated")) .ToLocalChecked()); v8::DebugInterface::Call(debuggerContext(), setBreakpointsActivated, info) .ToLocalChecked(); m_breakpointsActivated = activated; } v8::DebugInterface::ExceptionBreakState V8Debugger::getPauseOnExceptionsState() { DCHECK(enabled()); return m_pauseOnExceptionsState; } void V8Debugger::setPauseOnExceptionsState( v8::DebugInterface::ExceptionBreakState pauseOnExceptionsState) { DCHECK(enabled()); if (m_pauseOnExceptionsState == pauseOnExceptionsState) return; v8::DebugInterface::ChangeBreakOnException(m_isolate, pauseOnExceptionsState); m_pauseOnExceptionsState = pauseOnExceptionsState; } void V8Debugger::setPauseOnNextStatement(bool pause) { if (m_runningNestedMessageLoop) return; if (pause) v8::DebugInterface::DebugBreak(m_isolate); else v8::DebugInterface::CancelDebugBreak(m_isolate); } bool V8Debugger::canBreakProgram() { if (!m_breakpointsActivated) return false; return m_isolate->InContext(); } void V8Debugger::breakProgram() { if (isPaused()) { DCHECK(!m_runningNestedMessageLoop); v8::Local<v8::Value> exception; v8::Local<v8::Array> hitBreakpoints; handleProgramBreak(m_pausedContext, m_executionState, exception, hitBreakpoints); return; } if (!canBreakProgram()) return; v8::HandleScope scope(m_isolate); v8::Local<v8::Function> breakFunction; if (!v8::Function::New(m_isolate->GetCurrentContext(), &V8Debugger::breakProgramCallback, v8::External::New(m_isolate, this), 0, v8::ConstructorBehavior::kThrow) .ToLocal(&breakFunction)) return; v8::DebugInterface::Call(debuggerContext(), breakFunction).ToLocalChecked(); } void V8Debugger::continueProgram() { if (isPaused()) m_inspector->client()->quitMessageLoopOnPause(); m_pausedContext.Clear(); m_executionState.Clear(); } void V8Debugger::stepIntoStatement() { DCHECK(isPaused()); DCHECK(!m_executionState.IsEmpty()); v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepIn); continueProgram(); } void V8Debugger::stepOverStatement() { DCHECK(isPaused()); DCHECK(!m_executionState.IsEmpty()); v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepNext); continueProgram(); } void V8Debugger::stepOutOfFunction() { DCHECK(isPaused()); DCHECK(!m_executionState.IsEmpty()); v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepOut); continueProgram(); } void V8Debugger::clearStepping() { DCHECK(enabled()); v8::DebugInterface::ClearStepping(m_isolate); } Response V8Debugger::setScriptSource( const String16& sourceID, v8::Local<v8::String> newSource, bool dryRun, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails, JavaScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged, bool* compileError) { class EnableLiveEditScope { public: explicit EnableLiveEditScope(v8::Isolate* isolate) : m_isolate(isolate) { v8::DebugInterface::SetLiveEditEnabled(m_isolate, true); inLiveEditScope = true; } ~EnableLiveEditScope() { v8::DebugInterface::SetLiveEditEnabled(m_isolate, false); inLiveEditScope = false; } private: v8::Isolate* m_isolate; }; *compileError = false; DCHECK(enabled()); v8::HandleScope scope(m_isolate); std::unique_ptr<v8::Context::Scope> contextScope; if (!isPaused()) contextScope = wrapUnique(new v8::Context::Scope(debuggerContext())); v8::Local<v8::Value> argv[] = {toV8String(m_isolate, sourceID), newSource, v8Boolean(dryRun, m_isolate)}; v8::Local<v8::Value> v8result; { EnableLiveEditScope enableLiveEditScope(m_isolate); v8::TryCatch tryCatch(m_isolate); tryCatch.SetVerbose(false); v8::MaybeLocal<v8::Value> maybeResult = callDebuggerMethod("liveEditScriptSource", 3, argv); if (tryCatch.HasCaught()) { v8::Local<v8::Message> message = tryCatch.Message(); if (!message.IsEmpty()) return Response::Error(toProtocolStringWithTypeCheck(message->Get())); else return Response::InternalError(); } v8result = maybeResult.ToLocalChecked(); } DCHECK(!v8result.IsEmpty()); v8::Local<v8::Context> context = m_isolate->GetCurrentContext(); v8::Local<v8::Object> resultTuple = v8result->ToObject(context).ToLocalChecked(); int code = static_cast<int>(resultTuple->Get(context, 0) .ToLocalChecked() ->ToInteger(context) .ToLocalChecked() ->Value()); switch (code) { case 0: { *stackChanged = resultTuple->Get(context, 1) .ToLocalChecked() ->BooleanValue(context) .FromJust(); // Call stack may have changed after if the edited function was on the // stack. if (!dryRun && isPaused()) { JavaScriptCallFrames frames = currentCallFrames(); newCallFrames->swap(frames); } return Response::OK(); } // Compile error. case 1: { *exceptionDetails = protocol::Runtime::ExceptionDetails::create() .setExceptionId(m_inspector->nextExceptionId()) .setText(toProtocolStringWithTypeCheck( resultTuple->Get(context, 2).ToLocalChecked())) .setLineNumber(static_cast<int>(resultTuple->Get(context, 3) .ToLocalChecked() ->ToInteger(context) .ToLocalChecked() ->Value()) - 1) .setColumnNumber(static_cast<int>(resultTuple->Get(context, 4) .ToLocalChecked() ->ToInteger(context) .ToLocalChecked() ->Value()) - 1) .build(); *compileError = true; return Response::OK(); } } return Response::InternalError(); } JavaScriptCallFrames V8Debugger::currentCallFrames(int limit) { if (!m_isolate->InContext()) return JavaScriptCallFrames(); v8::Local<v8::Value> currentCallFramesV8; if (m_executionState.IsEmpty()) { v8::Local<v8::Function> currentCallFramesFunction = v8::Local<v8::Function>::Cast( m_debuggerScript.Get(m_isolate) ->Get(debuggerContext(), toV8StringInternalized(m_isolate, "currentCallFrames")) .ToLocalChecked()); currentCallFramesV8 = v8::DebugInterface::Call(debuggerContext(), currentCallFramesFunction, v8::Integer::New(m_isolate, limit)) .ToLocalChecked(); } else { v8::Local<v8::Value> argv[] = {m_executionState, v8::Integer::New(m_isolate, limit)}; currentCallFramesV8 = callDebuggerMethod("currentCallFrames", arraysize(argv), argv) .ToLocalChecked(); } DCHECK(!currentCallFramesV8.IsEmpty()); if (!currentCallFramesV8->IsArray()) return JavaScriptCallFrames(); v8::Local<v8::Array> callFramesArray = currentCallFramesV8.As<v8::Array>(); JavaScriptCallFrames callFrames; for (uint32_t i = 0; i < callFramesArray->Length(); ++i) { v8::Local<v8::Value> callFrameValue; if (!callFramesArray->Get(debuggerContext(), i).ToLocal(&callFrameValue)) return JavaScriptCallFrames(); if (!callFrameValue->IsObject()) return JavaScriptCallFrames(); v8::Local<v8::Object> callFrameObject = callFrameValue.As<v8::Object>(); callFrames.push_back(JavaScriptCallFrame::create( debuggerContext(), v8::Local<v8::Object>::Cast(callFrameObject))); } return callFrames; } static V8Debugger* toV8Debugger(v8::Local<v8::Value> data) { void* p = v8::Local<v8::External>::Cast(data)->Value(); return static_cast<V8Debugger*>(p); } void V8Debugger::breakProgramCallback( const v8::FunctionCallbackInfo<v8::Value>& info) { DCHECK_EQ(info.Length(), 2); V8Debugger* thisPtr = toV8Debugger(info.Data()); if (!thisPtr->enabled()) return; v8::Local<v8::Context> pausedContext = thisPtr->m_isolate->GetCurrentContext(); v8::Local<v8::Value> exception; v8::Local<v8::Array> hitBreakpoints; thisPtr->handleProgramBreak(pausedContext, v8::Local<v8::Object>::Cast(info[0]), exception, hitBreakpoints); } void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext, v8::Local<v8::Object> executionState, v8::Local<v8::Value> exception, v8::Local<v8::Array> hitBreakpointNumbers, bool isPromiseRejection, bool isUncaught) { // Don't allow nested breaks. if (m_runningNestedMessageLoop) return; V8DebuggerAgentImpl* agent = m_inspector->enabledDebuggerAgentForGroup(getGroupId(pausedContext)); if (!agent) return; std::vector<String16> breakpointIds; if (!hitBreakpointNumbers.IsEmpty()) { breakpointIds.reserve(hitBreakpointNumbers->Length()); for (uint32_t i = 0; i < hitBreakpointNumbers->Length(); i++) { v8::Local<v8::Value> hitBreakpointNumber = hitBreakpointNumbers->Get(debuggerContext(), i).ToLocalChecked(); DCHECK(hitBreakpointNumber->IsInt32()); breakpointIds.push_back(String16::fromInteger( hitBreakpointNumber->Int32Value(debuggerContext()).FromJust())); } } m_pausedContext = pausedContext; m_executionState = executionState; V8DebuggerAgentImpl::SkipPauseRequest result = agent->didPause( pausedContext, exception, breakpointIds, isPromiseRejection, isUncaught); if (result == V8DebuggerAgentImpl::RequestNoSkip) { m_runningNestedMessageLoop = true; int groupId = getGroupId(pausedContext); DCHECK(groupId); m_inspector->client()->runMessageLoopOnPause(groupId); // The agent may have been removed in the nested loop. agent = m_inspector->enabledDebuggerAgentForGroup(getGroupId(pausedContext)); if (agent) agent->didContinue(); m_runningNestedMessageLoop = false; } m_pausedContext.Clear(); m_executionState.Clear(); if (result == V8DebuggerAgentImpl::RequestStepFrame) { v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepFrame); } else if (result == V8DebuggerAgentImpl::RequestStepInto) { v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepIn); } else if (result == V8DebuggerAgentImpl::RequestStepOut) { v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepOut); } } void V8Debugger::v8DebugEventCallback( const v8::DebugInterface::EventDetails& eventDetails) { V8Debugger* thisPtr = toV8Debugger(eventDetails.GetCallbackData()); thisPtr->handleV8DebugEvent(eventDetails); } v8::Local<v8::Value> V8Debugger::callInternalGetterFunction( v8::Local<v8::Object> object, const char* functionName) { v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::Local<v8::Value> getterValue = object ->Get(m_isolate->GetCurrentContext(), toV8StringInternalized(m_isolate, functionName)) .ToLocalChecked(); DCHECK(!getterValue.IsEmpty() && getterValue->IsFunction()); return v8::Local<v8::Function>::Cast(getterValue) ->Call(m_isolate->GetCurrentContext(), object, 0, 0) .ToLocalChecked(); } void V8Debugger::handleV8DebugEvent( const v8::DebugInterface::EventDetails& eventDetails) { if (!enabled()) return; v8::DebugEvent event = eventDetails.GetEvent(); if (event != v8::AsyncTaskEvent && event != v8::Break && event != v8::Exception && event != v8::AfterCompile && event != v8::BeforeCompile && event != v8::CompileError) return; v8::Local<v8::Context> eventContext = eventDetails.GetEventContext(); DCHECK(!eventContext.IsEmpty()); if (event == v8::AsyncTaskEvent) { v8::HandleScope scope(m_isolate); handleV8AsyncTaskEvent(eventContext, eventDetails.GetExecutionState(), eventDetails.GetEventData()); return; } V8DebuggerAgentImpl* agent = m_inspector->enabledDebuggerAgentForGroup(getGroupId(eventContext)); if (agent) { v8::HandleScope scope(m_isolate); if (m_ignoreScriptParsedEventsCounter == 0 && (event == v8::AfterCompile || event == v8::CompileError)) { v8::Local<v8::Context> context = debuggerContext(); v8::Context::Scope contextScope(context); v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()}; v8::Local<v8::Value> value = callDebuggerMethod("getAfterCompileScript", 1, argv).ToLocalChecked(); if (value->IsNull()) return; DCHECK(value->IsObject()); v8::Local<v8::Object> scriptObject = v8::Local<v8::Object>::Cast(value); v8::Local<v8::DebugInterface::Script> script; if (!v8::DebugInterface::Script::Wrap(m_isolate, scriptObject) .ToLocal(&script)) return; agent->didParseSource( wrapUnique(new V8DebuggerScript(m_isolate, script, inLiveEditScope)), event == v8::AfterCompile); } else if (event == v8::Exception) { v8::Local<v8::Context> context = debuggerContext(); v8::Local<v8::Object> eventData = eventDetails.GetEventData(); v8::Local<v8::Value> exception = callInternalGetterFunction(eventData, "exception"); v8::Local<v8::Value> promise = callInternalGetterFunction(eventData, "promise"); bool isPromiseRejection = !promise.IsEmpty() && promise->IsObject(); v8::Local<v8::Value> uncaught = callInternalGetterFunction(eventData, "uncaught"); bool isUncaught = uncaught->BooleanValue(context).FromJust(); handleProgramBreak(eventContext, eventDetails.GetExecutionState(), exception, v8::Local<v8::Array>(), isPromiseRejection, isUncaught); } else if (event == v8::Break) { v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()}; v8::Local<v8::Value> hitBreakpoints = callDebuggerMethod("getBreakpointNumbers", 1, argv).ToLocalChecked(); DCHECK(hitBreakpoints->IsArray()); handleProgramBreak(eventContext, eventDetails.GetExecutionState(), v8::Local<v8::Value>(), hitBreakpoints.As<v8::Array>()); } } } void V8Debugger::handleV8AsyncTaskEvent(v8::Local<v8::Context> context, v8::Local<v8::Object> executionState, v8::Local<v8::Object> eventData) { if (!m_maxAsyncCallStackDepth) return; String16 type = toProtocolStringWithTypeCheck( callInternalGetterFunction(eventData, "type")); String16 name = toProtocolStringWithTypeCheck( callInternalGetterFunction(eventData, "name")); int id = static_cast<int>(callInternalGetterFunction(eventData, "id") ->ToInteger(context) .ToLocalChecked() ->Value()); // Async task events from Promises are given misaligned pointers to prevent // from overlapping with other Blink task identifiers. There is a single // namespace of such ids, managed by src/js/promise.js. void* ptr = reinterpret_cast<void*>(id * 2 + 1); if (type == v8AsyncTaskEventEnqueue) asyncTaskScheduled(name, ptr, false); else if (type == v8AsyncTaskEventEnqueueRecurring) asyncTaskScheduled(name, ptr, true); else if (type == v8AsyncTaskEventWillHandle) asyncTaskStarted(ptr); else if (type == v8AsyncTaskEventDidHandle) asyncTaskFinished(ptr); else if (type == v8AsyncTaskEventCancel) asyncTaskCanceled(ptr); else UNREACHABLE(); } V8StackTraceImpl* V8Debugger::currentAsyncCallChain() { if (!m_currentStacks.size()) return nullptr; return m_currentStacks.back().get(); } void V8Debugger::compileDebuggerScript() { if (!m_debuggerScript.IsEmpty()) { UNREACHABLE(); return; } v8::HandleScope scope(m_isolate); v8::Context::Scope contextScope(debuggerContext()); v8::Local<v8::String> scriptValue = v8::String::NewFromUtf8(m_isolate, DebuggerScript_js, v8::NewStringType::kInternalized, sizeof(DebuggerScript_js)) .ToLocalChecked(); v8::Local<v8::Value> value; if (!m_inspector->compileAndRunInternalScript(debuggerContext(), scriptValue) .ToLocal(&value)) { UNREACHABLE(); return; } DCHECK(value->IsObject()); m_debuggerScript.Reset(m_isolate, value.As<v8::Object>()); } v8::Local<v8::Context> V8Debugger::debuggerContext() const { DCHECK(!m_debuggerContext.IsEmpty()); return m_debuggerContext.Get(m_isolate); } v8::MaybeLocal<v8::Value> V8Debugger::functionScopes( v8::Local<v8::Context> context, v8::Local<v8::Function> function) { if (!enabled()) { UNREACHABLE(); return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate)); } v8::Local<v8::Value> argv[] = {function}; v8::Local<v8::Value> scopesValue; if (!callDebuggerMethod("getFunctionScopes", 1, argv).ToLocal(&scopesValue)) return v8::MaybeLocal<v8::Value>(); v8::Local<v8::Value> copied; if (!copyValueFromDebuggerContext(m_isolate, debuggerContext(), context, scopesValue) .ToLocal(&copied) || !copied->IsArray()) return v8::MaybeLocal<v8::Value>(); if (!markAsInternal(context, v8::Local<v8::Array>::Cast(copied), V8InternalValueType::kScopeList)) return v8::MaybeLocal<v8::Value>(); if (!markArrayEntriesAsInternal(context, v8::Local<v8::Array>::Cast(copied), V8InternalValueType::kScope)) return v8::MaybeLocal<v8::Value>(); return copied; } v8::MaybeLocal<v8::Array> V8Debugger::internalProperties( v8::Local<v8::Context> context, v8::Local<v8::Value> value) { v8::Local<v8::Array> properties; if (!v8::DebugInterface::GetInternalProperties(m_isolate, value) .ToLocal(&properties)) return v8::MaybeLocal<v8::Array>(); if (value->IsFunction()) { v8::Local<v8::Function> function = value.As<v8::Function>(); v8::Local<v8::Value> location = functionLocation(context, function); if (location->IsObject()) { createDataProperty( context, properties, properties->Length(), toV8StringInternalized(m_isolate, "[[FunctionLocation]]")); createDataProperty(context, properties, properties->Length(), location); } if (function->IsGeneratorFunction()) { createDataProperty(context, properties, properties->Length(), toV8StringInternalized(m_isolate, "[[IsGenerator]]")); createDataProperty(context, properties, properties->Length(), v8::True(m_isolate)); } } if (!enabled()) return properties; if (value->IsMap() || value->IsWeakMap() || value->IsSet() || value->IsWeakSet() || value->IsSetIterator() || value->IsMapIterator()) { v8::Local<v8::Value> entries = collectionEntries(context, v8::Local<v8::Object>::Cast(value)); if (entries->IsArray()) { createDataProperty(context, properties, properties->Length(), toV8StringInternalized(m_isolate, "[[Entries]]")); createDataProperty(context, properties, properties->Length(), entries); } } if (value->IsGeneratorObject()) { v8::Local<v8::Value> location = generatorObjectLocation(context, v8::Local<v8::Object>::Cast(value)); if (location->IsObject()) { createDataProperty( context, properties, properties->Length(), toV8StringInternalized(m_isolate, "[[GeneratorLocation]]")); createDataProperty(context, properties, properties->Length(), location); } } if (value->IsFunction()) { v8::Local<v8::Function> function = value.As<v8::Function>(); v8::Local<v8::Value> boundFunction = function->GetBoundFunction(); v8::Local<v8::Value> scopes; if (boundFunction->IsUndefined() && functionScopes(context, function).ToLocal(&scopes)) { createDataProperty(context, properties, properties->Length(), toV8StringInternalized(m_isolate, "[[Scopes]]")); createDataProperty(context, properties, properties->Length(), scopes); } } return properties; } v8::Local<v8::Value> V8Debugger::collectionEntries( v8::Local<v8::Context> context, v8::Local<v8::Object> object) { if (!enabled()) { UNREACHABLE(); return v8::Undefined(m_isolate); } v8::Local<v8::Value> argv[] = {object}; v8::Local<v8::Value> entriesValue = callDebuggerMethod("getCollectionEntries", 1, argv).ToLocalChecked(); if (!entriesValue->IsArray()) return v8::Undefined(m_isolate); v8::Local<v8::Array> entries = entriesValue.As<v8::Array>(); v8::Local<v8::Array> copiedArray = v8::Array::New(m_isolate, entries->Length()); if (!copiedArray->SetPrototype(context, v8::Null(m_isolate)).FromMaybe(false)) return v8::Undefined(m_isolate); for (uint32_t i = 0; i < entries->Length(); ++i) { v8::Local<v8::Value> item; if (!entries->Get(debuggerContext(), i).ToLocal(&item)) return v8::Undefined(m_isolate); v8::Local<v8::Value> copied; if (!copyValueFromDebuggerContext(m_isolate, debuggerContext(), context, item) .ToLocal(&copied)) return v8::Undefined(m_isolate); if (!createDataProperty(context, copiedArray, i, copied).FromMaybe(false)) return v8::Undefined(m_isolate); } if (!markArrayEntriesAsInternal(context, v8::Local<v8::Array>::Cast(copiedArray), V8InternalValueType::kEntry)) return v8::Undefined(m_isolate); return copiedArray; } v8::Local<v8::Value> V8Debugger::generatorObjectLocation( v8::Local<v8::Context> context, v8::Local<v8::Object> object) { if (!enabled()) { UNREACHABLE(); return v8::Null(m_isolate); } v8::Local<v8::Value> argv[] = {object}; v8::Local<v8::Value> location = callDebuggerMethod("getGeneratorObjectLocation", 1, argv) .ToLocalChecked(); v8::Local<v8::Value> copied; if (!copyValueFromDebuggerContext(m_isolate, debuggerContext(), context, location) .ToLocal(&copied) || !copied->IsObject()) return v8::Null(m_isolate); if (!markAsInternal(context, v8::Local<v8::Object>::Cast(copied), V8InternalValueType::kLocation)) return v8::Null(m_isolate); return copied; } v8::Local<v8::Value> V8Debugger::functionLocation( v8::Local<v8::Context> context, v8::Local<v8::Function> function) { int scriptId = function->ScriptId(); if (scriptId == v8::UnboundScript::kNoScriptId) return v8::Null(m_isolate); int lineNumber = function->GetScriptLineNumber(); int columnNumber = function->GetScriptColumnNumber(); if (lineNumber == v8::Function::kLineOffsetNotFound || columnNumber == v8::Function::kLineOffsetNotFound) return v8::Null(m_isolate); v8::Local<v8::Object> location = v8::Object::New(m_isolate); if (!location->SetPrototype(context, v8::Null(m_isolate)).FromMaybe(false)) return v8::Null(m_isolate); if (!createDataProperty( context, location, toV8StringInternalized(m_isolate, "scriptId"), toV8String(m_isolate, String16::fromInteger(scriptId))) .FromMaybe(false)) return v8::Null(m_isolate); if (!createDataProperty(context, location, toV8StringInternalized(m_isolate, "lineNumber"), v8::Integer::New(m_isolate, lineNumber)) .FromMaybe(false)) return v8::Null(m_isolate); if (!createDataProperty(context, location, toV8StringInternalized(m_isolate, "columnNumber"), v8::Integer::New(m_isolate, columnNumber)) .FromMaybe(false)) return v8::Null(m_isolate); if (!markAsInternal(context, location, V8InternalValueType::kLocation)) return v8::Null(m_isolate); return location; } bool V8Debugger::isPaused() { return !m_pausedContext.IsEmpty(); } std::unique_ptr<V8StackTraceImpl> V8Debugger::createStackTrace( v8::Local<v8::StackTrace> stackTrace) { int contextGroupId = m_isolate->InContext() ? getGroupId(m_isolate->GetCurrentContext()) : 0; return V8StackTraceImpl::create(this, contextGroupId, stackTrace, V8StackTraceImpl::maxCallStackSizeToCapture); } int V8Debugger::markContext(const V8ContextInfo& info) { DCHECK(info.context->GetIsolate() == m_isolate); int contextId = ++m_lastContextId; String16 debugData = String16::fromInteger(info.contextGroupId) + "," + String16::fromInteger(contextId) + "," + toString16(info.auxData); v8::Context::Scope contextScope(info.context); info.context->SetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex), toV8String(m_isolate, debugData)); return contextId; } void V8Debugger::setAsyncCallStackDepth(V8DebuggerAgentImpl* agent, int depth) { if (depth <= 0) m_maxAsyncCallStackDepthMap.erase(agent); else m_maxAsyncCallStackDepthMap[agent] = depth; int maxAsyncCallStackDepth = 0; for (const auto& pair : m_maxAsyncCallStackDepthMap) { if (pair.second > maxAsyncCallStackDepth) maxAsyncCallStackDepth = pair.second; } if (m_maxAsyncCallStackDepth == maxAsyncCallStackDepth) return; m_maxAsyncCallStackDepth = maxAsyncCallStackDepth; if (!maxAsyncCallStackDepth) allAsyncTasksCanceled(); } void V8Debugger::asyncTaskScheduled(const StringView& taskName, void* task, bool recurring) { if (!m_maxAsyncCallStackDepth) return; asyncTaskScheduled(toString16(taskName), task, recurring); } void V8Debugger::asyncTaskScheduled(const String16& taskName, void* task, bool recurring) { if (!m_maxAsyncCallStackDepth) return; v8::HandleScope scope(m_isolate); int contextGroupId = m_isolate->InContext() ? getGroupId(m_isolate->GetCurrentContext()) : 0; std::unique_ptr<V8StackTraceImpl> chain = V8StackTraceImpl::capture( this, contextGroupId, V8StackTraceImpl::maxCallStackSizeToCapture, taskName); if (chain) { m_asyncTaskStacks[task] = std::move(chain); if (recurring) m_recurringTasks.insert(task); } } void V8Debugger::asyncTaskCanceled(void* task) { if (!m_maxAsyncCallStackDepth) return; m_asyncTaskStacks.erase(task); m_recurringTasks.erase(task); } void V8Debugger::asyncTaskStarted(void* task) { if (!m_maxAsyncCallStackDepth) return; m_currentTasks.push_back(task); AsyncTaskToStackTrace::iterator stackIt = m_asyncTaskStacks.find(task); // Needs to support following order of events: // - asyncTaskScheduled // <-- attached here --> // - asyncTaskStarted // - asyncTaskCanceled <-- canceled before finished // <-- async stack requested here --> // - asyncTaskFinished std::unique_ptr<V8StackTraceImpl> stack; if (stackIt != m_asyncTaskStacks.end() && stackIt->second) stack = stackIt->second->cloneImpl(); m_currentStacks.push_back(std::move(stack)); } void V8Debugger::asyncTaskFinished(void* task) { if (!m_maxAsyncCallStackDepth) return; // We could start instrumenting half way and the stack is empty. if (!m_currentStacks.size()) return; DCHECK(m_currentTasks.back() == task); m_currentTasks.pop_back(); m_currentStacks.pop_back(); if (m_recurringTasks.find(task) == m_recurringTasks.end()) m_asyncTaskStacks.erase(task); } void V8Debugger::allAsyncTasksCanceled() { m_asyncTaskStacks.clear(); m_recurringTasks.clear(); m_currentStacks.clear(); m_currentTasks.clear(); } void V8Debugger::muteScriptParsedEvents() { ++m_ignoreScriptParsedEventsCounter; } void V8Debugger::unmuteScriptParsedEvents() { --m_ignoreScriptParsedEventsCounter; DCHECK_GE(m_ignoreScriptParsedEventsCounter, 0); } std::unique_ptr<V8StackTraceImpl> V8Debugger::captureStackTrace( bool fullStack) { if (!m_isolate->InContext()) return nullptr; v8::HandleScope handles(m_isolate); int contextGroupId = getGroupId(m_isolate->GetCurrentContext()); if (!contextGroupId) return nullptr; size_t stackSize = fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; return V8StackTraceImpl::capture(this, contextGroupId, stackSize); } } // namespace v8_inspector
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
7d88d2d468c2d0c07564cfdc3760b75a1abc513f
44b8de15789f4e9df4569e72de426bff9fee63aa
/Assignment/ass3cpp.cpp
8cc43e06fa0bde339eae82af83e23eab738df5b2
[]
no_license
justbert/Cpp-Class
3eac2f5718c3cff841593f8925f088784ed55b8c
10e7d8c8521f10626d0957412cb0a72b009ac181
refs/heads/master
2021-07-13T04:03:40.946524
2017-10-09T14:22:01
2017-10-09T14:22:01
106,292,902
0
0
null
null
null
null
UTF-8
C++
false
false
744
cpp
#include <iostream> #include "FleaBay.h" using namespace std; int main(void) { bool bRunning = true; char id[256]; char response; FleaBay e; while (bRunning) { cout << "\nPlease enter your choice" << endl; cout << "1. FleaBay Login" << endl; cout << "2. FleaBay Report" << endl; cout << "3. Report an Account" << endl; cout << "4. Quit" << endl; cin >> response; cin.ignore(256, '\n'); switch (response) { case '1': if (!e.Login()) return 1; break; case '2': cout << e; break; case '3': cout << "please enter the account id: "; cin.getline(id, 256, '\n'); cout << e[id]; break; case '4': bRunning = false; break; default: cout << "invalid choice"; } } return 0; }
[ "justin.m.bertrand@gmail.com" ]
justin.m.bertrand@gmail.com
1706d97ddb203499f1db364a594aef560c9a86f3
824c937769f09aa2da69a10cc8ca5490af34d3ea
/src/map_loader/AdapterDriver.cpp
d10a006900aa1162da938cd17237a35f3e5b2f16
[]
no_license
DYu24/Warzone
2aed8bca3300f2f77fd74350c98711b2b9306fa6
7d4fbebd8476136836c4259c6480e54b768a1d56
refs/heads/master
2023-02-26T18:53:29.855480
2020-12-01T00:06:10
2020-12-01T00:06:10
296,401,714
0
0
null
null
null
null
UTF-8
C++
false
false
940
cpp
#include "../game_engine/GameEngine.h" #include "MapLoader.h" int main() { // Load a Domination map std::cout << "----- LOADING DOMINATION MAP: CANADA -----" << std::endl; MapLoader* dominationMapLoader = new MapLoader(); Map* domination = dominationMapLoader->loadMap("resources/canada.map"); std::cout << *domination << "\n" << std::endl; // Load a Conquest map std::cout << "----- LOADING CONQUEST MAP: ASIA -----" << std::endl; MapLoader* conquestMapLoader = new ConquestFileReaderAdapter(); Map* conquest = conquestMapLoader->loadMap("resources/Asia.map"); std::cout << *conquest << "\n" << std::endl; // Selecting from game menu GameEngine* gameEngine = new GameEngine(); gameEngine->startGame(); delete dominationMapLoader; delete conquestMapLoader; delete domination; delete conquest; delete gameEngine; GameEngine::resetGameEngine(); return 0; }
[ "derekyu624@hotmail.com" ]
derekyu624@hotmail.com
8c9964e3853185615eda0317d617292fdee50507
a044fb7b27b8e7467bc6fefa67903e7c6120437b
/484.cpp
bf7f106254a1df269cb6eff180ea2f5a8c2c4111
[]
no_license
chaitanyav/UVA
1d9265c9794c69917d3ad0fbc10a8342310e0a86
7382b14975330e1b2defcd746e9ebbd104480cea
refs/heads/master
2016-09-05T17:06:47.943520
2015-07-11T18:44:54
2015-07-11T18:44:54
14,007,628
1
0
null
null
null
null
UTF-8
C++
false
false
540
cpp
#include <iostream> #include <map> #include <algorithm> #include <vector> int main(int argc, char *argv[]) { int num; std::map<int, int> frequencyByNum; std::vector<int> nums; while(std::cin >> num) { if(frequencyByNum.find(num) == frequencyByNum.end()) { frequencyByNum[num] = 1; nums.push_back(num); } else { frequencyByNum[num] = frequencyByNum[num] + 1; } } for(std::vector<int>::iterator it = nums.begin(); it != nums.end(); it++) { std::cout << *it << " " << frequencyByNum[*it] << std::endl; } return 0; }
[ "me@chaitanyavellanki.com" ]
me@chaitanyavellanki.com
bc5d2e8cf58a3c933a70db7cb67d80e50c4e2d69
62c856d2593c7b017e813030e9b65723d68e928a
/ColacX_Game_000/WindowListener.h
243518a8652dab53407d52858025cdbd0459c219
[]
no_license
ColacX/ColacX_Game_000
5e66bd458a01b613b612710aa2375ffcbffffcb6
525bf8544d8917b884878f9f361e8043c07682cb
refs/heads/master
2020-04-06T04:22:11.681873
2013-04-17T18:53:26
2013-04-17T18:53:26
3,048,669
0
0
null
null
null
null
UTF-8
C++
false
false
206
h
#pragma once #include <Windows.h> class WindowListener { protected: WindowListener(); public: virtual void WindowListenerNotifiy( HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam ) = 0; };
[ "ColacX@hotmail.com" ]
ColacX@hotmail.com
070c25e9698babad3a20659805ccf0e75f32b339
4eb4242f67eb54c601885461bac58b648d91d561
/third_part/indri5.6/NetworkServerProxy.hpp
04801aee8e4ff55f12fe70a33eac590e46127655
[]
no_license
biebipan/coding
630c873ecedc43a9a8698c0f51e26efb536dabd1
7709df7e979f2deb5401d835d0e3b119a7cd88d8
refs/heads/master
2022-01-06T18:52:00.969411
2018-07-18T04:30:02
2018-07-18T04:30:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,105
hpp
/*========================================================================== * Copyright (c) 2004 University of Massachusetts. All Rights Reserved. * * Use of the Lemur Toolkit for Language Modeling and Information Retrieval * is subject to the terms of the software license set forth in the LICENSE * file included with this software, and also available at * http://www.lemurproject.org/license.html * *========================================================================== */ // // NetworkServerProxy // // 23 March 2004 -- tds // #ifndef INDRI_NETWORKSERVERPROXY_HPP #define INDRI_NETWORKSERVERPROXY_HPP #include "XMLNode.hpp" #include "XMLWriter.hpp" #include "QueryResponseUnpacker.hpp" #include "QueryServer.hpp" #include "Packer.hpp" #include "NetworkMessageStream.hpp" #include "Buffer.hpp" namespace indri { namespace server { class NetworkServerProxy : public QueryServer { private: indri::net::NetworkMessageStream* _stream; INT64 _numericRequest( indri::xml::XMLNode* node ); std::string _stringRequest( indri::xml::XMLNode* node ); public: NetworkServerProxy( indri::net::NetworkMessageStream* stream ); QueryServerResponse* runQuery( std::vector<indri::lang::Node*>& roots, int resultsRequested, bool optimize ); QueryServerDocumentsResponse* documents( const std::vector<lemur::api::DOCID_T>& documentIDs ); QueryServerMetadataResponse* documentMetadata( const std::vector<lemur::api::DOCID_T>& documentIDs, const std::string& attributeName ); QueryServerDocumentIDsResponse* documentIDsFromMetadata( const std::string& attributeName, const std::vector<std::string>& attributeValues ); QueryServerDocumentsResponse* documentsFromMetadata( const std::string& attributeName, const std::vector<std::string>& attributeValues ); QueryServerMetadataResponse* pathNames( const std::vector<lemur::api::DOCID_T>& documentIDs, const std::vector<int>& pathBegins, const std::vector<int>& pathEnds ); // terms -- implemented (but not on stub) INT64 termCount(); INT64 termCount( int term ); INT64 termCount( const std::string& term ); INT64 termCountUnique( ); INT64 stemCount( const std::string& stem ); std::string termName( lemur::api::TERMID_T term ); lemur::api::TERMID_T termID( const std::string& term ); std::string stemTerm(const std::string &term); // fields std::vector<std::string> fieldList(); // unimpl INT64 termFieldCount( const std::string& term, const std::string& field ); INT64 stemFieldCount( const std::string& stem, const std::string& field ); // documents int documentLength( lemur::api::DOCID_T documentID ); INT64 documentCount(); INT64 documentCount( const std::string& term ); INT64 documentStemCount( const std::string& term ); // document vector QueryServerVectorsResponse* documentVectors( const std::vector<lemur::api::DOCID_T>& documentIDs ); void setMaxWildcardTerms(int maxTerms); }; } } #endif // INDRI_NETWORKSERVERPROXY_HPP
[ "guoliqiang2006@126.com" ]
guoliqiang2006@126.com
cfb8413a3ae2013ccce4397c0c9e0306b067c597
1dbf007249acad6038d2aaa1751cbde7e7842c53
/ecs/include/huaweicloud/ecs/v2/model/PostPaidServerDataVolume.h
d3dc6295f1ee67943fa30550b8f259e818a6390d
[]
permissive
huaweicloud/huaweicloud-sdk-cpp-v3
24fc8d93c922598376bdb7d009e12378dff5dd20
71674f4afbb0cd5950f880ec516cfabcde71afe4
refs/heads/master
2023-08-04T19:37:47.187698
2023-08-03T08:25:43
2023-08-03T08:25:43
324,328,641
11
10
Apache-2.0
2021-06-24T07:25:26
2020-12-25T09:11:43
C++
UTF-8
C++
false
false
6,141
h
#ifndef HUAWEICLOUD_SDK_ECS_V2_MODEL_PostPaidServerDataVolume_H_ #define HUAWEICLOUD_SDK_ECS_V2_MODEL_PostPaidServerDataVolume_H_ #include <huaweicloud/ecs/v2/EcsExport.h> #include <huaweicloud/core/utils/ModelBase.h> #include <huaweicloud/core/http/HttpResponse.h> #include <huaweicloud/ecs/v2/model/PostPaidServerDataVolumeMetadata.h> #include <huaweicloud/ecs/v2/model/PostPaidServerDataVolumeExtendParam.h> #include <string> namespace HuaweiCloud { namespace Sdk { namespace Ecs { namespace V2 { namespace Model { using namespace HuaweiCloud::Sdk::Core::Utils; using namespace HuaweiCloud::Sdk::Core::Http; /// <summary> /// 云服务器对应数据盘相关配置。 /// </summary> class HUAWEICLOUD_ECS_V2_EXPORT PostPaidServerDataVolume : public ModelBase { public: PostPaidServerDataVolume(); virtual ~PostPaidServerDataVolume(); ///////////////////////////////////////////// /// ModelBase overrides void validate() override; web::json::value toJson() const override; bool fromJson(const web::json::value& json) override; ///////////////////////////////////////////// /// PostPaidServerDataVolume members /// <summary> /// 云服务器数据盘对应的磁盘类型,需要与系统所提供的磁盘类型相匹配。 磁盘类型枚举值: - SATA:普通IO磁盘类型。 - SAS:高IO磁盘类型。 - SSD:超高IO磁盘类型。 - co-p1:高IO (性能优化Ⅰ型) - uh-l1:超高IO (时延优化)磁盘类型。 &gt; 说明: &gt; &gt; 对于HANA云服务器、HL1型云服务器、HL2型云服务器,需使用co-p1和uh-l1两种磁盘类型。对于其他类型的云服务器,不能使用co-p1和uh-l1两种磁盘类型。 /// </summary> std::string getVolumetype() const; bool volumetypeIsSet() const; void unsetvolumetype(); void setVolumetype(const std::string& value); /// <summary> /// 数据盘大小,容量单位为GB,输入大小范围为[10,32768]。 /// </summary> int32_t getSize() const; bool sizeIsSet() const; void unsetsize(); void setSize(int32_t value); /// <summary> /// 是否为共享磁盘。true为共享盘,false为普通云硬盘。 &gt; 说明: &gt; &gt; 该字段已废弃,请使用multiattach。 /// </summary> bool isShareable() const; bool shareableIsSet() const; void unsetshareable(); void setShareable(bool value); /// <summary> /// 创建共享磁盘的信息。 - true:创建的磁盘为共享盘。 - false:创建的磁盘为普通云硬盘。 &gt; 说明: &gt; &gt; shareable当前为废弃字段,如果确实需要同时使用shareable字段和multiattach字段,此时,请确保两个字段的参数值相同。当不指定该字段时,系统默认创建普通云硬盘。 /// </summary> bool isMultiattach() const; bool multiattachIsSet() const; void unsetmultiattach(); void setMultiattach(bool value); /// <summary> /// 数据卷是否使用SCSI锁。 - true表示云硬盘的设备类型为SCSI类型,即允许ECS操作系统直接访问底层存储介质。支持SCSI锁命令。 - false表示云硬盘的设备类型为VBD (虚拟块存储设备 , Virtual Block Device)类型,即为默认类型,VBD只能支持简单的SCSI读写命令。 - 该字段不存在时,云硬盘默认为VBD类型。 &gt; 说明: &gt; &gt; 此参数为boolean类型,若传入非boolean类型字符,程序将按照【false】方式处理。 /// </summary> bool isHwpassthrough() const; bool hwpassthroughIsSet() const; void unsethwpassthrough(); void setHwpassthrough(bool value); /// <summary> /// /// </summary> PostPaidServerDataVolumeExtendParam getExtendparam() const; bool extendparamIsSet() const; void unsetextendparam(); void setExtendparam(const PostPaidServerDataVolumeExtendParam& value); /// <summary> /// 云服务器数据盘对应的磁盘存储类型。 磁盘存储类型枚举值: DSS:专属存储类型 /// </summary> std::string getClusterType() const; bool clusterTypeIsSet() const; void unsetclusterType(); void setClusterType(const std::string& value); /// <summary> /// 云服务器数据盘对应的存储池的ID。 /// </summary> std::string getClusterId() const; bool clusterIdIsSet() const; void unsetclusterId(); void setClusterId(const std::string& value); /// <summary> /// /// </summary> PostPaidServerDataVolumeMetadata getMetadata() const; bool metadataIsSet() const; void unsetmetadata(); void setMetadata(const PostPaidServerDataVolumeMetadata& value); /// <summary> /// 数据镜像的ID,UUID格式。 如果使用数据盘镜像创建数据盘,则data_image_id为必选参数,且不支持使用metadata。 /// </summary> std::string getDataImageId() const; bool dataImageIdIsSet() const; void unsetdataImageId(); void setDataImageId(const std::string& value); /// <summary> /// 数据盘随实例释放策略。 true:数据盘随实例释放。 false:数据盘不随实例释放。 默认值:false。 /// </summary> bool isDeleteOnTermination() const; bool deleteOnTerminationIsSet() const; void unsetdeleteOnTermination(); void setDeleteOnTermination(bool value); protected: std::string volumetype_; bool volumetypeIsSet_; int32_t size_; bool sizeIsSet_; bool shareable_; bool shareableIsSet_; bool multiattach_; bool multiattachIsSet_; bool hwpassthrough_; bool hwpassthroughIsSet_; PostPaidServerDataVolumeExtendParam extendparam_; bool extendparamIsSet_; std::string clusterType_; bool clusterTypeIsSet_; std::string clusterId_; bool clusterIdIsSet_; PostPaidServerDataVolumeMetadata metadata_; bool metadataIsSet_; std::string dataImageId_; bool dataImageIdIsSet_; bool deleteOnTermination_; bool deleteOnTerminationIsSet_; }; } } } } } #endif // HUAWEICLOUD_SDK_ECS_V2_MODEL_PostPaidServerDataVolume_H_
[ "hwcloudsdk@huawei.com" ]
hwcloudsdk@huawei.com
bd5503051d8e5764ed830ffa42b8822bbb116183
6861ababd3572292d5d718b496f8e20e33cfa1e0
/deps/asio/asio/ip/tcp.hpp
b7c47fa275161d99584af300239a8a08dd277510
[ "BSL-1.0" ]
permissive
tscmoo/tsc-bw
e6d973c425147f071102e0bc3d8b930b5292e5c7
a9baf0a7775bdf44fafe2757526245950c6725dc
refs/heads/master
2020-04-05T23:41:36.565984
2017-06-01T10:42:29
2017-06-01T10:42:29
28,708,148
39
4
null
null
null
null
UTF-8
C++
false
false
3,551
hpp
// // ip/tcp.hpp // ~~~~~~~~~~ // // Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef ASIO_IP_TCP_HPP #define ASIO_IP_TCP_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "../detail/config.hpp" #include "../basic_socket_acceptor.hpp" #include "../basic_socket_iostream.hpp" #include "../basic_stream_socket.hpp" #include "../detail/socket_option.hpp" #include "../detail/socket_types.hpp" #include "./basic_endpoint.hpp" #include "./basic_resolver.hpp" #include "./basic_resolver_iterator.hpp" #include "./basic_resolver_query.hpp" #include "../detail/push_options.hpp" namespace asio { namespace ip { /// Encapsulates the flags needed for TCP. /** * The asio::ip::tcp class contains flags necessary for TCP sockets. * * @par Thread Safety * @e Distinct @e objects: Safe.@n * @e Shared @e objects: Safe. * * @par Concepts: * Protocol, InternetProtocol. */ class tcp { public: /// The type of a TCP endpoint. typedef basic_endpoint<tcp> endpoint; /// Construct to represent the IPv4 TCP protocol. static tcp v4() { return tcp(ASIO_OS_DEF(AF_INET)); } /// Construct to represent the IPv6 TCP protocol. static tcp v6() { return tcp(ASIO_OS_DEF(AF_INET6)); } /// Obtain an identifier for the type of the protocol. int type() const { return ASIO_OS_DEF(SOCK_STREAM); } /// Obtain an identifier for the protocol. int protocol() const { return ASIO_OS_DEF(IPPROTO_TCP); } /// Obtain an identifier for the protocol family. int family() const { return family_; } /// The TCP socket type. typedef basic_stream_socket<tcp> socket; /// The TCP acceptor type. typedef basic_socket_acceptor<tcp> acceptor; /// The TCP resolver type. typedef basic_resolver<tcp> resolver; #if !defined(ASIO_NO_IOSTREAM) /// The TCP iostream type. typedef basic_socket_iostream<tcp> iostream; #endif // !defined(ASIO_NO_IOSTREAM) /// Socket option for disabling the Nagle algorithm. /** * Implements the IPPROTO_TCP/TCP_NODELAY socket option. * * @par Examples * Setting the option: * @code * asio::ip::tcp::socket socket(io_service); * ... * asio::ip::tcp::no_delay option(true); * socket.set_option(option); * @endcode * * @par * Getting the current option value: * @code * asio::ip::tcp::socket socket(io_service); * ... * asio::ip::tcp::no_delay option; * socket.get_option(option); * bool is_set = option.value(); * @endcode * * @par Concepts: * Socket_Option, Boolean_Socket_Option. */ #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined no_delay; #else typedef asio::detail::socket_option::boolean< ASIO_OS_DEF(IPPROTO_TCP), ASIO_OS_DEF(TCP_NODELAY)> no_delay; #endif /// Compare two protocols for equality. friend bool operator==(const tcp& p1, const tcp& p2) { return p1.family_ == p2.family_; } /// Compare two protocols for inequality. friend bool operator!=(const tcp& p1, const tcp& p2) { return p1.family_ != p2.family_; } private: // Construct with a specific family. explicit tcp(int protocol_family) : family_(protocol_family) { } int family_; }; } // namespace ip } // namespace asio #include "../detail/pop_options.hpp" #endif // ASIO_IP_TCP_HPP
[ "the.dengus@gmail.com" ]
the.dengus@gmail.com
fdf003edaa6dfd2bf42fec9aa8b205f10c9c1e56
aaaac089e323221e91352f366c3e0b91b51f59f9
/generate_n_Parenthesis_Sequences.cpp
b14e23f7be5acb854af80c7b2d65d6dca7c3a8af
[]
no_license
wondermax13/AlgorithmicProblems
c223215d2a45ab6ded8f2839164b2bc51246d79f
41655735f93f078300ee9ececb0e41b39fcf0d95
refs/heads/master
2021-01-24T13:19:37.398828
2018-04-24T05:07:58
2018-04-24T05:07:58
123,170,742
0
0
null
null
null
null
UTF-8
C++
false
false
990
cpp
class Solution { public: vector<string> generateParenthesis(int n) { vector<string> words; string curr; bt(curr, words, 0, 0, n); return words; } //We are traversing through a grid here. //From corner to corner different paths are taken //but we can only move either to the bottom or to the right //But we can't move more to the right (')') than we have downwards('(') void bt(string& curr, vector<string>& words, int left, int right, int n) { if(curr.size() == 2*n) { words.push_back(curr); } else { if(left < n) { //left == n implies we have reached the last row string currLeft = curr + "("; bt(currLeft, words, left + 1, right, n); } if(right < left) { string currRight = curr + ")"; bt(currRight, words, left, right + 1, n); } } } };
[ "kaustubh@whizkid.(none)" ]
kaustubh@whizkid.(none)
3d7da65d296099dc13f17cce0caef542bf299f54
a4c8a90d4d2cb337f45a0be5c90bf552a358e698
/AGC1 simulator archive/AGC1 sim v1.2/TPG.h
1b551744af817eeb8e353b9c824cf2fbba246a1e
[]
no_license
estuans/PultorakAGC
95cca91a54f4f31a61c7a06e6d38f6fe6964a7eb
2f92b6325ab0f7c0564b2e151bc3c3fc914590dc
refs/heads/master
2021-01-18T18:18:40.251122
2016-07-04T23:07:42
2016-07-04T23:07:42
62,591,832
0
0
null
null
null
null
UTF-8
C++
false
false
1,572
h
/**************************************************************************** * TPG - TIME PULSE GENERATOR subsystem * * AUTHOR: John Pultorak * DATE: 9/22/01 * FILE: TPG.h * * VERSIONS: * * DESCRIPTION: * Time Pulse Generator and Start/Stop Logic for the Block 1 Apollo Guidance * Computer prototype (AGC4). * * SOURCES: * Mostly based on information from "Logical Description for the Apollo * Guidance Computer (AGC4)", Albert Hopkins, Ramon Alonso, and Hugh * Blair-Smith, R-393, MIT Instrumentation Laboratory, 1963. * * NOTES: * ***************************************************************************** */ #ifndef TPG_H #define TPG_H #include "reg.h" // Start/Stop Logic and Time Pulse Generator Subsystem enum tpType { STBY =0, PWRON =1, TP1 =2, // TIME PULSE 1: start of memory cycle time (MCT) TP2 =3, TP3 =4, TP4 =5, TP5 =6, TP6 =7, // EMEM is available in G register by TP6 TP7 =8, // FMEM is available in G register by TP7 TP8 =9, TP9 =10, TP10 =11, // G register written to memory beginning at TP10 TP11 =12, // TIME PULSE 11: end of memory cycle time (MCT) TP12 =13, // select new subsequence/select new instruction SRLSE =14, // step switch release WAIT =15 }; class regSG : public reg { public: regSG() : reg(4, "%02o") { } virtual void execRP(); virtual void execWP(); }; class TPG { public: static regSG register_SG; static char* tpTypestring[]; }; #endif
[ "ben@Bens-MacBook-Air.local" ]
ben@Bens-MacBook-Air.local
6c9da7d862382e556ee04c4afd8d2e8d97bdeeb1
c8fcc1acf73585045a5c7213cfb9f90e4c1e809e
/CodeForces/463B.cpp
93274bdc43e58e6014d5dff2ac6a2bcba740a983
[]
no_license
Jonariguez/ACM_Code
6db4396b20d0b0aeef30e4d47b51fb5e3ec48e03
465a11746d577197772f64aa11209eebd5bfcdd3
refs/heads/master
2020-03-24T07:09:53.482953
2018-11-19T09:21:33
2018-11-19T09:21:33
142,554,816
3
0
null
null
null
null
UTF-8
C++
false
false
563
cpp
/**************** *PID:463b div2 *Auth:Jonariguez ***************** */ #include <stdio.h> #include <string.h> #include <math.h> #include <vector> #include <algorithm> using namespace std; typedef long long LL; const int maxn=100000+10; int a[maxn]; int main() { int i,j,n,s; while(scanf("%d",&n)!=EOF){ for(i=1;i<=n;i++) scanf("%d",&a[i]); a[0]=0; LL res=1e18,now=0; for(i=0;i<n;i++){ now+=a[i]-a[i+1]; res=min(res,now); } printf("%I64d\n",-res); } return 0; }
[ "921829915@qq.com" ]
921829915@qq.com
1d50070df9d80bd11f4404002f19360aa1a27a20
8a21e794347dc61a51db17d05161b6ca7634594f
/intro/graycode.cpp
7992f35767aee55109c1c3449eb3c3a96d35725b
[]
no_license
Mahima246/CSES_Problems_set_solutions
e5900ca9d99eefa0b05bd530fccb229694a403a3
a092cea2b916060227dad7f45c3d69f041ee5c2f
refs/heads/main
2023-05-07T21:30:59.558061
2021-05-17T21:22:47
2021-05-17T21:22:47
368,324,980
0
0
null
null
null
null
UTF-8
C++
false
false
629
cpp
#include<iostream> #include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; vector<string> ar; ar.push_back("0"); ar.push_back("1"); for(int i=2;i<(1<<n);i<<=1){ // int r = i^(i>>1); // bitset<32> k(r); // string s = k.to_string(); // cout << s.substr(32 - n) << " "; for(int j=i-1;j>=0;j--){ ar.push_back(ar[j]); } for(int j =0;j<i;j++){ ar[j] = "0"+ ar[j]; } for(int j = i;j<2*i;j++)ar[j] = "1" + ar[j]; } for(int i=0;i<ar.size();i++)cout<<ar[i]<<endl; return 0; }
[ "mahimaarora@Mahimas-MacBook-Air.local" ]
mahimaarora@Mahimas-MacBook-Air.local
014735852a73406d854cf0ce1c141c63fb37b878
90047daeb462598a924d76ddf4288e832e86417c
/device/vr/vr_device_provider.h
d3566737b3e57a814b0afd46f0c86fde57c678f0
[ "BSD-3-Clause" ]
permissive
massbrowser/android
99b8c21fa4552a13c06bbedd0f9c88dd4a4ad080
a9c4371682c9443d6e1d66005d4db61a24a9617c
refs/heads/master
2022-11-04T21:15:50.656802
2017-06-08T12:31:39
2017-06-08T12:31:39
93,747,579
2
2
BSD-3-Clause
2022-10-31T10:34:25
2017-06-08T12:36:07
null
UTF-8
C++
false
false
720
h
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef DEVICE_VR_VR_DEVICE_PROVIDER_H #define DEVICE_VR_VR_DEVICE_PROVIDER_H #include <vector> namespace device { class VRDevice; class VRDeviceProvider { public: VRDeviceProvider() {} virtual ~VRDeviceProvider() {} virtual void GetDevices(std::vector<VRDevice*>* devices) = 0; // If the VR API requires initialization that should happen here. virtual void Initialize() = 0; virtual void PollEvents() {} virtual void SetListeningForActivate(bool listening) {} }; } // namespace device #endif // DEVICE_VR_VR_DEVICE_PROVIDER_H
[ "xElvis89x@gmail.com" ]
xElvis89x@gmail.com
3661d0bc6409bbf3142759e34e58ff2c1293515e
52d32741305d1e8339f6c069e7cce0b2674108d9
/el-practice3/el.hpp
64e5299cc64e83d29fc1656b17169454802c7a42
[]
no_license
abrowne2/TheoryofProgramming
ed8750a69d0c45e4089db455b150745afa7b63db
2d925b3ae562d7fd37fd821f6399f896355fab92
refs/heads/master
2021-01-21T06:05:04.235362
2017-09-29T19:04:33
2017-09-29T19:04:33
101,935,311
0
0
null
null
null
null
UTF-8
C++
false
false
3,789
hpp
#include <algorithm> /* Author: Adam Browne Group work with Samuel Borick and Owen Quick */ //NOTE:this is like an include guard; I'm included once in src compilation (?) //can't use same macro name in more than one file with this. #pragma once enum log_op { op_and, op_or, }; enum rel_op { op_less, op_equal, op_greater, }; enum arith_op { op_add, op_sub, op_mul, op_div, op_rem, }; //not sure about the `type` vs `kind` convention here. enum num_expr_type { et_int, et_arg, et_arith, et_if }; enum bool_expr_type { et_bool, et_rel, et_log }; enum error { DIV_ZERO, }; //syntactic domains below (prog, num_expr, bool_expr...) //declaring these here makes the prog abstraction happy struct prog; struct num_expr; struct bool_expr; struct expr; struct prog { prog(int n, num_expr* exp) :num_args(n), body(exp) {} int num_args; num_expr* body; }; struct num_expr { num_expr(num_expr_type t) :type(t) {} num_expr_type type; expr fold(); }; struct bool_expr { bool_expr(bool_expr_type t) :type(t) {} bool_expr_type type; expr fold(); }; struct err { err() :val() {} err(error v) :val(v) {} error val; }; struct int_literal :num_expr { int_literal() :num_expr(et_int), value() {} int_literal(int n) :num_expr(et_int), value(n) {} int value; int_literal fold(); }; struct expr { expr() = default; expr(num_expr* expression) :exp(expression), bExp(nullptr), expr_error() {} expr(bool_expr* expression) :exp(nullptr), bExp(expression), expr_error() {} expr(err ex_error) :exp(nullptr), bExp(nullptr), expr_error(ex_error) {} num_expr* exp; bool_expr* bExp; err expr_error; }; struct arith_expr :num_expr { arith_expr(arith_op op, num_expr* left, num_expr* right) :num_expr(et_arith), op(op), lhs(left), rhs(right) {} arith_op op; num_expr* lhs; num_expr* rhs; expr arith_eval(const arith_op, int l, int r); expr fold(); }; struct arg_expr : num_expr { arg_expr(int n) :num_expr(et_arg), arg(n) {} int arg; }; struct if_expr : num_expr { if_expr(bool_expr *c, num_expr* succeed, num_expr* failure) :num_expr(et_if), rel(c), success(succeed), fail(failure) {} bool_expr* rel; num_expr* success; num_expr* fail; expr fold(); }; struct bool_literal : bool_expr { bool_literal(bool n) :bool_expr(et_bool), value(n) {} bool value; bool_literal fold(); }; struct rel_expr : bool_expr { rel_expr(rel_op op, num_expr* left, num_expr* right) :bool_expr(et_bool), op(op), lhs(left), rhs(right) {} rel_op op; num_expr* lhs; num_expr* rhs; }; struct log_expr : bool_expr { //left and right aren't the best choices here... //it's really expression one and two, but it seems ok? log_expr(log_op op, bool_expr* left, bool_expr* right) :bool_expr(et_log), op(op), lhs(left), rhs(right) {} log_op op; bool_expr* lhs; bool_expr* rhs; }; int nHeight(num_expr* cur_exp); int bHeight(bool_expr* cur_exp); int nHeight(num_expr* cur_exp) { switch(cur_exp->type){ case et_int: return 0; case et_arg: return 0; case et_arith: return 1 + std::max(nHeight(static_cast<const arith_expr*>(cur_exp)->lhs),nHeight(static_cast<const arith_expr*>(cur_exp)->rhs)); case et_if: return 1 + std::max(bHeight(static_cast<const if_expr*>(cur_exp)->rel),std::max(nHeight(static_cast<const if_expr*>(cur_exp)->success),nHeight(static_cast<const if_expr*>(cur_exp)->fail))); } } int bHeight(bool_expr* cur_exp) { switch(cur_exp->type){ case et_bool: return 0; case et_rel: return 1 + std::max(nHeight(static_cast<const rel_expr*>(cur_exp)->lhs),nHeight(static_cast<const rel_expr*>(cur_exp)->rhs)); case et_log: return 1 + std::max(bHeight(static_cast<const log_expr*>(cur_exp)->lhs),bHeight(static_cast<const log_expr*>(cur_exp)->rhs)); } }
[ "adamo.browne@gmail.com" ]
adamo.browne@gmail.com
083f7a7d6c70455661d09e047f48c2e649a73101
f298f134b9511c884d91bb70b94401c288991ccc
/llvm/src/lib/CSE231/RangeAnalysis.cpp
18613e8087d084154d0137b3d335d639ffe08ed7
[]
no_license
salamanderrex/codeArtisan
a7c714159588fe952103322a2d172941af30bf2e
2971d1b7f2c94cb842478fe5e8860fa3692ddac2
refs/heads/master
2021-01-10T03:58:42.980313
2016-04-03T19:00:24
2016-04-03T19:00:24
55,125,173
0
0
null
null
null
null
UTF-8
C++
false
false
16,673
cpp
#include "llvm/IR/Module.h" #include "llvm/IR/Function.h" #include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/BasicBlock.h" #include "llvm/Support/InstIterator.h" #include "llvm/IR/IRBuilder.h" #include <string> #include <limits> #include <map> #include "RangeAnalysis.h" //#include "RAFlow.h" #define BOTTOM 1 #define TOP 2 using namespace llvm; using namespace std; Flow* RangeAnalysis::executeFlowFunction(Flow *in, Instruction *inst, int NodeId) { int thr=3; RAFlow* inFlow = static_cast<RAFlow*>(in); RAFlow* output; int count; //add termination for loops if (nodeCount.find(NodeId) != nodeCount.end()) { count = nodeCount[NodeId].counter; if (count >= thr) { RAFlow* f = new RAFlow(inFlow); RAFlow* fnew = new RAFlow(); f = static_cast<RAFlow*>(fnew->join(f)); RAFlow* tmp = nodeCount[NodeId].nodeSet; for (map<string, Range>::iterator itr = tmp->value.begin(); itr!=tmp->value.end(); itr++) { if((f->value.find(itr->first) != f->value.end())){ Range fRange = f->value.find(itr->first)->second; Range nodeRange = tmp->value.find(itr->first)->second; if(!RangeEqual((const Range*) &fRange, (const Range*) &nodeRange)){ fRange.lower = 0; fRange.upper = 0; fRange.top = true; fRange.bottom = false; fRange.undefined = true; tmp->value[itr->first] = fRange; f->value[itr->first] = fRange; } } } return f; } nodeCount[NodeId].counter = nodeCount[NodeId].counter + 1; } else{ RAFlow* f = new RAFlow(inFlow); RAFlow* fnew = new RAFlow(); f = static_cast<RAFlow*>(fnew->join(f)); // add this node node thisNode; thisNode.counter = 1; thisNode.nodeSet = f; nodeCount[NodeId] = thisNode; } switch (inst->getOpcode()) { case Instruction::ICmp: case Instruction::FCmp: output = runCompInst(inFlow, inst); break; case Instruction::Add: case Instruction::Sub: case Instruction::Mul: case Instruction::SDiv: case Instruction::SRem: case Instruction::Shl: case Instruction::AShr: output = runOpInst(inFlow, inst, inst->getOpcode(), 0); break; case Instruction::FAdd: case Instruction::FSub: case Instruction::FMul: case Instruction::FDiv: case Instruction::FRem: output = runOpInst(inFlow, inst, inst->getOpcode(), 1); break; case Instruction::PHI: output = runPhiInst(inFlow, inst); break; case Instruction::Store: output = runStoreInst(inFlow, inst); break; case Instruction::Load: output = runLoadInst(inFlow, inst); break; case Instruction::Trunc: case Instruction::ZExt: case Instruction::SExt: case Instruction::FPTrunc: case Instruction::FPExt: case Instruction::FPToUI: case Instruction::FPToSI: case Instruction::UIToFP: case Instruction::SIToFP: output = runCastInst(inFlow, inst); break; case Instruction::Ret: output = runRtnInst(inFlow, inst); break; default: output = new RAFlow(inFlow); break; } //errs() << inst->getOperand(0)->getName()<<"\n"; //errs() << *inst << output->toString() << "\n"; return output; } // Note here we use "type" to distinguish int ("type=0") and float ("type=1") Range getConstRange(Value* c, int type) { Range rtn; if (type == 0) { ConstantInt *cI = dyn_cast<ConstantInt>(c); rtn.bottom = false; if(cI->isNegative()){ // too large! if(cI->getBitWidth() > 32){ rtn.upper = -std::numeric_limits<float>::infinity(); rtn.lower = rtn.upper; } else{ rtn.upper = (float) cI->getSExtValue(); rtn.lower = rtn.upper; } } else{ rtn.bottom = false; rtn.upper = (float) cI->getZExtValue(); rtn.lower = rtn.upper; } } if (type == 1) { ConstantFP *cF = dyn_cast<ConstantFP>(c); rtn.bottom = false; rtn.upper = cF->getValueAPF().convertToFloat(); rtn.lower = rtn.upper; } return rtn; } Range getConstRange(Value* c) { Range rtn; if (ConstantInt *cI = dyn_cast<ConstantInt>(c)) { rtn.bottom = false; if(cI->isNegative()){ // too large! if(cI->getBitWidth() > 32){ rtn.upper = -std::numeric_limits<float>::infinity(); rtn.lower = rtn.upper; } else{ rtn.upper = (float) cI->getSExtValue(); rtn.lower = rtn.upper; } } else{ rtn.bottom = false; rtn.upper = (float) cI->getZExtValue(); rtn.lower = rtn.upper; } } if (ConstantFP *cF = dyn_cast<ConstantFP>(c)) { rtn.bottom = false; rtn.upper = cF->getValueAPF().convertToFloat(); rtn.lower = rtn.upper; } return rtn; } // Note here we use "type" to distinguish int ("type=0") and float ("type=1") RAFlow* RangeAnalysis::runOpInst(RAFlow* in, Instruction* instruction, unsigned opcode, int type) { RAFlow* f = new RAFlow(in); Value *inst = instruction; Range lRange, rRange, rtnRange; Value *left = instruction->getOperand(0); Value *right = instruction->getOperand(1); ConstantInt *leftI = dyn_cast<ConstantInt>(left); ConstantInt *rightI = dyn_cast<ConstantInt>(right); ConstantFP *leftF = dyn_cast<ConstantFP>(left); ConstantFP *rightF = dyn_cast<ConstantFP>(right); //errs() << left->getName() << " " << right->getName() << "\n"; // Deal with int operand if (type == 0){ if (leftI) lRange = getConstRange(leftI, type); else{ string name = ""; if (left->getName()!="") name = left->getName(); else name = "tmp"; if (f->value.find(name) == f->value.end()) errs() << "[left] undefined [int] variable: "<< left->getName() <<"\n"; else lRange = f->value.find(name)->second; if (left->getName()=="") f->value.erase("tmp"); } if (rightI) rRange = getConstRange(rightI, type); else{ string name = ""; if (right->getName()!="") name = right->getName(); else name = "tmp"; if (f->value.find(name) == f->value.end()) errs() << "[right] undefined [int] variable: "<< right->getName() <<"\n"; else rRange = f->value.find(name)->second; if (right->getName()=="") f->value.erase("tmp"); } } // Deal with float operand if (type == 1){ if (leftF) lRange = getConstRange(leftF, type); else{ string name = ""; if (left->getName()!="") name = left->getName(); else name = "tmp"; if (f->value.find(name) == f->value.end()) errs() << "[left] undefined [float] variable: " << left->getName() <<"\n"; else lRange = f->value.find(name)->second; if (left->getName()=="") f->value.erase("tmp"); } if (rightF) rRange = getConstRange(rightF, type); else{ string name = ""; if (right->getName()!="") name = right->getName(); else name = "tmp"; if (f->value.find(name) == f->value.end()) errs() << "[right] undefined [float] variable: " << right->getName() <<"\n"; else rRange = f->value.find(name)->second; if (right->getName()=="") f->value.erase("tmp"); } } //errs() << lRange.lower << " "<< lRange.upper << "\n"; //errs() << rRange.lower << " "<< rRange.upper << "\n"; rtnRange = getRange(lRange, rRange, opcode); RAFlow* fnew = new RAFlow(0); //errs() << fnew->triPoint << " "<< f->triPoint<<"\n"; map<string, Range> value; value[inst->getName()] = rtnRange; //value[inst->getName()] = rtnRange; fnew->value = value; f = static_cast<RAFlow*>(fnew->join(f)); return f; } RAFlow* RangeAnalysis::runStoreInst(RAFlow* in, Instruction* instruction) { RAFlow* f = new RAFlow(in); Range rtnRange; Value* left = instruction->getOperand(0); Value* right = instruction->getOperand(1); //errs() << left->getName() << " "<<right->getName() <<"\n"; if (f->value.find(left->getName()) == f->value.end()){ if (dyn_cast<Constant>(left)){ if(ConstantInt *cI = dyn_cast<ConstantInt>(left)) rtnRange = getConstRange(cI, 0); else if(ConstantFP *cP = dyn_cast<ConstantFP>(left)) rtnRange = getConstRange(cP, 1); } else{ errs() << "undefined variable: " <<left->getName() <<"\n"; } } else{ rtnRange = f->value[left->getName()]; f->value.erase(left->getName()); } if (f->value.find(right->getName()) != f->value.end()) f->value.erase(right->getName()); map<string, Range> value; //value[inst->getName()] = rtnRange; value[right->getName()] = rtnRange; RAFlow* fnew = new RAFlow(0); fnew->value = value; f = static_cast<RAFlow*>(fnew->join(f)); //errs() << "runStoreInst:" << "[ " << rtnRange.lower << ", " << rtnRange.upper << " ]" << "\n"; return f; } RAFlow* RangeAnalysis::runLoadInst(RAFlow* in, Instruction* instruction) { RAFlow* f = new RAFlow(in); Range rtnRange; Value* input = instruction->getOperand(0); if (dyn_cast<Constant>(input)){ if(ConstantInt *cI = dyn_cast<ConstantInt>(input)) rtnRange = getConstRange(cI, 0); else if(ConstantFP *cP = dyn_cast<ConstantFP>(input)) rtnRange = getConstRange(cP, 1); } else{ if (f->value.find(input->getName()) == f->value.end()) errs() << "undefined variable: " <<input->getName() <<"\n"; else{ rtnRange = f->value.find(input->getName())->second; } } map<string, Range> value; value["tmp"] = rtnRange; //errs() << "runCastInst:" << "[ " << rtnRange.lower << ", " << rtnRange.upper << " ]" << "\n"; RAFlow* fnew = new RAFlow(0); fnew->value = value; f = static_cast<RAFlow*>(fnew->join(f)); return f; } RAFlow* RangeAnalysis::runCompInst(RAFlow* in, Instruction* instruction) { RAFlow* f = new RAFlow(in); Value *left = instruction->getOperand(0); Value *right = instruction->getOperand(1); ConstantInt *leftI = dyn_cast<ConstantInt>(left); ConstantInt *rightI = dyn_cast<ConstantInt>(right); ConstantFP *leftF = dyn_cast<ConstantFP>(left); ConstantFP *rightF = dyn_cast<ConstantFP>(right); if ((!leftI) & (!leftF) & (left->getName()=="") & (f->value.find("tmp")!=f->value.end())) f->value.erase("tmp"); if ((!rightI) & (!rightF) & (right->getName()=="") & (f->value.find("tmp")!=f->value.end())) f->value.erase("tmp"); return f; } RAFlow* RangeAnalysis::runRtnInst(RAFlow* in, Instruction* instruction) { RAFlow* f = new RAFlow(in); Range rtnRange; Value* input = instruction->getOperand(0); if (dyn_cast<Constant>(input)){ if(ConstantInt *cI = dyn_cast<ConstantInt>(input)) rtnRange = getConstRange(cI, 0); else if(ConstantFP *cP = dyn_cast<ConstantFP>(input)) rtnRange = getConstRange(cP, 1); } else{ string name = ""; if (input->getName()=="") name = "tmp"; else name = input->getName(); if (f->value.find(name) == f->value.end()) errs() << "undefined variable: " <<name <<"\n"; else{ rtnRange = f->value.find(name)->second; } if (input->getName()=="") f->value.erase("tmp"); } f->value["retval"] = rtnRange; return f; } RAFlow* RangeAnalysis::runCastInst(RAFlow* in, Instruction* instruction) { RAFlow* f = new RAFlow(in); Range rtnRange; Value* input = instruction->getOperand(0); if (dyn_cast<Constant>(input)){ if(ConstantInt *cI = dyn_cast<ConstantInt>(input)) rtnRange = getConstRange(cI, 0); else if(ConstantFP *cP = dyn_cast<ConstantFP>(input)) rtnRange = getConstRange(cP, 1); } else{ if (f->value.find(input->getName()) == f->value.end()) errs() << "undefined variable: " <<input->getName() <<"\n"; else{ rtnRange = f->value.find(input->getName())->second; } } map<string, Range> value; //value[inst->getName()] = rtnRange; value[input->getName()] = rtnRange; //errs() << "runCastInst:" << "[ " << rtnRange.lower << ", " << rtnRange.upper << " ]" << "\n"; RAFlow* fnew = new RAFlow(0); fnew->value = value; f = static_cast<RAFlow*>(fnew->join(f)); return f; } RAFlow* RangeAnalysis::runPhiInst(RAFlow* in, Instruction* instruction) { RAFlow* f = new RAFlow(in); Value *inst= instruction; Range lRange, rRange, maxRange; Value *left = instruction->getOperand(0); Value *right = instruction->getOperand(1); if(f->value.find(left->getName()) == f->value.end()) lRange = getConstRange(left); else lRange = f->value.find(left->getName())->second; if(f->value.find(right->getName()) == f->value.end()) rRange = getConstRange(right); else rRange = f->value.find(right->getName())->second; maxRange = JoinRange((const Range*) &lRange, (const Range*) &rRange); RAFlow* fnew = new RAFlow(); map<string, Range> value; if (f->value.find(inst->getName()) != f->value.end()) { lRange = maxRange; rRange = f->value[inst->getName()]; maxRange = JoinRange((const Range*) &lRange, (const Range*) &rRange); } value[inst->getName()] = maxRange; fnew->value = value; f = static_cast<RAFlow*>(fnew->join(f)); return f; } // Implementing data flow functions for arithmetic operands Range RangeAnalysis::getRange(Range lRange, Range rRange, unsigned opcode){ Range rtnRange; // Check if input elements have been analyzed if (rRange.undefined || lRange.undefined || rRange.top || lRange.top){ rtnRange.top = true; rtnRange.bottom = false; rtnRange.upper = 0; rtnRange.lower = 0; return rtnRange; } // Operate range calculation case-by-case float tmp[4]; switch (opcode) { case Instruction::Add: case Instruction::FAdd: rtnRange.lower = lRange.lower + rRange.lower; rtnRange.upper = lRange.upper + rRange.upper; rtnRange.bottom = false; break; case Instruction::Sub: case Instruction::FSub: rtnRange.lower = lRange.lower - rRange.lower; rtnRange.upper = lRange.upper - rRange.upper; rtnRange.bottom = false; break; case Instruction::Mul: case Instruction::FMul: tmp[0] = lRange.lower * rRange.lower; tmp[1] = lRange.lower * rRange.upper; tmp[2] = lRange.upper * rRange.lower; tmp[3] = lRange.upper * rRange.upper; rtnRange.lower = tmp[0]; rtnRange.upper = tmp[1]; rtnRange.bottom = false; for(int i=1; i<4; i++){ if (tmp[i]<rtnRange.lower) rtnRange.lower = tmp[i]; if (tmp[i]>rtnRange.upper) rtnRange.upper = tmp[i]; } break; case Instruction::SDiv: case Instruction::FDiv: if (rRange.lower*rRange.upper>=0){ tmp[0] = lRange.lower / rRange.lower; tmp[1] = lRange.lower / rRange.upper; tmp[2] = lRange.upper / rRange.lower; tmp[3] = lRange.upper / rRange.upper; rtnRange.lower = tmp[0]; rtnRange.upper = tmp[1]; rtnRange.bottom = false; for(int i=1; i<4; i++){ if (tmp[i]<rtnRange.lower) rtnRange.lower = tmp[i]; if (tmp[i]>rtnRange.upper) rtnRange.upper = tmp[i]; } } break; case Instruction::URem: case Instruction::SRem: case Instruction::FRem: tmp[0] = (int) lRange.lower % (int) rRange.lower; tmp[1] = (int) lRange.lower % (int) rRange.upper; tmp[2] = (int) lRange.upper % (int) rRange.lower; tmp[3] = (int) lRange.upper % (int) rRange.upper; rtnRange.lower = tmp[0]; rtnRange.upper = tmp[1]; rtnRange.bottom = false; for(int i=1; i<4; i++){ if (tmp[i]<rtnRange.lower) rtnRange.lower = tmp[i]; if (tmp[i]>rtnRange.upper) rtnRange.upper = tmp[i]; } break; case Instruction::Shl: tmp[0] = (int) lRange.lower << (int) rRange.lower; tmp[1] = (int) lRange.lower << (int) rRange.upper; tmp[2] = (int) lRange.upper << (int) rRange.lower; tmp[3] = (int) lRange.upper << (int) rRange.upper; rtnRange.lower = tmp[0]; rtnRange.upper = tmp[1]; rtnRange.bottom = false; for(int i=1; i<4; i++){ if (tmp[i]<rtnRange.lower) rtnRange.lower = tmp[i]; if (tmp[i]>rtnRange.upper) rtnRange.upper = tmp[i]; } break; case Instruction::AShr: tmp[0] = (int) lRange.lower >> (int) rRange.lower; tmp[1] = (int) lRange.lower >> (int) rRange.upper; tmp[2] = (int) lRange.upper >> (int) rRange.lower; tmp[3] = (int) lRange.upper >> (int) rRange.upper; rtnRange.lower = tmp[0]; rtnRange.upper = tmp[1]; rtnRange.bottom = false; for(int i=1; i<4; i++){ if (tmp[i]<rtnRange.lower) rtnRange.lower = tmp[i]; if (tmp[i]>rtnRange.upper) rtnRange.upper = tmp[i]; } break; } return rtnRange; } void RangeAnalysis::print(raw_ostream &OS) { for (unsigned int i = 0; i < CFGNodes.size() ; i++) { this->printHelper(OS,this->CFGNodes[i]); if(i+1 < CFGNodes.size()) { OS << "\n"; } OS << "\n"; } } void RangeAnalysis::printHelper(raw_ostream &OS, LatticeNode* node) { OS << "representation : " << *(node->inst) << "\n"; OS << "#Edge incoming" << "\n"; for (unsigned int i = 0 ; i < node->incoming.size() ; i++) { RAFlow * tmp = (RAFlow*)node->incoming[i]->flow; OS << tmp->toString() << "\n"; } OS << "#Edge outcoming" << "\n"; for (unsigned int i = 0 ; i < node->outgoing.size() ; i++) { RAFlow * tmp = (RAFlow*)node->outgoing[i]->flow; OS<<tmp->toString()<<"\n"; } } Flow * RangeAnalysis::initialize() { return new RAFlow(BOTTOM); } RangeAnalysis::RangeAnalysis(Function & F){ this->functionName = F.getName(); CFGmaker(F); }
[ "zhouqingyu.rex@gmail.com" ]
zhouqingyu.rex@gmail.com
afc8fc55f215320eb2168eff755f31413ec49906
2637de3e42d962914dcb911d8c4f0a9bf3e77219
/SueHW1/personStruct.h
9bdbcbbfd3ed063890e77a1b8a5426789dc54501
[]
no_license
cdesch/SueHW1
944d186ef6f31aae44086e05d335ab6b5f3f5311
16b3b29cb7ff91d952c94fd8cf5d2e4d1cc6a662
refs/heads/master
2016-09-10T09:10:34.021280
2014-09-05T20:51:45
2014-09-05T20:51:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
640
h
// // personStruct.h // SueHW1 // // Created by cj on 9/3/14. // Copyright (c) 2014 KickinEspresso. All rights reserved. // //The assignment calls for a struct so we will give them a struct even though it is better implemented as a class //These lines with #ifndefine and #define are only for the headerfile. #ifndef SueHW1_personStruct_h #define SueHW1_personStruct_h #include <string> struct PersonStruct { //Public attributes std::string lastName; std::string firstName; void printName(); std::string getName(); void setFullName(std::string fullname); }; //Same with this guy down here #endif
[ "cdesch@gmail.com" ]
cdesch@gmail.com
5621cf218493c58d09b27da08daefd1b87c59ff0
0026670c52b81d336d32f279624ccf51c7c75c23
/Bob/AIEngine/AIEnemyBullDozer.cpp
8b11e837a3d048d57e53df987a05a12776db0e61
[ "MIT" ]
permissive
shoematt/BladeofBetrayal
c4863a220ad3e16d0610e1d4923756101a9cb9dd
8657c4bb41c8127e200fe529c526153ef5e1338f
refs/heads/master
2020-12-28T23:24:00.684411
2015-03-13T07:22:16
2015-03-13T07:22:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,309
cpp
// EnemyBullDozer.cpp: implementation of the EnemyBullDozer class. // ////////////////////////////////////////////////////////////////////// #include "AIEnemyBullDozer.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// AIEnemyBullDozer::AIEnemyBullDozer() { first_move = true; } AIEnemyBullDozer::~AIEnemyBullDozer() { } void AIEnemyBullDozer::UseBrain() { int pxt = aio->player_input->GetXTilePos(); int xtile = aiinput->GetXTilePos(); if(new_enemy) { /*fixes moveStop bug*/ new_enemy = false; aioutput->moveRight(); } /* char temp[256]; sprintf(temp, "[BULL](pxt:%d)(xt:%d)", pxt, xtile); OutputDebugString(temp);*/ /* if(xtile < pxt) { aioutput->moveRight(); aioutput->SetAttack(0); aioutput->moveButton4(); } else aioutput->moveStop();*/ if(xtile == 246) { aioutput->moveStop(); return; } if(first_move) { if( (xtile+2) < (pxt-6)) { aioutput->moveRight(); first_move = false; aioutput->SetAttack(0); aioutput->moveButton4(); } else aioutput->moveStop(); } else { if( (xtile+2) < pxt) { aioutput->moveRight(); aioutput->SetAttack(0); aioutput->moveButton4(); } else aioutput->moveStop(); } }
[ "duhone@conjuredrealms.com" ]
duhone@conjuredrealms.com
9aa4b7be75769d1a960e68a7a52d3c5c5d84ea0b
3cc3a3197215093b9bdb5093ac1e698f64192072
/src/qt/overviewpage.cpp
8f1fab8d932fdd889ef6d68de0422847aa100d36
[ "MIT" ]
permissive
shade-project/Shade
78b4e07fda4f8fbcdeafaa7e46e38664c12fb534
a8831c9ab2a1908c4d0185372e8685bef2fb1b39
refs/heads/master
2016-09-05T09:57:12.873150
2014-09-11T06:22:25
2014-09-11T06:22:25
23,565,118
0
2
null
null
null
null
UTF-8
C++
false
false
8,512
cpp
#include "overviewpage.h" #include "ui_overviewpage.h" #include "walletmodel.h" #include "bitcoinunits.h" #include "optionsmodel.h" #include "transactiontablemodel.h" #include "transactionfilterproxy.h" #include "guiutil.h" #include "guiconstants.h" #include "poolbrowser.h" #include "bitcoingui.h" #include <QAbstractItemDelegate> #include <QPainter> #include <QPicture> #include <QMovie> #include <QFrame> #define DECORATION_SIZE 43 #define NUM_ITEMS 5 class TxViewDelegate : public QAbstractItemDelegate { Q_OBJECT public: TxViewDelegate(): QAbstractItemDelegate(), unit(BitcoinUnits::BTC) { } inline void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { painter->save(); QIcon icon = qvariant_cast<QIcon>(index.data(Qt::DecorationRole)); QRect mainRect = option.rect; QRect decorationRect(mainRect.left() - 8, mainRect.top() - 12, DECORATION_SIZE, DECORATION_SIZE); int xspace = DECORATION_SIZE - 8; int ypad = 0; int halfheight = (mainRect.height() - 2 * ypad) / 2; QRect amountRect(mainRect.left() + xspace + 10, mainRect.top(), mainRect.width() - xspace - 10, halfheight); QRect addressRect(mainRect.left() + xspace + 130, mainRect.top(), mainRect.width() - xspace, halfheight); icon.paint(painter, decorationRect); QDateTime date = index.data(TransactionTableModel::DateRole).toDateTime(); QString address = index.data(Qt::DisplayRole).toString(); qint64 amount = index.data(TransactionTableModel::AmountRole).toLongLong(); bool confirmed = index.data(TransactionTableModel::ConfirmedRole).toBool(); QVariant value = index.data(Qt::ForegroundRole); QColor foreground = option.palette.color(QPalette::Text); if (qVariantCanConvert<QColor>(value)) { foreground = qvariant_cast<QColor>(value); } painter->setPen(foreground); painter->drawText(addressRect, Qt::AlignLeft | Qt::AlignVCenter, address); if (amount < 0) { foreground = COLOR_NEGATIVE; } else if (!confirmed) { foreground = COLOR_UNCONFIRMED; } else { foreground = option.palette.color(QPalette::Text); } painter->setPen(foreground); QString amountText = ""; if (convertmode == 0) { amountText = BitcoinUnits::formatWithUnit(unit, amount, true); } if (convertmode == 1) { amountText = BitcoinUnits::formatWithUnit(unit, (_dScPriceLast * amount), true); } if (convertmode == 2) { amountText = BitcoinUnits::formatWithUnit(unit, (_dScPriceLast / _dBtcPriceLast * amount), true); } if (!confirmed) { amountText = QString("[") + amountText + QString("]"); } painter->drawText(amountRect, Qt::AlignRight | Qt::AlignVCenter, amountText); painter->setPen(option.palette.color(QPalette::Text)); painter->drawText(amountRect, Qt::AlignLeft | Qt::AlignVCenter, GUIUtil::dateTimeStr(date)); painter->restore(); } inline QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { return QSize(DECORATION_SIZE, DECORATION_SIZE - 5); } int unit; }; #include "overviewpage.moc" OverviewPage::OverviewPage(QWidget *parent) : QWidget(parent), ui(new Ui::OverviewPage), currentBalance(-1), currentStake(0), currentUnconfirmedBalance(-1), currentImmatureBalance(-1), txdelegate(new TxViewDelegate()), filter(0) { ui->setupUi(this); // Recent transactions ui->listTransactions->setItemDelegate(txdelegate); ui->listTransactions->setIconSize(QSize(DECORATION_SIZE, DECORATION_SIZE)); ui->listTransactions->setMinimumHeight(NUM_ITEMS * (DECORATION_SIZE)); ui->listTransactions->setAttribute(Qt::WA_MacShowFocusRect, false); connect(ui->listTransactions, SIGNAL(clicked(QModelIndex)), this, SLOT(handleTransactionClicked(QModelIndex))); // init "out of sync" warning labels ui->lblDetailsSlot3->setText("Out of sync"); // start with displaying the "out of sync" warnings showOutOfSyncWarning(true); this->setStyleSheet("background-image:url(:/images/background);"); } void OverviewPage::handleTransactionClicked(const QModelIndex &index) { if (filter) { emit transactionClicked(filter->mapToSource(index)); } } OverviewPage::~OverviewPage() { delete ui; } void OverviewPage::setBalance(qint64 balance, qint64 stake, qint64 unconfirmedBalance, qint64 immatureBalance) { int unit = model->getOptionsModel()->getDisplayUnit(); currentBalance = balance; currentStake = stake; currentUnconfirmedBalance = unconfirmedBalance; currentImmatureBalance = immatureBalance; if (convertmode == 0) { ui->lblBalanceSlot0->setText(BitcoinUnits::formatWithUnit(unit, balance)); ui->lblBalanceSlot1->setText(BitcoinUnits::formatWithUnit(unit, stake)); ui->lblDetailsSlot0->setText(BitcoinUnits::formatWithUnit(unit, unconfirmedBalance)); ui->lblBalanceSlot3->setText(BitcoinUnits::formatWithUnit(unit, balance + stake + unconfirmedBalance + immatureBalance)); } else if (convertmode == 1) { ui->lblBalanceSlot0->setText(BitcoinUnits::formatWithUnit(unit, (_dScPriceLast * balance))); ui->lblBalanceSlot1->setText(BitcoinUnits::formatWithUnit(unit, (_dScPriceLast * stake))); ui->lblDetailsSlot0->setText(BitcoinUnits::formatWithUnit(unit, (_dScPriceLast * unconfirmedBalance))); ui->lblBalanceSlot3->setText(BitcoinUnits::formatWithUnit(unit, (_dScPriceLast * (balance + stake + unconfirmedBalance + immatureBalance)))); } else if (convertmode == 2) { ui->lblBalanceSlot0->setText(BitcoinUnits::formatWithUnit(unit, (_dScPriceLast / _dBtcPriceLast * balance))); ui->lblBalanceSlot1->setText(BitcoinUnits::formatWithUnit(unit, (_dScPriceLast / _dBtcPriceLast * stake))); ui->lblDetailsSlot0->setText(BitcoinUnits::formatWithUnit(unit, (_dScPriceLast / _dBtcPriceLast * unconfirmedBalance))); ui->lblBalanceSlot3->setText(BitcoinUnits::formatWithUnit(unit, (_dScPriceLast / _dBtcPriceLast * (balance + stake + unconfirmedBalance + immatureBalance)))); } } void OverviewPage::setNumTransactions(int count) { ui->lblDetailsSlot1->setText(QLocale::system().toString(count)); } void OverviewPage::setModel(WalletModel *model) { this->model = model; if (model && model->getOptionsModel()) { // Set up transaction list filter = new TransactionFilterProxy(); filter->setSourceModel(model->getTransactionTableModel()); filter->setLimit(NUM_ITEMS); filter->setDynamicSortFilter(true); filter->setSortRole(Qt::EditRole); filter->setShowInactive(false); filter->sort(TransactionTableModel::Status, Qt::DescendingOrder); ui->listTransactions->setModel(filter); ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress); // Keep up to date with wallet setBalance(model->getBalance(), model->getStake(), model->getUnconfirmedBalance(), model->getImmatureBalance()); connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64, qint64))); setNumTransactions(model->getNumTransactions()); connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int))); connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); } // update the display unit, to not use the default ("BTC") updateDisplayUnit(); } void OverviewPage::updateDisplayUnit() { if (model && model->getOptionsModel()) { if (currentBalance != -1) { setBalance(currentBalance, model->getStake(), currentUnconfirmedBalance, currentImmatureBalance); } // Update txdelegate->unit with the current unit txdelegate->unit = model->getOptionsModel()->getDisplayUnit(); ui->listTransactions->update(); } } void OverviewPage::showOutOfSyncWarning(bool fShow) { if (fShow == true) { ui->lblDetailsSlot3->setText("<font color=\"green\">Synced</font>"); } if (fShow == false) { // ui->lblDetailsSlot3->setText("<span style=\" color:#green;\">Synced</span>"); } }
[ "shadecoin@gmail.com" ]
shadecoin@gmail.com
e25f78e782789a41d2f2b4b4de69de8f88d61c28
0065eafb7a49c7c0ba338f739e6d8929ab20501f
/16 COCI/nov14-3/main.cpp
c9e02cc5ff0c2458fe8984764c244e17f87afe66
[]
no_license
Mau-MD/Competitive-Programming
134f7e4a199f6b080d184726c4ac785fa588cf97
5f1104c898699cdbc0b4ffbe70f176d0628c6e14
refs/heads/master
2023-04-24T06:31:39.644900
2021-05-10T16:11:42
2021-05-10T16:11:42
332,625,995
2
0
null
null
null
null
UTF-8
C++
false
false
271
cpp
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int g, h; cin >> g >> h; if (g == h)cout<<g<<" "<<h<<endl; else cout << ((h + 1) * g) << " " << (h * g) << endl; } return 0; }
[ "a00832956@itesm.mx" ]
a00832956@itesm.mx
48c87e277842df27abe6ccc5759cc5eaf718e88f
13f3ce6623768a5c5dd6f6da05d928966ea1c772
/DB Entrys/Weapon DB.hpp
1285750062bd16a56f045b6c4a00fb0087dcbd9e
[]
no_license
Merimar/WildAltis
71e5295acc9aa80a0bfca99982d834a12431468e
6760acba33bbc0e9c550716911af95572f4a2a19
refs/heads/master
2023-03-28T06:33:05.744296
2021-04-01T17:16:06
2021-04-01T17:16:06
286,337,512
0
0
null
null
null
null
UTF-8
C++
false
false
61,020
hpp
INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_CombatUniform', '4', 'Combat Fatigues [AAF]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_CombatUniform_shortsleeve', '4', 'Combat Fatigues [AAF] (Rolled-up)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Scientist', '4', 'Scientist Clothes'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_blk', '4', 'Cap (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_grn', '4', 'Cap (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_oli', '4', 'Cap (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_tan', '4', 'Cap (Tan)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_blk_Raven', '4', 'Cap [AAF]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_brn_SPECOPS', '4', 'Cap [OPFOR]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_blu', '4', 'Cap (Blue)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_red', '4', 'Cap (Red)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_blk_CMMG', '4', 'Cap (CMMG)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_blk_ION', '4', 'Cap (ION)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_grn_BI', '4', 'Cap (BI)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_press', '4', 'Cap (Press)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_Orange_IDAP_F', '4', 'Cap (Orange) [IDAP]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_Black_IDAP_F', '4', 'Cap (Black) [IDAP]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_White_IDAP_F', '4', 'Cap (White) [IDAP]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_khaki_specops_UK', '4', 'Cap (UK)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_tan_specops_US', '4', 'Cap (US MTP)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_BandMask_blk', '4', 'Bandana Mask (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_oli_hs', '4', 'Cap (Olive, Headset)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_headphones', '4', 'Rangemaster Cap'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Cap_marshal', '4', 'Marshal Cap'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Hat_tan', '4', 'Hat (Tan)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Hat_grey', '4', 'Hat (Grey)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Hat_brown', '4', 'Hat (Brown)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Hat_checker', '4', 'Hat (Checker)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Hat_Safari_olive_F', '4', 'Safari Hat (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Hat_Safari_sand_F', '4', 'Safari Hat (Sand)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Hat_blue', '4', 'Hat (Blue)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Hat_camo', '4', 'Hat (Camo)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_StrawHat', '4', 'Straw Hat'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_StrawHat_dark', '4', 'Straw Hat (Dark)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_TurbanO_blk', '4', 'Black Turban'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Bandanna_camo', '4', 'Bandana (Woodland)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Bandanna_cbr', '4', 'Bandana (Coyote)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Bandanna_gry', '4', 'Bandana (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Bandanna_khk', '4', 'Bandana (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Bandanna_mcamo', '4', 'Bandana (MTP)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Bandanna_sgg', '4', 'Bandana (Sage)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Bandanna_surfer', '4', 'Bandana (Surfer)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Bandanna_khk_hs', '4', 'Bandana (Headset)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Watchcap_blk', '4', 'Beanie'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Watchcap_camo', '4', 'Beanie (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Watchcap_khk', '4', 'Beanie (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Watchcap_sgg', '4', 'Beanie (Sage)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Booniehat_mcamo', '4', 'Booniehat (MTP)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Booniehat_khk_hs', '4', 'Booniehat (Headset)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Booniehat_tna_F', '4', 'Booniehat (Tropic)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Construction_basic_yellow_F', '4', 'Hard Hat (Yellow)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Construction_basic_orange_F', '4', 'Hard Hat (Orange)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Construction_basic_red_F', '4', 'Hard Hat (Red)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Construction_headset_black_F', '4', 'Hard Hat (Black, Headset)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Construction_basic_vrana_F', '4', 'Hard Hat (Vrana)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Construction_basic_white_F', '4', 'Hard Hat (White)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_MilCap_blue', '4', 'Military Cap (Blue)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_MilCap_dgtl', '4', 'Military Cap [AAF]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_MilCap_gry', '4', 'Military Cap (Grey)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_MilCap_mcamo', '4', 'Military Cap (MTP)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_MilCap_ocamo', '4', 'Military Cap (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_MilCap_oucamo', '4', 'Military Cap (Urban)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_MilCap_rucamo', '4', 'Military Cap (Russia)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_MilCap_ghex_F', '4', 'Military Cap (Green Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_MilCap_tna_F', '4', 'Military Cap (Tropic)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Helmet_Skate', '4', 'Skate Helmet'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_EarProtectors_yellow_F', '4', 'Ear Protectors (Yellow)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_EarProtectors_orange_F', '4', 'Ear Protectors (Orange)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_EarProtectors_red_F', '4', 'Ear Protectors (Red)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_EarProtectors_black_F', '4', 'Ear Protectors (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_EarProtectors_white_F', '4', 'Ear Protectors (White)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HeadSet_yellow_F', '4', 'Headset (Yellow)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HeadSet_orange_F', '4', 'Headset (Orange)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HeadSet_red_F', '4', 'Headset (Red)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HeadSet_black_F', '4', 'Headset (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HeadSet_white_F', '4', 'Headset (White)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_BandMask_reaper', '4', 'Bandana Mask (Reaper)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_PASGT_basic_blue_press_F', '4', 'Press Helmet'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Shades_Black', '4', 'Shades (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Shades_Blue', '4', 'Shades (Blue)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Shades_Green', '4', 'Shades (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Shades_Red', '4', 'Shades (Red)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Spectacles', '4', 'Spectacle Glasses'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Spectacles_Tinted', '4', 'Tinted Spectacles'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Sport_Blackred', '4', 'Sport Shades (Vulcan)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Sport_Checkered', '4', 'Sport Shades (Style)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Sport_Blackyellow', '4', 'Sport Shades (Poison)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Sport_BlackWhite', '4', 'Sport Shades (Shadow)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Sport_Greenblack', '4', 'Sport Shades (Yetti)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Sport_Red', '4', 'Sport Shades (Fire)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Squares', '4', 'Square Spectacles'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Aviator', '4', 'Aviator Glasses'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Lady_Blue', '4', 'Ladies Shades'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Tactical_Black', '4', 'Tactical Shades'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Tactical_Clear', '4', 'Tactical Glasses'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Lowprofile', '4', 'Low Profile Goggles'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Combat', '4', 'Combat Goggles'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_EyeProtectors_F', '4', 'Safety Goggles'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_EyeProtectors_Earpiece_F', '4', 'Safety Goggles (Earpiece)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_WirelessEarpiece_F', '4', 'Wireless Earpiece'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Respirator_yellow_F', '4', 'Respirator (Yellow)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_Plain_medical_F', '4', 'Identification Vest [IDAP]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_Safety_yellow_F', '4', 'Safety Vest (Yellow)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_Rangemaster_belt', '4', 'Rangemaster Belt'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_LegStrapBag_coyote_F', '4', 'Leg Strap Bag (Coyote)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_LegStrapBag_olive_F', '4', 'Leg Strap Bag (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_LegStrapBag_black_F', '4', 'Leg Strap Bag (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_DeckCrew_blue_F', '4', 'Deck Crew Vest (Blue)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_DeckCrew_brown_F', '4', 'Deck Crew Vest (Brown)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_DeckCrew_yellow_F', '4', 'Deck Crew Vest (Yellow)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_DeckCrew_green_F', '4', 'Deck Crew Vest (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_DeckCrew_red_F', '4', 'Deck Crew Vest (Red)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_DeckCrew_violet_F', '4', 'Deck Crew Vest (Violet)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_DeckCrew_white_F', '4', 'Deck Crew Vest (White)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_Pocketed_coyote_F', '4', 'Multi-Pocket Vest (Coyote)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_Pocketed_olive_F', '4', 'Multi-Pocket Vest (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_Pocketed_black_F', '4', 'Multi-Pocket Vest (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_RebreatherB', '4', 'Rebreather [NATO]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_Carryall_khk', '4', 'Carryall Backpack (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_Bergen_tna_F', '4', 'Bergen Backpack (Tropic)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_Parachute', '4', 'Steerable Parachute'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('ItemWatch', '4', 'Watch'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('ItemMap', '4', 'Map'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('ItemGPS', '4', 'GPS'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('ItemCompass', '4', 'Compass'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('ToolKit', '4', 'Toolkit'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('Binocular', '4', 'Binoculars'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('Rangefinder', '4', 'Rangefinder'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Poor_1', '4', 'Worn Clothes'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Commoner1_1', '4', 'Commoner Clothes 2'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Poloshirt_blue', '4', 'Commoner Clothes (Blue)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Poloshirt_burgundy', '4', 'Commoner Clothes (Burgundy)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Poloshirt_redwhite', '4', 'Commoner Clothes (Red-White)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Poloshirt_salmon', '4', 'Commoner Clothes (Salmon)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Poloshirt_tricolour', '4', 'Commoner Clothes (Tricolor)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Man_casual_5_F', '4', 'Summer Clothes (Yellow)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Man_casual_6_F', '4', 'Summer Clothes (Red)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Man_casual_4_F', '4', 'Summer Clothes (Sky)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Man_casual_3_F', '4', 'Casual Clothes (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Man_casual_2_F', '4', 'Casual Clothes (Blue)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Man_casual_1_F', '4', 'Casual Clothes (Navy)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_man_sport_1_F', '4', 'Sport Clothes (Beach)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_man_sport_2_F', '4', 'Sport Clothes (Orange)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_man_sport_3_F', '4', 'Sport Clothes (Blue)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_IDAP_Man_cargo_F', '4', 'Aid Worker Clothes (Cargo) [IDAP]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_IDAP_Man_Jeans_F', '4', 'Aid Worker Clothes (Jeans) [IDAP]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_IDAP_Man_shorts_F', '4', 'Aid Worker Clothes (Polo, Shorts) [IDAP]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_IDAP_Man_Tee_F', '4', 'Aid Worker Clothes (Tee) [IDAP]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_IDAP_Man_TeeShorts_F', '4', 'Aid Worker Clothes (Tee, Shorts) [IDAP]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_IG_Guerilla2_2', '4', 'Guerilla Outfit (Pattern)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_OG_Guerilla2_3', '4', 'Guerilla Outfit (Plain, Light)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_IG_Guerilla2_1', '4', 'Guerilla Outfit (Plain, Dark)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_G_Story_Protagonist_F', '4', 'Worn Combat Fatigues (Kerry)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_IG_Guerilla3_2', '4', 'Guerilla Smocks 1'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_IG_Guerilla3_1', '4', 'Guerilla Smocks'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_HunterBody_grn', '4', 'Hunting Clothes'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_Competitor', '4', 'Competitor Suit'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Mechanic_01_F', '4', 'Mechanic Clothes'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_Journalist', '4', 'Journalist Clothes'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_Marshal', '4', 'Marshal Clothes'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_NikosBody', '4', 'Nikos Clothes'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_NikosAgedBody', '4', 'Underwear 1'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_OrestesBody', '4', 'Jacket and Shorts'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_WorkerCoveralls', '4', 'Worker Coveralls'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_ConstructionCoverall_Blue_F', '4', 'Construction Coverall (Blue)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_ConstructionCoverall_Red_F', '4', 'Construction Coverall (Red)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_ConstructionCoverall_Black_F', '4', 'Construction Coverall (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_C_ConstructionCoverall_Vrana_F', '4', 'Construction Coverall (Vrana)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_Press_F', '4', 'Vest (Press)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_TacVest_oli', '4', 'Tactical Vest (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_TacVest_khk', '4', 'Tactical Vest (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_TacVest_brn', '4', 'Tactical Vest (Brown)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_TacVest_blk', '4', 'Tactical Vest (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_TacVest_camo', '4', 'Tactical Vest (Camo)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_AssaultPack_blk', '4', 'Assault Pack (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_AssaultPack_cbr', '4', 'Assault Pack (Coyote)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_AssaultPack_dgtl', '4', 'Assault Pack (Digital)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_AssaultPack_khk', '4', 'Assault Pack (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_AssaultPack_mcamo', '4', 'Assault Pack (MTP)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_AssaultPack_ocamo', '4', 'Assault Pack (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_AssaultPack_rgr', '4', 'Assault Pack (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_AssaultPack_sgg', '4', 'Assault Pack (Sage)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_AssaultPack_Kerry', '4', 'US Assault Pack (Kerry)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_FieldPack_blk', '4', 'Field Pack (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_FieldPack_cbr', '4', 'Field Pack (Coyote)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_FieldPack_ocamo', '4', 'Field Pack (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_FieldPack_khk', '4', 'Field Pack (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_FieldPack_oli', '4', 'Field Pack (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_FieldPack_oucamo', '4', 'Field Pack (Urban)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_BergenC_grn', '4', 'Bergen (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_TacticalPack_oli', '4', 'Tactical Backpack (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_TacticalPack_mcamo', '4', 'Tactical Backpack (MTP)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_TacticalPack_blk', '4', 'Tactical Backpack (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_TacticalPack_ocamo', '4', 'Tactical Backpack (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_TacticalPack_rgr', '4', 'Tactical Backpack (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_Kitbag_rgr', '4', 'Kitbag (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_Kitbag_cbr', '4', 'Kitbag (Coyote)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_Kitbag_mcamo', '4', 'Kitbag (MTP)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_Kitbag_sgg', '4', 'Kitbag (Sage)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_ViperLightHarness_ghex_F', '4', 'Viper Light Harness (Green Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_ViperLightHarness_khk_F', '4', 'Viper Light Harness (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_ViperLightHarness_oli_F', '4', 'Viper Light Harness (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_ViperLightHarness_blk_F', '4', 'Viper Light Harness (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_ViperLightHarness_hex_F', '4', 'Viper Light Harness (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_ViperHarness_ghex_F', '4', 'Viper Harness (Green Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_ViperHarness_khk_F', '4', 'Viper Harness (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_ViperHarness_oli_F', '4', 'Viper Harness (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_ViperHarness_blk_F', '4', 'Viper Harness (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_ViperHarness_hex_F', '4', 'Viper Harness (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_Carryall_mcamo', '4', 'Carryall Backpack (MTP)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_Carryall_ocamo', '4', 'Carryall Backpack (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_Carryall_oli', '4', 'Carryall Backpack (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_Carryall_oucamo', '4', 'Carryall Backpack (Urban)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_Bergen_dgtl_F', '4', 'Bergen Backpack (Digital)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_Bergen_hex_F', '4', 'Bergen Backpack (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_Bergen_mcamo_F', '4', 'Bergen Backpack (MTP)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_Rangemaster', '4', 'Rangemaster Suit'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_B_GEN_Commander_F', '4', 'Gendarmerie Commander Uniform'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_B_Wetsuit', '4', 'Wetsuit [NATO]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_B_survival_uniform', '4', 'Survival Fatigues'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_B_CombatUniform_mcam', '4', 'Combat Fatigues (MTP)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_B_CombatUniform_mcam_tshirt', '4', 'Combat Fatigues (MTP) (Tee)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_O_FullGhillie_lsh', '4', 'Full Ghillie (Lush) [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_O_FullGhillie_sard', '4', 'Full Ghillie (Semi-Arid) [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_O_FullGhillie_ard', '4', 'Full Ghillie (Arid) [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_O_T_FullGhillie_tna_F', '4', 'Full Ghillie (Jungle) [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_O_T_Sniper_F', '4', 'Ghillie Suit (Green Hex) [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_B_T_Sniper_F', '4', 'Ghillie Suit (Tropic) [NATO]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_GhillieSuit', '4', 'Ghillie Suit [AAF]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_O_GhillieSuit', '4', 'Ghillie Suit [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_B_GhillieSuit', '4', 'Ghillie Suit [NATO]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Beret_blk_POLICE', '4', 'Beret (Police)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Beret_02', '4', 'Beret [NATO]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Beret_Colonel', '4', 'Beret [NATO] (Colonel)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_black', '4', 'Combat Helmet (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_camo', '4', 'Combat Helmet (Camo)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_desert', '4', 'Combat Helmet (Desert)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_grass', '4', 'Combat Helmet (Grass)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_tna_F', '4', 'Combat Helmet (Tropic)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_light', '4', 'Light Combat Helmet'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_light_black', '4', 'Light Combat Helmet (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_light_desert', '4', 'Light Combat Helmet (Desert)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_light_grass', '4', 'Light Combat Helmet (Grass)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_light_sand', '4', 'Light Combat Helmet (Sand)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_light_snakeskin', '4', 'Light Combat Helmet (Snakeskin)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_Light_tna_F', '4', 'Light Combat Helmet (Tropic)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_paint', '4', 'Combat Helmet (Spraypaint)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Helmet_Kerry', '4', 'Combat Helmet (Kerry)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_plain_blk', '4', 'Combat Helmet (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_plain_mcamo', '4', 'Combat Helmet (Camo)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_snakeskin', '4', 'Combat Helmet (Snakeskin)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_Enh_tna_F', '4', 'Enhanced Combat Helmet (Tropic)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetCrew_B', '4', 'Crew Helmet [NATO]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetCrew_I', '4', 'Crew Helmet [AAF]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetCrew_O', '4', 'Crew Helmet [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetIA', '4', 'Modular Helmet'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetLeaderO_ocamo', '4', 'Defender Helmet (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetLeaderO_oucamo', '4', 'Defender Helmet (Urban)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetO_ocamo', '4', 'Protector Helmet (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetSpecB', '4', 'Enhanced Combat Helmet'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetSpecB_blk', '4', 'Enhanced Combat Helmet (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetSpecB_paint1', '4', 'Enhanced Combat Helmet (Grass)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetSpecB_paint2', '4', 'Enhanced Combat Helmet (Desert)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetSpecO_blk', '4', 'Assassin Helmet (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetSpecO_ocamo', '4', 'Assassin Helmet (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_PilotHelmetHeli_O', '4', 'Heli Pilot Helmet [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_PilotHelmetHeli_B', '4', 'Heli Pilot Helmet [NATO]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_PilotHelmetHeli_I', '4', 'Heli Pilot Helmet [AAF]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_CrewHelmetHeli_O', '4', 'Heli Crew Helmet [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_CrewHelmetHeli_I', '4', 'Heli Crew Helmet [AAF]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_PASGT_basic_blue_F', '4', 'Basic Helmet (Blue)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_TI_tna_F', '4', 'Stealth Combat Helmet'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Diving', '4', 'Diving Goggles'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_TacVest_blk_POLICE', '4', 'Tactical Vest (Police)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrier1_blk', '4', 'Carrier Lite (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrier2_blk', '4', 'Carrier Rig (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrierSpec_blk', '4', 'Carrier Special Rig (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrierGL_blk', '4', 'Carrier GL Rig (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('B_SCBA_01_F', '4', 'Self-Contained Breathing Apparatus'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('hgun_P07_snds_F', '4', 'P07 9 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('hgun_P07_khk_F', '4', 'P07 9 mm (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('30Rnd_9x21_Mag', '4', '9 mm 30Rnd Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('20Rnd_556x45_UW_mag', '4', '5.56 mm 20Rnd Dual Purpose Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('hgun_ACPC2_F', '4', 'ACP-C2 .45 ACP'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('9Rnd_45ACP_Mag', '4', '.45 ACP 9Rnd Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('hgun_Pistol_heavy_01_F', '4', '4-five .45 ACP'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('11Rnd_45ACP_Mag', '4', '.45 ACP 11Rnd Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('hgun_Pistol_heavy_02_F', '4', 'Zubr .45 ACP'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('6Rnd_45ACP_Cylinder', '4', '.45 ACP 6Rnd Cylinder'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('hgun_PDW2000_F', '4', 'PDW2000 9 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('SMG_02_F', '4', 'Sting 9 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('SMG_01_F', '4', 'Vermin SMG .45 ACP'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('30Rnd_45ACP_Mag_SMG_01', '4', '.45 ACP 30Rnd Vermin Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('30Rnd_556x45_Stanag', '4', '5.56 mm 30rnd Reload Tracer (Yellow) Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_SPAR_01_blk_F', '4', 'SPAR-16 5.56 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_Katiba_C_F', '4', 'Katiba Carbine 6.5 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_Katiba_F', '4', 'Katiba 6.5 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('30Rnd_65x39_caseless_green', '4', '6.5 mm 30Rnd Caseless Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MXC_Black_F', '4', 'MXC 6.5 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MX_Black_F', '4', 'MX 6.5 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('30Rnd_65x39_caseless_mag', '4', '6.5 mm 30Rnd Sand Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_SPAR_02_blk_F', '4', 'SPAR-16S 5.56 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('150Rnd_556x45_Drum_Mag_Tracer_F', '4', '5.56 mm 150Rnd Tracer (Red) Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('LMG_03_F', '4', 'LIM-85 5.56 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('200Rnd_556x45_Box_Tracer_Red_F', '4', '5.56 mm 200Rnd Tracer (Red) Box'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_07_blk_F', '4', 'CMR-76 6.5 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('20Rnd_650x39_Cased_Mag_F', '4', '6.5 mm 20Rnd Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_CTAR_blk_F', '4', 'CAR-95 5.8 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('30Rnd_580x42_Mag_F', '4', '5.8 mm 30Rnd Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MXM_Black_F', '4', 'MXM 6.5 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MX_SW_Black_F', '4', 'MX SW 6.5 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('100Rnd_65x39_caseless_black_mag_tracer', '4', '6.5 mm 100Rnd Tracer Black Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_06_camo_F', '4', 'Mk14 7.62 mm (Camo)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_06_olive_F', '4', 'Mk14 7.62 mm (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('20Rnd_762x51_Mag', '4', '7.62 mm 20Rnd Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_CTARS_blk_F', '4', 'CAR-95-1 5.8mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('100Rnd_580x42_Mag_Tracer_F', '4', '5.8 mm 100Rnd Tracer (Green) Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_ARX_blk_F', '4', 'Type 115 6.5 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('10Rnd_50BW_Mag_F', '4', '.50 BW 10Rnd Caseless Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MSBS65_mark_black_F', '4', 'Promet MR 6.5 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MSBS65_black_F', '4', 'Promet 6.5 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('30Rnd_65x39_caseless_msbs_mag', '4', '6.5 mm 30Rnd Promet Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('SMG_03_TR_black', '4', 'ADR-97 TR 5.7 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('SMG_03_black', '4', 'ADR-97 5.7 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_SPAR_03_blk_F', '4', 'SPAR-17 7.62 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_EBR_F', '4', 'Mk18 ABR 7.62 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_03_F', '4', 'Mk-I EMR 7.62 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_AK12_F', '4', 'AK-12 7.62 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('30Rnd_762x39_Mag_F', '4', '7.62 mm 30Rnd AKM Reload Tracer (Yellow) Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_AK12U_F', '4', 'AKU-12 7.62 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('LMG_Mk200_F', '4', 'Mk200 6.5 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('200Rnd_65x39_cased_Box_Tracer', '4', '6.5 mm 200Rnd Belt Tracer (Yellow)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_02_F', '4', 'MAR-10 .338 (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_02_sniper_F', '4', 'MAR-10 .338 (Sand)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('10Rnd_338_Mag', '4', '.338 LM 10Rnd Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_RPK12_F', '4', 'RPK-12 7.62 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('75rnd_762x39_AK12_Mag_Tracer_F', '4', '7.62 mm 75rnd AK12 Tracer Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_04_tan_F', '4', 'ASP-1 Kir 12.7 mm (Tan)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('10Rnd_127x54_Mag', '4', '12.7 mm 10Rnd Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_05_blk_F', '4', 'Cyrus 9.3 mm (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('10Rnd_93x64_DMR_05_Mag', '4', '9.3 mm 10Rnd Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('LMG_Zafir_F', '4', 'Zafir 7.62 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('150Rnd_762x54_Box_Tracer', '4', '7.62 mm 150Rnd Tracer (Green) Box'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('MMG_02_black_F', '4', 'SPMG .338 (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('130Rnd_338_Mag', '4', '.338 NM 130Rnd Belt'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_LRR_F', '4', 'M320 LRR .408'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_LRR_camo_F', '4', 'M320 LRR .408 (Camo)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_LRR_tna_F', '4', 'M320 LRR .408 (Tropic)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('7Rnd_408_Mag', '4', '.408 7Rnd LRR Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_GM6_F', '4', 'GM6 Lynx 12.7 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('5Rnd_127x108_Mag', '4', '12.7 mm 5Rnd Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('5Rnd_127x108_APDS_Mag', '4', '12.7 mm 5Rnd APDS Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_ACO_grn_smg', '4', 'ACO SMG (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_ACO_grn', '4', 'ACO (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_Aco', '4', 'ACO (Red)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_Holosight_smg', '4', 'Mk17 Holosight SMG'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_Holosight', '4', 'Mk17 Holosight'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_Holosight_smg_blk_F', '4', 'Mk17 Holosight SMG (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_Holosight_blk_F', '4', 'Mk17 Holosight (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_Holosight_khk_F', '4', 'Mk17 Holosight (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_MRCO', '4', 'MRCO'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_ERCO_blk_F', '4', 'ERCO (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_Arco', '4', 'ARCO'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_Hamr', '4', 'RCO'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_DMS', '4', 'DMS'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_DMS_ghex_F', '4', 'DMS (Green Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('acc_pointer_IR', '4', 'IR Laser Pointer'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('acc_flashlight', '4', 'Flashlight'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('bipod_02_F_blk', '4', 'Bipod (Black) [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('bipod_02_F_hex', '4', 'Bipod (Hex) [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('bipod_02_F_tan', '4', 'Bipod (Tan) [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('bipod_03_F_blk', '4', 'Bipod (Black) [AAF]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('bipod_03_F_oli', '4', 'Bipod (Olive) [AAF]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('bipod_01_F_khk', '4', 'Bipod (Khaki) [NATO]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_acp', '4', 'Sound Suppressor (.45 ACP)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_65_TI_blk_F', '4', 'Stealth Sound Suppressor (6.5 mm, Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_H_MG', '4', 'Sound Suppressor LMG (6.5 mm)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_B', '4', 'Sound Suppressor (7.62 mm)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_m_snd_F', '4', 'Sound Suppressor (5.56 mm, Sand)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_m_khk_F', '4', 'Sound Suppressor (5.56 mm, Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_58_blk_F', '4', 'Stealth Sound Suppressor (5.8 mm, Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_B_snd_F', '4', 'Sound Suppressor (7.62 mm, Sand)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_B_khk_F', '4', 'Sound Suppressor (7.62 mm, Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_H_MG_khk_F', '4', 'Sound Suppressor LMG (6.5 mm, Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_H_MG_blk_F', '4', 'Sound Suppressor LMG (6.5 mm, Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_C_Soldier_Bandit_4_F', '4', 'Bandit Clothes (Checkered)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_C_Soldier_Bandit_5_F', '4', 'Bandit Clothes (Tank Top)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_C_Soldier_Bandit_1_F', '4', 'Bandit Clothes (Polo Shirt)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_C_Soldier_Bandit_3_F', '4', 'Bandit Clothes (Tee)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_C_Soldier_Bandit_2_F', '4', 'Bandit Clothes (Skull)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_C_Soldier_Para_2_F', '4', 'Paramilitary Garb (Jacket)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_C_Soldier_Para_4_F', '4', 'Paramilitary Garb (Tank Top)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_C_Soldier_Para_3_F', '4', 'Paramilitary Garb (Shirt)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_C_Soldier_Para_5_F', '4', 'Paramilitary Garb (Shorts)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_C_Soldier_Para_1_F', '4', 'Paramilitary Garb (Tee)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_IG_Guerilla1_1', '4', 'Guerilla Garment'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_IG_leader', '4', 'Guerilla Uniform'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_B_T_Soldier_F', '4', 'Combat Fatigues (Tropic)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_B_T_Soldier_SL_F', '4', 'Recon Fatigues (Tropic)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_OfficerUniform', '4', 'Combat Fatigues [AAF] (Officer)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_O_T_Officer_F', '4', 'Officer Fatigues (Green Hex) [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_O_OfficerUniform_ocamo', '4', 'Officer Fatigues (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_O_CombatUniform_oucamo', '4', 'Fatigues (Urban) [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_O_CombatUniform_ocamo', '4', 'Fatigues (Hex) [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_O_T_Soldier_F', '4', 'Fatigues (Green Hex) [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_HeliPilotCoveralls', '4', 'Heli Pilot Coveralls [AAF]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_pilotCoveralls', '4', 'Pilot Coveralls [AAF]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_O_PilotCoveralls', '4', 'Pilot Coveralls [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_B_CTRG_Soldier_F', '4', 'CTRG Stealth Uniform'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_B_CTRG_Soldier_2_F', '4', 'CTRG Stealth Uniform (Tee)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('U_I_Wetsuit', '4', 'Wetsuit [AAF]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Shemag_khk', '4', 'Shemag mask (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Shemag_olive', '4', 'Shemag (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Shemag_olive_hs', '4', 'Shemag (Olive, Headset)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_Shemag_tan', '4', 'Shemag mask (Tan)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_ShemagOpen_khk', '4', 'Shemag (White)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_ShemagOpen_tan', '4', 'Shemag (Tan)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_PASGT_basic_olive_F', '4', 'Basic Helmet (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetB_sand', '4', 'Combat Helmet (Sand)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetCrew_O_ghex_F', '4', 'Crew Helmet (Green Hex) [CSAT]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetO_oucamo', '4', 'Protector Helmet (Urban)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetO_ghex_F', '4', 'Protector Helmet (Green Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('H_HelmetSpecO_ghex_F', '4', 'Assassin Helmet (Green Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Bandanna_tan', '4', 'Bandana (Tan)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Bandanna_oli', '4', 'Bandana (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Bandanna_blk', '4', 'Bandana (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Bandanna_beast', '4', 'Bandana (Beast)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Bandanna_shades', '4', 'Bandana (Shades)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Bandanna_sport', '4', 'Bandana (Sport)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Bandanna_aviator', '4', 'Bandana (Aviator)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Balaclava_blk', '4', 'Balaclava (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Balaclava_oli', '4', 'Balaclava (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Balaclava_TI_tna_F', '4', 'Stealth Balaclava (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Balaclava_TI_blk_F', '4', 'Stealth Balaclava (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Balaclava_combat', '4', 'Balaclava (Combat Goggles)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('G_Balaclava_lowprofile', '4', 'Balaclava (Low Profile Goggles)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_BandollierB_blk', '4', 'Slash Bandolier (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_BandollierB_cbr', '4', 'Slash Bandolier (Coyote)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_BandollierB_khk', '4', 'Slash Bandolier (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_BandollierB_oli', '4', 'Slash Bandolier (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_BandollierB_rgr', '4', 'Slash Bandolier (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_Chestrig_blk', '4', 'Chest Rig (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_Chestrig_khk', '4', 'Chest Rig (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_Chestrig_oli', '4', 'Chest Rig (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_Chestrig_rgr', '4', 'Chest Rig (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_HarnessO_brn', '4', 'LBV Harness'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_HarnessO_gry', '4', 'LBV Harness (Grey)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_HarnessOGL_brn', '4', 'LBV Grenadier Harness'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_HarnessOGL_gry', '4', 'LBV Grenadier Harness (Grey)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_I_G_resistanceLeader_F', '4', 'Tactical Vest (Stavrou)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_TacVestIR_blk', '4', 'Raven Vest'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrier1_rgr_noflag_F', '4', 'Carrier Lite (Green, No Flag)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrier1_tna_F', '4', 'Carrier Lite (Tropic)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrierL_CTRG', '4', 'CTRG Plate Carrier Rig Mk.1 (Light)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrierIA1_dgtl', '4', 'GA Carrier Lite (Digital)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrierIA2_dgtl', '4', 'GA Carrier Rig (Digital)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrier2_rgr', '4', 'Carrier Rig (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrierH_CTRG', '4', 'CTRG Plate Carrier Rig Mk.2 (Heavy)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrierSpec_mtp', '4', 'Carrier Special Rig (MTP)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrierSpec_rgr', '4', 'Carrier Special Rig (Green)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrierSpec_tna_F', '4', 'Carrier Special Rig (Tropic)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_EOD_IDAP_blue_F', '4', 'EOD Vest (Blue) [IDAP]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_EOD_coyote_F', '4', 'EOD Vest (Coyote)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_EOD_olive_F', '4', 'EOD Vest (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrierGL_mtp', '4', 'Carrier GL Rig (MTP)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrierIAGL_oli', '4', 'GA Carrier GL Rig (Olive)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrierGL_tna_F', '4', 'Carrier GL Rig (Tropic)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_EOD_blue_F', '4', 'EOD Vest (Blue)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_SDAR_F', '4', 'SDAR 5.56 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MK20_F', '4', 'Mk20 5.56 mm (Camo)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_Mk20_plain_F', '4', 'Mk20 5.56 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_AKS_F', '4', 'AKS-74U 5.45 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('30Rnd_545x39_Mag_F', '4', '5.45 mm 30Rnd Reload Tracer (Yellow) Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_TRG21_F', '4', 'TRG-21 5.56 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_SPAR_01_khk_F', '4', 'SPAR-16 5.56 mm (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_SPAR_01_snd_F', '4', 'SPAR-16 5.56 mm (Sand)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_SPAR_02_snd_F', '4', 'SPAR-16S 5.56 mm (Sand)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_SPAR_02_khk_F', '4', 'SPAR-16S 5.56 mm (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_CTAR_hex_F', '4', 'CAR-95 5.8 mm (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_CTAR_ghex_F', '4', 'CAR-95 5.8 mm (Green Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MSBS65_camo_F', '4', 'Promet 6.5 mm (Camo)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MSBS65_sand_F', '4', 'Promet 6.5 mm (Sand)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MSBS65_F', '4', 'Promet 6.5 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MSBS65_mark_camo_F', '4', 'Promet MR 6.5 mm (Camo)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MSBS65_mark_sand_F', '4', 'Promet MR 6.5 mm (Sand)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MSBS65_mark_F', '4', 'Promet MR 6.5 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_AKM_F', '4', 'AKM 7.62 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MX_F', '4', 'MX 6.5 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MXC_F', '4', 'MXC 6.5 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MXC_khk_F', '4', 'MXC 6.5 mm (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MXM_F', '4', 'MXM 6.5 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MXM_khk_F', '4', 'MXM 6.5 mm (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_07_ghex_F', '4', 'CMR-76 6.5 mm (Green Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_07_hex_F', '4', 'CMR-76 6.5 mm (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_ARX_ghex_F', '4', 'Type 115 6.5 mm (Green Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_ARX_hex_F', '4', 'Type 115 6.5 mm (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MX_SW_F', '4', 'MX SW 6.5 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_MX_SW_khk_F', '4', 'MX SW 6.5 mm (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('100Rnd_65x39_caseless_mag_Tracer', '4', '6.5 mm 100Rnd Tracer Sand Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('100Rnd_65x39_caseless_khaki_mag_tracer', '4', '6.5 mm 100Rnd Tracer Khaki Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_01_F', '4', 'Rahim 7.62 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('10Rnd_762x54_Mag', '4', '7.62 mm 10Rnd Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_03_khaki_F', '4', 'Mk-I EMR 7.62 mm (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_03_tan_F', '4', 'Mk-I EMR 7.62 mm (Sand)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_03_woodland_F', '4', 'Mk-I EMR 7.62 mm (Woodland)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_03_multicam_F', '4', 'Mk-I EMR 7.62 mm (Camo)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_AK12U_arid_F', '4', 'AKU-12 7.62 mm (Arid)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_AK12U_lush_F', '4', 'AKU-12 7.62 mm (Lush)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_SPAR_03_snd_F', '4', 'SPAR-17 7.62 mm (Sand)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_SPAR_03_khk_F', '4', 'SPAR-17 7.62 mm (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_05_tan_F', '4', 'Cyrus 9.3 mm (Tan)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_05_hex_F', '4', 'Cyrus 9.3 mm (Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_RPK12_lush_F', '4', 'RPK-12 7.62 mm (Lush)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('arifle_RPK12_arid_F', '4', 'RPK-12 7.62 mm (Arid)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('75Rnd_762x39_Mag_Tracer_F', '4', '7.62 mm 75Rnd AKM Tracer Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('75rnd_762x39_AK12_Lush_Mag_Tracer_F', '4', '7.62 mm 75rnd AK12 Tracer Lush Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('75rnd_762x39_AK12_Arid_Mag_Tracer_F', '4', '7.62 mm 75rnd AK12 Tracer Arid Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_DMR_02_camo_F', '4', 'MAR-10 .338 (Camo)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_GM6_camo_F', '4', 'GM6 Lynx 12.7 mm (Camo)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('srifle_GM6_ghex_F', '4', 'GM6 Lynx 12.7 mm (Green Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('hgun_P07_F', '4', 'P07 9 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('hgun_Rook40_F', '4', 'Rook-40 9 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('hgun_Pistol_01_F', '4', 'PM 9 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('10Rnd_9x21_Mag', '4', '9 mm 10Rnd Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_MRD', '4', 'MRD'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_Yorris', '4', 'Yorris J2'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('SMG_05_F', '4', 'Protector 9 mm'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('30Rnd_9x21_Mag_SMG_02', '4', '9 mm 30Rnd Mag'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_ERCO_snd_F', '4', 'ERCO (Sand)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_ERCO_khk_F', '4', 'ERCO (Khaki)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_Arco_blk_F', '4', 'ARCO (Black)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('optic_Arco_ghex_F', '4', 'ARCO (Green Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_65_TI_ghex_F', '4', 'Stealth Sound Suppressor (6.5 mm, Green Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_65_TI_hex_F', '4', 'Stealth Sound Suppressor (6.5 mm, Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_58_wdm_F', '4', 'Stealth Sound Suppressor (5.8 mm, Green Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_58_hex_F', '4', 'Stealth Sound Suppressor (5.8 mm, Hex)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_PlateCarrier_Kerry', '4', 'US Plate Carrier Rig (Kerry)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_L', '4', 'Sound Suppressor (9 mm)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_H', '4', 'Sound Suppressor (6.5 mm)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('muzzle_snds_M', '4', 'Sound Suppressor (5.56 mm)'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('V_RebreatherIA', '4', 'Rebreather [AAF]'); INSERT INTO life_classnames(classname, type_id, slug) VALUES('75rnd_762x39_AK12_Lush_Mag_F', '4', '7.62 mm 75rnd AK12 Lush Mag');
[ "maxroesgen@gmail.com" ]
maxroesgen@gmail.com
13d31ab1242d230d9d368a6fb003bcbbd869ca46
34145a30380707395c9aeeba42fd383141ff0754
/src/RandomDataGenerator.cpp
be55233d361362fafbb070cc0f97ccf1f9d1ff7e
[]
no_license
MWrobel92/SRPP-Kurierzy
725b81dcdefabcbc33280ef7c90ed978d06f11dc
c8034f0be046c9f36066f020ba393976c41ad13e
refs/heads/master
2021-05-28T17:02:01.503546
2014-12-10T10:21:19
2014-12-10T10:21:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
317
cpp
#include "RandomDataGenerator.h" #include <vector> #include "City.h" using namespace std; RandomDataGenerator::RandomDataGenerator() { } RandomDataGenerator::~RandomDataGenerator() { } /* InputData* RandomDataGenerator::getData() { return new InputData(3, new City(0), vector<City*>{new City(1)}); //FIXME } */
[ "michalwr@op.pl" ]
michalwr@op.pl
9e3976f1643315d99f4cc075a134a6529fe6e169
4193d81314c715c6b4d3e974c9bd704e96ac1595
/ddffield.cpp
0c7d6d8d4eaf4deaa09ed3cda11ae73945b58143
[ "MIT" ]
permissive
katiya-cw/iso8211lib-1.4
ea91c90bcfc01598d829df54b5f8964466db4629
c76cce5f768b01836fcd7777411697a5994f0e32
refs/heads/main
2023-07-17T06:07:10.448829
2021-08-30T06:14:49
2021-08-30T06:14:49
401,234,178
1
0
null
null
null
null
UTF-8
C++
false
false
14,241
cpp
/****************************************************************************** * $Id: ddffield.cpp,v 1.17 2006/04/04 04:24:06 fwarmerdam Exp $ * * Project: ISO 8211 Access * Purpose: Implements the DDFField class. * Author: Frank Warmerdam, warmerdam@pobox.com * ****************************************************************************** * Copyright (c) 1999, Frank Warmerdam * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************** * * $Log: ddffield.cpp,v $ * Revision 1.17 2006/04/04 04:24:06 fwarmerdam * update contact info * * Revision 1.16 2003/07/03 15:38:46 warmerda * some write capabilities added * * Revision 1.15 2001/08/30 21:08:19 warmerda * expand tabs * * Revision 1.14 2001/08/30 02:14:50 warmerda * Provide for control of max number of field instances dumped via environment. * * Revision 1.13 2001/08/27 19:09:00 warmerda * added GetInstanceData() method on DDFField * * Revision 1.12 2001/07/18 04:51:57 warmerda * added CPL_CVSID * * Revision 1.11 2000/09/19 14:09:11 warmerda * fixed dump of binary info * * Revision 1.10 2000/06/13 13:38:39 warmerda * Improved reporting of binary data in Dump method. * Fixed GetRepeatCount() so that short field data can be properly detected. * * Revision 1.9 1999/11/18 19:03:04 warmerda * expanded tabs * * Revision 1.8 1999/11/03 14:04:57 warmerda * Made use of GetSubfieldData() with repeated fixed length * fields much more efficient. * * Revision 1.7 1999/09/21 16:25:32 warmerda * Fixed bug with repeating variable length fields and running out of data. * * Revision 1.6 1999/06/23 02:14:08 warmerda * added support for variable width repeaters to GetRepeatCount() * * Revision 1.5 1999/06/01 19:10:38 warmerda * don't assert on variable length repeating fields * * Revision 1.4 1999/05/07 14:10:49 warmerda * added maxbytes to getsubfielddata() * * Revision 1.3 1999/05/06 15:39:26 warmerda * avoid printing non-ASCII characters * * Revision 1.2 1999/04/27 22:09:50 warmerda * updated docs * * Revision 1.1 1999/04/27 18:45:05 warmerda * New * */ #include "iso8211.h" #include "cpl_conv.h" CPL_CVSID("$Id: ddffield.cpp,v 1.17 2006/04/04 04:24:06 fwarmerdam Exp $"); // Note, we implement no constructor for this class to make instantiation // cheaper. It is required that the Initialize() be called before anything // else. /************************************************************************/ /* Initialize() */ /************************************************************************/ void DDFField::Initialize( DDFFieldDefn *poDefnIn, const char * pachDataIn, int nDataSizeIn ) { pachData = pachDataIn; nDataSize = nDataSizeIn; poDefn = poDefnIn; } /************************************************************************/ /* Dump() */ /************************************************************************/ /** * Write out field contents to debugging file. * * A variety of information about this field, and all it's * subfields is written to the given debugging file handle. Note that * field definition information (ala DDFFieldDefn) isn't written. * * @param fp The standard io file handle to write to. ie. stderr */ void DDFField::Dump( FILE * fp ) { int nMaxRepeat = 8; if( getenv("DDF_MAXDUMP") != NULL ) nMaxRepeat = atoi(getenv("DDF_MAXDUMP")); fprintf( fp, " DDFField:\n" ); fprintf( fp, " Tag = `%s'\n", poDefn->GetName() ); fprintf( fp, " DataSize = %d\n", nDataSize ); fprintf( fp, " Data = `" ); for( int i = 0; i < MIN(nDataSize,40); i++ ) { if( pachData[i] < 32 || pachData[i] > 126 ) fprintf( fp, "\\%02X", ((unsigned char *) pachData)[i] ); else fprintf( fp, "%c", pachData[i] ); } if( nDataSize > 40 ) fprintf( fp, "..." ); fprintf( fp, "'\n" ); /* -------------------------------------------------------------------- */ /* dump the data of the subfields. */ /* -------------------------------------------------------------------- */ int iOffset = 0, nLoopCount; for( nLoopCount = 0; nLoopCount < GetRepeatCount(); nLoopCount++ ) { if( nLoopCount > nMaxRepeat ) { fprintf( fp, " ...\n" ); break; } for( int i = 0; i < poDefn->GetSubfieldCount(); i++ ) { int nBytesConsumed; poDefn->GetSubfield(i)->DumpData( pachData + iOffset, nDataSize - iOffset, fp ); poDefn->GetSubfield(i)->GetDataLength( pachData + iOffset, nDataSize - iOffset, &nBytesConsumed ); iOffset += nBytesConsumed; } } } /************************************************************************/ /* GetSubfieldData() */ /************************************************************************/ /** * Fetch raw data pointer for a particular subfield of this field. * * The passed DDFSubfieldDefn (poSFDefn) should be acquired from the * DDFFieldDefn corresponding with this field. This is normally done * once before reading any records. This method involves a series of * calls to DDFSubfield::GetDataLength() in order to track through the * DDFField data to that belonging to the requested subfield. This can * be relatively expensive.<p> * * @param poSFDefn The definition of the subfield for which the raw * data pointer is desired. * @param pnMaxBytes The maximum number of bytes that can be accessed from * the returned data pointer is placed in this int, unless it is NULL. * @param iSubfieldIndex The instance of this subfield to fetch. Use zero * (the default) for the first instance. * * @return A pointer into the DDFField's data that belongs to the subfield. * This returned pointer is invalidated by the next record read * (DDFRecord::ReadRecord()) and the returned pointer should not be freed * by the application. */ const char *DDFField::GetSubfieldData( DDFSubfieldDefn *poSFDefn, int *pnMaxBytes, int iSubfieldIndex ) { int iOffset = 0; if( poSFDefn == NULL ) return NULL; if( iSubfieldIndex > 0 && poDefn->GetFixedWidth() > 0 ) { iOffset = poDefn->GetFixedWidth() * iSubfieldIndex; iSubfieldIndex = 0; } while( iSubfieldIndex >= 0 ) { for( int iSF = 0; iSF < poDefn->GetSubfieldCount(); iSF++ ) { int nBytesConsumed; DDFSubfieldDefn * poThisSFDefn = poDefn->GetSubfield( iSF ); if( poThisSFDefn == poSFDefn && iSubfieldIndex == 0 ) { if( pnMaxBytes != NULL ) *pnMaxBytes = nDataSize - iOffset; return pachData + iOffset; } poThisSFDefn->GetDataLength( pachData+iOffset, nDataSize - iOffset, &nBytesConsumed); iOffset += nBytesConsumed; } iSubfieldIndex--; } // We didn't find our target subfield or instance! return NULL; } /************************************************************************/ /* GetRepeatCount() */ /************************************************************************/ /** * How many times do the subfields of this record repeat? This * will always be one for non-repeating fields. * * @return The number of times that the subfields of this record occur * in this record. This will be one for non-repeating fields. * * @see <a href="example.html">8211view example program</a> * for demonstation of handling repeated fields properly. */ int DDFField::GetRepeatCount() { if( !poDefn->IsRepeating() ) return 1; /* -------------------------------------------------------------------- */ /* The occurance count depends on how many copies of this */ /* field's list of subfields can fit into the data space. */ /* -------------------------------------------------------------------- */ if( poDefn->GetFixedWidth() ) { return nDataSize / poDefn->GetFixedWidth(); } /* -------------------------------------------------------------------- */ /* Note that it may be legal to have repeating variable width */ /* subfields, but I don't have any samples, so I ignore it for */ /* now. */ /* */ /* The file data/cape_royal_AZ_DEM/1183XREF.DDF has a repeating */ /* variable length field, but the count is one, so it isn't */ /* much value for testing. */ /* -------------------------------------------------------------------- */ int iOffset = 0, iRepeatCount = 1; while( TRUE ) { for( int iSF = 0; iSF < poDefn->GetSubfieldCount(); iSF++ ) { int nBytesConsumed; DDFSubfieldDefn * poThisSFDefn = poDefn->GetSubfield( iSF ); if( poThisSFDefn->GetWidth() > nDataSize - iOffset ) nBytesConsumed = poThisSFDefn->GetWidth(); else poThisSFDefn->GetDataLength( pachData+iOffset, nDataSize - iOffset, &nBytesConsumed); iOffset += nBytesConsumed; if( iOffset > nDataSize ) return iRepeatCount - 1; } if( iOffset > nDataSize - 2 ) return iRepeatCount; iRepeatCount++; } } /************************************************************************/ /* GetInstanceData() */ /************************************************************************/ /** * Get field instance data and size. * * The returned data pointer and size values are suitable for use with * DDFRecord::SetFieldRaw(). * * @param nInstance a value from 0 to GetRepeatCount()-1. * @param pnInstanceSize a location to put the size (in bytes) of the * field instance data returned. This size will include the unit terminator * (if any), but not the field terminator. This size pointer may be NULL * if not needed. * * @return the data pointer, or NULL on error. */ const char *DDFField::GetInstanceData( int nInstance, int *pnInstanceSize ) { int nRepeatCount = GetRepeatCount(); const char *pachWrkData; if( nInstance < 0 || nInstance >= nRepeatCount ) return NULL; /* -------------------------------------------------------------------- */ /* Special case for fields without subfields (like "0001"). We */ /* don't currently handle repeating simple fields. */ /* -------------------------------------------------------------------- */ if( poDefn->GetSubfieldCount() == 0 ) { pachWrkData = GetData(); if( pnInstanceSize != 0 ) *pnInstanceSize = GetDataSize(); return pachWrkData; } /* -------------------------------------------------------------------- */ /* Get a pointer to the start of the existing data for this */ /* iteration of the field. */ /* -------------------------------------------------------------------- */ int nBytesRemaining1, nBytesRemaining2; DDFSubfieldDefn *poFirstSubfield; poFirstSubfield = poDefn->GetSubfield(0); pachWrkData = GetSubfieldData(poFirstSubfield, &nBytesRemaining1, nInstance); /* -------------------------------------------------------------------- */ /* Figure out the size of the entire field instance, including */ /* unit terminators, but not any trailing field terminator. */ /* -------------------------------------------------------------------- */ if( pnInstanceSize != NULL ) { DDFSubfieldDefn *poLastSubfield; int nLastSubfieldWidth; const char *pachLastData; poLastSubfield = poDefn->GetSubfield(poDefn->GetSubfieldCount()-1); pachLastData = GetSubfieldData( poLastSubfield, &nBytesRemaining2, nInstance ); poLastSubfield->GetDataLength( pachLastData, nBytesRemaining2, &nLastSubfieldWidth ); *pnInstanceSize = nBytesRemaining1 - (nBytesRemaining2 - nLastSubfieldWidth); } return pachWrkData; }
[ "noreply@github.com" ]
noreply@github.com
58f725d3cce7b3c9cef5ce5a395447be2fcc8356
b9873d80f8adcf5435fdaaf2cd3f99cb781974ff
/include/ops/declarable/generic/loss/huberLoss.cpp
3e1be64da637d4cfeca4b87f619d730b64acad4b
[ "Apache-2.0" ]
permissive
gluonhq/libnd4j
73b7a0484f31a5ad79cc721274ac48368669f5b7
6be4678caf6f820f5b0fd1a5392c0941936f2e43
refs/heads/master
2021-05-05T21:51:10.024782
2018-01-04T11:45:38
2018-01-04T11:45:38
116,035,267
0
1
null
2018-01-02T16:33:38
2018-01-02T16:33:38
null
UTF-8
C++
false
false
5,288
cpp
// // Created by Yurii Shyrma on 23.11.2017. // #include <ops/declarable/CustomOperations.h> namespace nd4j { namespace ops { ////////////////////////////////////////////////////////////////////////// CUSTOM_OP_IMPL(huber_loss, 3, 1, false, 1, 1) { NDArray<T>* predictions = INPUT_VARIABLE(0); NDArray<T>* weights = INPUT_VARIABLE(1); NDArray<T>* labels = INPUT_VARIABLE(2); NDArray<T>* output = OUTPUT_VARIABLE(0); int reductionMode = INT_ARG(0); // 0 - "none"; 1 - "weighted_sum"; 2 - "weighted_mean"; 3 - "weighted_sum_by_nonzero_weights" T delta = T_ARG(0); // input validation REQUIRE_TRUE(labels->isSameShape(predictions), 0, "CUSTOM_OP loss function huber_loss: labels and predictions arrays have different shapes!"); // weights array can be single scalar or has the same rank as labels, and must be broadcastable to labels REQUIRE_TRUE(!(!weights->isScalar() && weights->rankOf() != labels->rankOf()), 0, "CUSTOM_OP loss function huber_loss: weights array must have the same rank as labels array!"); // check whether broadcast operation is possible for weights array if(!weights->isScalar()) for (int i = 0; i < weights->rankOf(); ++i) REQUIRE_TRUE(!(weights->shapeOf()[i] != labels->shapeOf()[i] && weights->shapeOf()[i] != 1), 0, "CUSTOM_OP loss function huber_loss: shapes of weights array is not broadcastable to labels shape!"); // perform weights broadcasting/tile to labels if needed NDArray<T>* weightsBroad = weights; if(!weights->isScalar() && !weights->isSameShape(predictions)) { // evaluate repeat dimensions for tile operation std::vector<int> reps; for(int i = 0; i < labels->rankOf(); ++i) reps.emplace_back(labels->shapeOf()[i] / weights->shapeOf()[i]); weightsBroad = new NDArray<T>(weights->tile(reps)); } NDArray<T> error = *predictions - *labels; error.template applyTransform<simdOps::Abs<T>>(); NDArray<T> quadratic(error.getShapeInfo(), block.getWorkspace()); error.template applyScalar<simdOps::Min<T>>(delta, &quadratic); NDArray<T> weightedLosses = quadratic*quadratic*(T)0.5 + (error - quadratic)*delta; // multiply weightedLosses on weights if(weights->isScalar()) weightedLosses *= (*weights)(0); else weightedLosses *= (*weights); // regard 4 possible reduction modes below REQUIRE_TRUE(reductionMode==0 || reductionMode==1 || reductionMode==2 || reductionMode==3, 0, "CUSTOM_OP loss function huber_loss: reduction mode has not acceptable value, possible values are 0, 1, 2, 3 !"); switch (reductionMode) { case 0: // 0 - "none", un-reduced weighted losses with the same shape as labels. output->assign(&weightedLosses); break; case 1: { // 1 - "weighted_sum", output is scalar and equal to sum of all elements of weightedLosses array (*output)(0) = weightedLosses.template reduceNumber<simdOps::Sum<T>>(); break; } case 2: { // 2 - "weighted_mean", output is scalar and equal to sum of all elements of weightedLosses array divided by sum of all elements of weightsBroad array T sum; if (weights->isScalar()) sum = (*weights)(0) * weightedLosses.lengthOf(); else sum = weightsBroad->template reduceNumber<simdOps::Sum<T>>(); if (sum == (T)0.) (*output)(0) = (T)0.; else (*output)(0) = weightedLosses.template reduceNumber<simdOps::Sum<T>>() / sum; break; } case 3: { // 3 - "weighted_sum_by_nonzero_weights", output is scalar and equal to scalar sum of all elements of weightedLosses array divided by number of non-zero weights int numOfNonZeroWeights = 0; if(weights->isScalar()) { if((*weights)(0) != (T)0.) numOfNonZeroWeights = weightedLosses.lengthOf(); } else { for(int i = 0; i < weightsBroad->lengthOf(); ++i) if((*weightsBroad)(i) != (T)0.) ++numOfNonZeroWeights; } if (numOfNonZeroWeights == 0) (*output)(0) = (T)0.; else (*output)(0) = weightedLosses.template reduceNumber<simdOps::Sum<T>>() / numOfNonZeroWeights; break; } } STORE_RESULT(*output); if(weightsBroad != weights) delete weightsBroad; return ND4J_STATUS_OK; } DECLARE_SHAPE_FN(huber_loss) { // labels and predictions must have the same shapes NDArray<T>* predictions = INPUT_VARIABLE(0); NDArray<T>* weights = INPUT_VARIABLE(1); NDArray<T>* labels = INPUT_VARIABLE(2); int* outShapeInfo = nullptr; if(INT_ARG(0) != 0) { // in this case output is scalar ALLOCATE(outShapeInfo, block.getWorkspace(), shape::shapeInfoLength(2) /*rank=2*/, int); outShapeInfo[0] = 2; outShapeInfo[1] = outShapeInfo[2] = outShapeInfo[3] = outShapeInfo[4] = 1; outShapeInfo[5] = 0; outShapeInfo[6] = 1; outShapeInfo[7] = 99; } else { // in this case output has the same shape as labels ALLOCATE(outShapeInfo, block.getWorkspace(), shape::shapeInfoLength(labels->rankOf()), int); outShapeInfo[0] = labels->rankOf(); for(int i = 1; i <= outShapeInfo[0]; ++i) outShapeInfo[i] = labels->shapeOf()[i-1]; shape::updateStrides(outShapeInfo, labels->ordering()); } return new ShapeList(outShapeInfo); } // INT_ARG(0) - reduction mode } }
[ "raver119@gmail.com" ]
raver119@gmail.com
a178b7481a3ec85d97830f28ad2238db95036caa
3b60ab1a0012caa821e9cca2ee4156249438c87e
/Inc/stm32_led.hpp
2ca7aff6e98e5d75e17f74370ff888221ab2504e
[]
no_license
shimizu1ssei/Led
0ac1f5dbc173c7fe785ca01dccef87ce28bfc7f8
2af6cbcbc7b68d1778a51b18b4036adb4ffc6026
refs/heads/master
2020-07-12T15:30:52.024692
2019-09-04T11:27:24
2019-09-04T11:27:24
204,852,294
0
2
null
null
null
null
UTF-8
C++
false
false
461
hpp
/* * stm32_led.hpp * * Created on: 2019/08/25 * Author: shimizu issei */ #ifndef STM32_LED_HPP_ #define STM32_LED_HPP_ #include "main.h" class Led { private: enum { LED_ON, LED_OFF, LED_FLASH } state; GPIO_TypeDef* led_GPIOx; uint16_t led_GPIO_Pin; public: Led(GPIO_TypeDef* GPIOx,uint16_t GPIO_Pin); void setOn(); void setOff(); void setFlash(); void interrut_toutine(); }; #endif /* STM32_LED_HPP_ */
[ "shimizu070508@gmail.com" ]
shimizu070508@gmail.com
ca9481268fe13407f597bfd98fbb2c724afb4825
90ce872322538e61829b2063537b5011bf357aee
/WebcamImageDataPipe/TypeCore.h
c9d07f00d0f6743b3488a289fb2dab94f39bdf52
[]
no_license
steinert-a/WebcamImageDataPipe
a64bbdf7cd711312249b0c5b63e7d276e5bb2b83
cd4d43eb5c6b7370486f2a03a48273a7d47244a9
refs/heads/master
2023-03-17T23:14:07.265076
2021-03-09T10:21:19
2021-03-09T10:21:19
345,963,726
0
0
null
null
null
null
UTF-8
C++
false
false
405
h
#pragma once //+-------------------------------------------------------------+ //! core type definition ! //+-------------------------------------------------------------+ #ifndef BYTE #define BYTE unsigned char #endif #ifdef _UNICODE typedef std::wstring tstring; #define to_tstring std::to_wstring #else typedef std::string tstring; #define to_tstring std::to_string #endif
[ "ewigestille@web.de" ]
ewigestille@web.de
b31ce2774e2df4e97a7b42d1423ae320d6ff986b
a62fe79db870e73989ac37adc84976ae056af5f4
/1339A - Filling Diamonds.cpp
2d4bbf9bc52f58313dcb6a2a84d2fae274d2355d
[]
no_license
mdarafat1819/Codeforces
160609e9aa8c58daa6e920116dc4b1ae8a830f4e
2c041d38ba26b723b992629fffa7b269ee0c63a2
refs/heads/master
2021-07-03T23:12:21.671729
2021-04-19T10:27:11
2021-04-19T10:27:11
230,477,481
0
1
null
null
null
null
UTF-8
C++
false
false
184
cpp
#include <bits/stdc++.h> using namespace std; int main() { int t, n; cin>>t; while(t--) { cin>>n; cout<<n<<endl; } return 0; }
[ "noreply@github.com" ]
noreply@github.com
2a2808c58ffb52e74390dff76e9a6b4825042dd3
82abe3a3d45d784dbc90470075356065c598dd45
/include/gnuradio/ieee802_11/ofdm_equalize_symbols.h
3c88556e13381855ded682e796ac0874893f38e8
[]
no_license
syifan/gr-ieee802-11
6cf21cf89f7987493cbe0d79e0f0c366ca76f737
8c8300a537ea2aee9648285facda06efff486e18
refs/heads/master
2021-05-27T21:02:12.680097
2013-11-01T19:04:08
2013-11-01T19:04:08
13,937,179
1
2
null
null
null
null
UTF-8
C++
false
false
1,226
h
/* * Copyright (C) 2013 Bastian Bloessl <bloessl@ccs-labs.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef INCLUDED_GR_IEEE802_11_OFDM_EQUALIZE_SYMBOLS_H #define INCLUDED_GR_IEEE802_11_OFDM_EQUALIZE_SYMBOLS_H #include <gnuradio/ieee802_11/api.h> #include <gnuradio/gr_block.h> namespace gr { namespace ieee802_11 { class GR_IEEE802_11_API ofdm_equalize_symbols : virtual public gr_block { public: typedef boost::shared_ptr<ofdm_equalize_symbols> sptr; static sptr make(bool debug = false); }; } // namespace ieee802_11 } // namespace gr #endif /* INCLUDED_GR_IEEE802_11_OFDM_EQUALIZE_SYMBOLS_H*/
[ "sunyifan112358@gmail.com" ]
sunyifan112358@gmail.com
7b915e52257d86e20f7878b40432921099781eba
f0b7ddd4bcdf99f027a75e283b22a0264ffa05ba
/ShooterStarter/.history/Source/ShooterStarter/ShooterAIController_20200908123440.h
a4db6276cdf9afbec5e6d93637e4646d1c7d0df7
[]
no_license
Onygox/UnrealProjects
cd1d8c29f228a7f8e0e2b84bf3c0102761fd07ef
e079c9593a5d9b794d17a409ff4f5175fbffaa0a
refs/heads/master
2022-12-12T21:19:24.416300
2020-09-11T16:38:08
2020-09-11T16:38:08
277,343,579
0
0
null
null
null
null
UTF-8
C++
false
false
540
h
// Copyright Lionel Miele-Herndon 2020 #pragma once #include "CoreMinimal.h" #include "AIController.h" #include "ShooterAIController.generated.h" /** * */ UCLASS() class SHOOTERSTARTER_API AShooterAIController : public AAIController { GENERATED_BODY() protected: virtual void BeginPlay(); public: virtual void Tick(float DeltaSeconds) override; bool IsDead() const; private: // APawn* PlayerPawn; // UPROPERTY(EditAnywhere) // float AcceptanceRadius = 200; UPROPERTY(EditAnywhere) class UBehaviorTree* AIBehavior; };
[ "miell534@newschool.edu" ]
miell534@newschool.edu
e38821254418de0ac50520ae7dc1dff84f81efc3
702f2a7e9ca8624aff40a6b37eabca7f38b27147
/myQueue.h
ed5c1efed41e66c90fe259df7b241c014a004390
[]
no_license
mfisher1996/Ch8
d2cba7d15e649aaf104830a756cb6ef51b2f8e4b
b6f520409494241a77e437b4cf56249861af554b
refs/heads/master
2020-04-04T18:01:17.962996
2018-11-06T02:33:41
2018-11-06T02:33:41
156,146,661
0
0
null
null
null
null
UTF-8
C++
false
false
2,678
h
// // myQueue.h // Wk10_ch8 // // Created by Mason Fisher on 10/31/18. // Copyright © 2018 Mason Fisher. All rights reserved. // #ifndef myQueue_h #define myQueue_h template<class Type> class queueType{ private: Type * list; int queueFront; int queueRear; int maxSize; public: /** queueType(int) constructor for queueType. sets maxSize of queue equal to int passed. */ queueType(int size = 100){maxSize=size;queueFront = 0; queueRear = 0; list = new Type[maxSize];}; /** ~queueType() deconstructor for queueType. Deletes the list created in the constructor. */ ~queueType(){delete list;}; /** isFullQueue() returns true if the queue is full and returns false otherwise */ bool isFullQueue(){return (queueRear+1 == queueFront);}; /** isEmptyQueue() returns true if queue is empty and returns false otherwise */ bool isEmptyQueue(){return (queueRear == queueFront);}; /** front() returns the item at position queueFront + 1 */ Type front(){return list[queueFront+1];}; /** initializeQueue() sets queueFront and queueRear to 0 */ void initializeQueue(){queueFront = 0; queueRear = 0;}; void moveNthFront(int n); void insertQueue(Type insertItem); void deleteQueue(); }; /** insertQueue(Type) insert item for type specified at object construction. Adds a new Type to the end of the list. */ template<class Type> void queueType<Type>::insertQueue(Type insertItem){ if(!isFullQueue()){ queueRear = (queueRear+1) % maxSize; list[queueRear] = insertItem; }else cout << "/t/tQueue is full.\n"; } /** deleteQueue() Deletes the first item inserted into the queue if the queue is not empty. */ template<class Type> void queueType<Type>::deleteQueue(){ if(!isEmptyQueue()) queueFront = (queueFront+1) % maxSize; else cout << "/t/tQueue is empty.\n"; } /** moveNthFront(int) Moves value at index locaiton int passed to index location queueFront */ template<class Type> void queueType<Type>::moveNthFront(int n){ n = (queueFront + n) % maxSize; Type value = list[n]; if(!isEmptyQueue()){ if(queueFront < n){ for(int i = n; i > (queueFront%maxSize); i--){ list[i] = list[i-1]; } }else{ for(int i = n; i > 0; i--) list[i] = list[i-1]; list[0] = list[maxSize-1]; for(int i = maxSize-1; i > queueFront+1; i--) list[i] = list[i-1]; } } list[queueFront+1] = value; } #endif /* myQueue_h */
[ "masonfisherb@gmail.com" ]
masonfisherb@gmail.com
48861938f9503fbd4c77b23792fa7280a13786b3
c20d50483e6ff4365db55cbcbf623c5ef4b6d70f
/Tour.cpp
5a514ec6e75f65ae84de8f269969d8f1b0cd866b
[]
no_license
larry9315/GeneticAlgorithm
bf7d42a1b0388f57ab437df4fb7b2fe7bc2deded
2d82806422d924dbd45cd30b41f8c4e544e6341b
refs/heads/master
2021-10-25T04:37:29.930483
2019-04-01T05:48:26
2019-04-01T05:48:26
175,111,082
0
0
null
null
null
null
UTF-8
C++
false
false
2,109
cpp
// // Created by larry on 2019-03-23. // #include "Tour.hpp" Tour::Tour() { } Tour::Tour(vector<City>& cities) { //initialization for (int i = 0; i < cities.size(); i++) { City* ptr = &cities[i]; cityVec.push_back(ptr); } randomize(); //fitness calculation assignFitness(); } //randomly shuffles the city vectors void Tour::randomize() { random_shuffle(cityVec.begin(), cityVec.end()); } // uses pythagorean theorem to calculate the distance double Tour::calculateDistance(const City& cityStart, const City& cityEnd) { double xDistance = abs(cityStart.getX() - cityEnd.getX()); double yDistance = abs(cityStart.getY() - cityEnd.getY()); return sqrt(pow(xDistance, 2.0) + pow(yDistance, 2.0)); } // calculates the fitness of the tour void Tour::assignFitness() { int i; fitness = 0; for (i = 0; i < cityVec.size() - 1; i++) { fitness += calculateDistance(*cityVec[i], *cityVec[i + 1]); } fitness += calculateDistance(*cityVec[i], *cityVec[0]); } double Tour::getFitness() { return fitness; } City* Tour::getCity(int index) { return cityVec[index]; } void Tour::addCity(City* city) { cityVec.push_back(city); } //print the route void Tour::printRoute() { for (City* city : cityVec) { cout << "City: " << city->getName() << " -> "; } cout << "City: " << cityVec[0]->getName(); } // check if the city with the same name is in the list of the tour bool Tour::isContainCity(City *city) { for (int i = 0; i < cityVec.size(); i++) { if (cityVec[i]->getName() == city->getName()) { return true; } } return false; } // smudge some cities around depending on mutation rate and evaluate the fitness void Tour::mutate(double mutationRate) { for (int i = 0; i < cityVec.size() - 1; i++) { double r = ((double) rand() / (RAND_MAX)); if (r < mutationRate) { iter_swap(cityVec.begin() + i, cityVec.begin() + i + 1); } } assignFitness(); } void Tour::printSize() { cout << cityVec.size() << endl; }
[ "larry9315@gmail.com" ]
larry9315@gmail.com
8c780ead73e5db4beac3dfc3e0f51b1f783023a5
95dcf1b68eb966fd540767f9315c0bf55261ef75
/build/pc/Boost_1_50_0/boost/mpl/list/aux_/numbered.hpp
6746a0ac57cad9ffad1e4e762ac2a005af866f51
[ "BSL-1.0" ]
permissive
quinsmpang/foundations.github.com
9860f88d1227ae4efd0772b3adcf9d724075e4d1
7dcef9ae54b7e0026fd0b27b09626571c65e3435
refs/heads/master
2021-01-18T01:57:54.298696
2012-10-14T14:44:38
2012-10-14T14:44:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,419
hpp
// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION // Copyright Peter Dimov 2000-2002 // Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id: numbered.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ // $Date: 2008-10-11 14:19:02 +0800 (星期六, 2008-10-11) $ // $Revision: 49267 $ #if defined(BOOST_PP_IS_ITERATING) #include <boost/preprocessor/enum_params.hpp> #include <boost/preprocessor/enum_shifted_params.hpp> #include <boost/preprocessor/dec.hpp> #include <boost/preprocessor/cat.hpp> #define i BOOST_PP_FRAME_ITERATION(1) #if i == 1 template< BOOST_PP_ENUM_PARAMS(i, typename T) > struct list1 : l_item< long_<1> , T0 , l_end > { typedef list1 type; }; #else # define MPL_AUX_LIST_TAIL(list, i, T) \ BOOST_PP_CAT(list,BOOST_PP_DEC(i))< \ BOOST_PP_ENUM_SHIFTED_PARAMS(i, T) \ > \ /**/ template< BOOST_PP_ENUM_PARAMS(i, typename T) > struct BOOST_PP_CAT(list,i) : l_item< long_<i> , T0 , MPL_AUX_LIST_TAIL(list,i,T) > { typedef BOOST_PP_CAT(list,i) type; }; # undef MPL_AUX_LIST_TAIL #endif // i == 1 #undef i #endif // BOOST_PP_IS_ITERATING
[ "wisbyme@yahoo.com" ]
wisbyme@yahoo.com
fdae99eab69d4713447d22c7d3a87e66238bf2af
c7b2fba13b64b250c304da589cc3bc8c6cb1b6da
/leetcode/1-1000/88. Merge Sorted Array/main.cpp
d6c41486d2d6db325ffc6ceb14c593562a1e7cf1
[]
no_license
minhdq99hp/dsa
f690e359c7ecfe0a17955f9b069ff557365d419a
09e40f3b2877472bad9e892c7ff0f1e333ba9ae8
refs/heads/master
2022-12-21T13:36:23.202436
2022-12-15T02:38:37
2022-12-15T02:39:01
203,560,557
5
1
null
null
null
null
UTF-8
C++
false
false
2,335
cpp
class Solution { public: void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) { int j = 0; queue<int> hold; if(n == 0) return; for(int i=0; i<m+n; i++){ if(i < m){ if(hold.empty()){ if(nums2[j] < nums1[i]){ hold.push(nums1[i]); nums1[i] = nums2[j]; j += 1; } } else{ if(j >= n){ // nums2 is empty -> take from queue hold.push(nums1[i]); nums1[i] = hold.front(); hold.pop(); } else if(hold.front() < nums1[i] && nums2[j] < nums1[i]){ if(hold.front() <= nums2[j]){ // take from queue hold.push(nums1[i]); nums1[i] = hold.front(); hold.pop(); } else{ // take from nums2 hold.push(nums1[i]); nums1[i] = nums2[j]; j += 1; } } else if(hold.front() < nums1[i]){ // take from queue hold.push(nums1[i]); nums1[i] = hold.front(); hold.pop(); } else if(nums2[j] < nums1[i]){ // take from nums2 hold.push(nums1[i]); nums1[i] = nums2[j]; j += 1; } } } else{ // check only queue and nums2 if(hold.empty()){ // take from nums2 nums1[i] = nums2[j]; j += 1; } else{ if(j >= n || hold.front() <= nums2[j]){ // take from queue nums1[i] = hold.front(); hold.pop(); } else{ // take from nums2 nums1[i] = nums2[j]; j += 1; } } } } } };
[ "minhdq99hp@gmail.com" ]
minhdq99hp@gmail.com
a14d0118aa2e72b6485a1417197ce8ff2d852678
f803a4ad51d805fd1adacdbcdca07e77a4f84632
/src/bus.h
788dcc4e044f8e9d75ef7c6e6e213011e9466e84
[ "BSD-2-Clause" ]
permissive
ramenhut/simplenes
a1b196d4ee149100cc708b12853c9aca42f859e9
a9a909417679468ba8df379e291479a9589e6c37
refs/heads/master
2021-01-20T19:04:57.112371
2017-03-12T01:35:12
2017-03-12T01:35:12
64,315,291
17
0
null
null
null
null
UTF-8
C++
false
false
3,514
h
/* // Copyright (c) 1998-2008 Joe Bertolami. All Right Reserved. // // bus.h // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Additional Information: // // For more information, visit http://www.bertolami.com. */ #ifndef __SYSTEM_BUS_H__ #define __SYSTEM_BUS_H__ #include "base.h" #include "cart.h" #include "input.h" #define NON_MASKABLE_INTERRUPT_VECTOR (0xFFFA) #define RESET_INTERRUPT_VECTOR (0xFFFC) #define BREAK_INTERRUPT_VECTOR (0xFFFE) #define SYSTEM_RAM_START (0x0000) #define SYSTEM_PPU_REGISTER_START (0x2000) #define SYSTEM_INPUT_REGISTER_START (0x4000) #define SYSTEM_RAM_SIZE (0x0800) #define SYSTEM_PPU_REGISTER_SIZE (0x0008) #define SYSTEM_INPUT_REGISTER_SIZE (0x0018) #define CARTRIDGE_SAVE_RAM_START (0x6000) #define CARTRIDGE_PGR_ROM_START (0x8000) #define CARTRIDGE_SAVE_RAM_SIZE (0x2000) #define CARTRIDGE_PGR_ROM_SIZE (0x8000) #define VIDEO_RAM_SIZE (0x1000) #define PALETTE_RAM_SIZE (0x0020) namespace nes { using namespace base; class virtual_cpu; class virtual_ppu; class system_bus { uint8 *system_ram; uint8 *video_ram; uint8 *palette_ram; virtual_cpu *cpu; virtual_ppu *ppu; cartridge *game_cart; controller* keypads[2]; public: system_bus(); ~system_bus(); void load_cartridge_into_memory(cartridge *input); void attach_ppu(virtual_ppu *input); void attach_cpu(virtual_cpu *input); void attach_controller(uint8 index, controller *cont); void reset(); void fire_interrupt(uint16 interrupt_address); uint8 read_cpu_byte(uint16 address); uint16 read_cpu_short(uint16 address); void write_cpu_byte(uint16 address, uint8 input); void write_cpu_short(uint16 address, uint16 input); uint8 read_ppu_byte(uint16 address); uint16 read_ppu_short(uint16 address); void write_ppu_byte(uint16 address, uint8 input); void write_ppu_short(uint16 address, uint16 input); uint32 query_current_scanline(); rom_header *query_rom_header(); }; } // namespace nes #endif // __SYSTEM_BUS_H__
[ "joebertolami@gmail.com" ]
joebertolami@gmail.com
fb1cb47563cce3964f7a0a9c7fc1da3b00539874
115753727024898f7835592e7fb557edf086f2db
/Visitor/main.cpp
2108a1ddc1d2ea8e45899e0254121a0327a74b88
[]
no_license
ahuang007/Design-Pattern
81bc8500353f23abcc2a0c63b10d793bd06ef682
4a5ff359c0e4db078fe386b5c31183ea8f6085cd
refs/heads/master
2020-12-31T09:12:01.326980
2020-09-25T10:16:37
2020-09-25T10:16:37
238,968,511
1
0
null
null
null
null
UTF-8
C++
false
false
320
cpp
#include "Element.h" #include "Visitor.h" #include <iostream> using namespace std; int main(){ Visitor* visA = new ConcreteVisitorA(); Element* elmA = new ConcreteElementA(); elmA->Accept(visA); Visitor* visB = new ConcreteVisitorB(); Element* elmB = new ConcreteElementB(); elmB->Accept(visB); return 0; }
[ "419637330@qq.com" ]
419637330@qq.com
86776550e02598bd73f2d3e4f4ff206017f177cb
1af49694004c6fbc31deada5618dae37255ce978
/services/device/battery/battery_monitor_impl.h
1ec2624e4fe89571fd838ab9fa4da8b770b94928
[ "BSD-3-Clause" ]
permissive
sadrulhc/chromium
59682b173a00269ed036eee5ebfa317ba3a770cc
a4b950c23db47a0fdd63549cccf9ac8acd8e2c41
refs/heads/master
2023-02-02T07:59:20.295144
2020-12-01T21:32:32
2020-12-01T21:32:32
317,678,056
3
0
BSD-3-Clause
2020-12-01T21:56:26
2020-12-01T21:56:25
null
UTF-8
C++
false
false
1,358
h
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SERVICES_DEVICE_BATTERY_BATTERY_MONITOR_IMPL_H_ #define SERVICES_DEVICE_BATTERY_BATTERY_MONITOR_IMPL_H_ #include <memory> #include "base/macros.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/device/battery/battery_status_service.h" #include "services/device/public/mojom/battery_monitor.mojom.h" namespace device { class BatteryMonitorImpl : public mojom::BatteryMonitor { public: static void Create(mojo::PendingReceiver<mojom::BatteryMonitor> receiver); BatteryMonitorImpl(); ~BatteryMonitorImpl() override; private: // mojom::BatteryMonitor methods: void QueryNextStatus(QueryNextStatusCallback callback) override; void RegisterSubscription(); void DidChange(const mojom::BatteryStatus& battery_status); void ReportStatus(); mojo::SelfOwnedReceiverRef<mojom::BatteryMonitor> receiver_; base::CallbackListSubscription subscription_; QueryNextStatusCallback callback_; mojom::BatteryStatus status_; bool status_to_report_; DISALLOW_COPY_AND_ASSIGN(BatteryMonitorImpl); }; } // namespace device #endif // SERVICES_DEVICE_BATTERY_BATTERY_MONITOR_IMPL_H_
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
a41e84a7aaa832be681b4b29350ab691dfe4bebe
2ba94892764a44d9c07f0f549f79f9f9dc272151
/Engine/Source/Editor/EnvironmentQueryEditor/Private/EdGraphSchema_EnvironmentQuery.cpp
be05b068edcef5435a45ab2782353f02f4bddce6
[ "BSD-2-Clause", "LicenseRef-scancode-proprietary-license" ]
permissive
PopCap/GameIdea
934769eeb91f9637f5bf205d88b13ff1fc9ae8fd
201e1df50b2bc99afc079ce326aa0a44b178a391
refs/heads/master
2021-01-25T00:11:38.709772
2018-09-11T03:38:56
2018-09-11T03:38:56
37,818,708
0
0
BSD-2-Clause
2018-09-11T03:39:05
2015-06-21T17:36:44
null
UTF-8
C++
false
false
5,469
cpp
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "EnvironmentQueryEditorPrivatePCH.h" #include "EdGraphSchema_EnvironmentQuery.h" #include "Toolkits/ToolkitManager.h" #include "EnvironmentQuery/EnvQueryGenerator.h" #include "EnvironmentQuery/Generators/EnvQueryGenerator_Composite.h" #include "EnvironmentQuery/EnvQueryTest.h" #define LOCTEXT_NAMESPACE "EnvironmentQueryEditor" ////////////////////////////////////////////////////////////////////////// UEdGraphSchema_EnvironmentQuery::UEdGraphSchema_EnvironmentQuery(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { } void UEdGraphSchema_EnvironmentQuery::CreateDefaultNodesForGraph(UEdGraph& Graph) const { FGraphNodeCreator<UEnvironmentQueryGraphNode_Root> NodeCreator(Graph); UEnvironmentQueryGraphNode_Root* MyNode = NodeCreator.CreateNode(); NodeCreator.Finalize(); SetNodeMetaData(MyNode, FNodeMetadata::DefaultGraphNode); } void UEdGraphSchema_EnvironmentQuery::GetGraphContextActions(FGraphContextMenuBuilder& ContextMenuBuilder) const { UEnvironmentQueryGraphNode* ParentGraphNode = ContextMenuBuilder.FromPin ? Cast<UEnvironmentQueryGraphNode>(ContextMenuBuilder.FromPin->GetOuter()) : NULL; if (ParentGraphNode && !ParentGraphNode->IsA(UEnvironmentQueryGraphNode_Root::StaticClass())) { return; } FEnvironmentQueryEditorModule& EditorModule = FModuleManager::GetModuleChecked<FEnvironmentQueryEditorModule>(TEXT("EnvironmentQueryEditor")); FGraphNodeClassHelper* ClassCache = EditorModule.GetClassCache().Get(); TArray<FGraphNodeClassData> NodeClasses; ClassCache->GatherClasses(UEnvQueryGenerator::StaticClass(), NodeClasses); FCategorizedGraphActionListBuilder GeneratorsBuilder(TEXT("Generators")); for (const auto& NodeClass : NodeClasses) { const FText NodeTypeName = FText::FromString(FName::NameToDisplayString(NodeClass.ToString(), false)); UEnvironmentQueryGraphNode_Option* OpNode = NewObject<UEnvironmentQueryGraphNode_Option>(ContextMenuBuilder.OwnerOfTemporaries); OpNode->ClassData = NodeClass; TSharedPtr<FAISchemaAction_NewNode> AddOpAction = AddNewNodeAction(GeneratorsBuilder, NodeClass.GetCategory(), NodeTypeName, ""); AddOpAction->NodeTemplate = OpNode; } ContextMenuBuilder.Append(GeneratorsBuilder); } void UEdGraphSchema_EnvironmentQuery::GetSubNodeClasses(int32 SubNodeFlags, TArray<FGraphNodeClassData>& ClassData, UClass*& GraphNodeClass) const { FEnvironmentQueryEditorModule& EditorModule = FModuleManager::GetModuleChecked<FEnvironmentQueryEditorModule>(TEXT("EnvironmentQueryEditor")); FGraphNodeClassHelper* ClassCache = EditorModule.GetClassCache().Get(); ClassCache->GatherClasses(UEnvQueryTest::StaticClass(), ClassData); GraphNodeClass = UEnvironmentQueryGraphNode_Test::StaticClass(); } const FPinConnectionResponse UEdGraphSchema_EnvironmentQuery::CanCreateConnection(const UEdGraphPin* PinA, const UEdGraphPin* PinB) const { // Make sure the pins are not on the same node if (PinA->GetOwningNode() == PinB->GetOwningNode()) { return FPinConnectionResponse(CONNECT_RESPONSE_DISALLOW, TEXT("Both are on the same node")); } if ((PinA->Direction == EGPD_Input && PinA->LinkedTo.Num()>0) || (PinB->Direction == EGPD_Input && PinB->LinkedTo.Num()>0)) { return FPinConnectionResponse(CONNECT_RESPONSE_DISALLOW, TEXT("")); } // Compare the directions bool bDirectionsOK = false; if ((PinA->Direction == EGPD_Input) && (PinB->Direction == EGPD_Output)) { bDirectionsOK = true; } else if ((PinB->Direction == EGPD_Input) && (PinA->Direction == EGPD_Output)) { bDirectionsOK = true; } if (bDirectionsOK) { if ( (PinA->Direction == EGPD_Input && PinA->LinkedTo.Num()>0) || (PinB->Direction == EGPD_Input && PinB->LinkedTo.Num()>0)) { return FPinConnectionResponse(CONNECT_RESPONSE_DISALLOW, TEXT("Already connected with other")); } } else { return FPinConnectionResponse(CONNECT_RESPONSE_DISALLOW, TEXT("")); } return FPinConnectionResponse(CONNECT_RESPONSE_MAKE, TEXT("")); } const FPinConnectionResponse UEdGraphSchema_EnvironmentQuery::CanMergeNodes(const UEdGraphNode* NodeA, const UEdGraphNode* NodeB) const { // Make sure the nodes are not the same if (NodeA == NodeB) { return FPinConnectionResponse(CONNECT_RESPONSE_DISALLOW, TEXT("Both are the same node")); } const bool bNodeAIsTest = NodeA->IsA(UEnvironmentQueryGraphNode_Test::StaticClass()); const bool bNodeAIsOption = NodeA->IsA(UEnvironmentQueryGraphNode_Option::StaticClass()); const bool bNodeBIsTest = NodeB->IsA(UEnvironmentQueryGraphNode_Test::StaticClass()); const bool bNodeBIsOption = NodeB->IsA(UEnvironmentQueryGraphNode_Option::StaticClass()); if (bNodeAIsTest && (bNodeBIsOption || bNodeBIsTest)) { return FPinConnectionResponse(CONNECT_RESPONSE_MAKE, TEXT("")); } return FPinConnectionResponse(CONNECT_RESPONSE_DISALLOW, TEXT("")); } int32 UEdGraphSchema_EnvironmentQuery::GetNodeSelectionCount(const UEdGraph* Graph) const { if (Graph) { TSharedPtr<IEnvironmentQueryEditor> EnvQueryEditor; if (UEnvQuery* QueryAsset = Cast<UEnvQuery>(Graph->GetOuter())) { TSharedPtr< IToolkit > QueryAssetEditor = FToolkitManager::Get().FindEditorForAsset(QueryAsset); if (QueryAssetEditor.IsValid()) { EnvQueryEditor = StaticCastSharedPtr<IEnvironmentQueryEditor>(QueryAssetEditor); } } if (EnvQueryEditor.IsValid()) { return EnvQueryEditor->GetSelectedNodesCount(); } } return 0; } #undef LOCTEXT_NAMESPACE
[ "dkroell@acm.org" ]
dkroell@acm.org
c99cff49dbf1b7c589ab9c84b272575f9c2a81ff
3f23372f56d0744a579bf2413bb4fd85d2535b9d
/examples/ch09/fig09_19-21/Date.cpp
4089592484e0d5175d40f4c4b122bf8a2d423877
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
nguyendo24/CPlusPlus20ForProgrammers
50a23db134c7bd2213ff70bc23c3b13ff49cbaa5
863ace6ade5cea94ebd4c3a6b56589f6ce3c4863
refs/heads/master
2022-12-05T10:57:37.785386
2020-08-18T02:44:56
2020-08-18T02:44:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,645
cpp
// Fig. 9.20: Date.cpp // Date class member-function definitions. #include <string> #include <fmt/format.h> // In C++20, this will be #include <format> #include "Date.h" // include definition of class Date from Date.h using namespace std; // Date constructor (should do range checking) Date::Date(int month, int day, int year) : m_month{month}, m_day{day}, m_year{year} {} // return string representation of a Date in the format month/day/year string Date::toString() const { return fmt::format("{}/{}/{}", m_month, m_day, m_year); } /************************************************************************** * (C) Copyright 1992-2021 by Deitel & Associates, Inc. and * * Pearson Education, Inc. All Rights Reserved. * * * * DISCLAIMER: The authors and publisher of this book have used their * * best efforts in preparing the book. These efforts include the * * development, research, and testing of the theories and programs * * to determine their effectiveness. The authors and publisher make * * no warranty of any kind, expressed or implied, with regard to these * * programs or to the documentation contained in these books. The authors * * and publisher shall not be liable in any event for incidental or * * consequential damages in connection with, or arising out of, the * * furnishing, performance, or use of these programs. * **************************************************************************/
[ "paul@deitel.com" ]
paul@deitel.com
d5554593bf371486aff18ae42b7af5e21ba1c74b
7bcb6cba2e172d32e85be0e854d8993dfb597947
/practica5/include/MundoCliente.h
e8f92ee060f25064f38994c87c7ad3244c4ae493
[]
no_license
Scharfhausen/SII_51478
dbe07ab00efc8bf23137535da484e668de1033cf
f6fc9e9344765fc3b8be8e6ac670ca015340f9a6
refs/heads/master
2020-03-18T10:28:43.126571
2017-12-21T11:29:57
2017-12-21T11:29:57
134,614,686
0
0
null
null
null
null
UTF-8
C++
false
false
1,562
h
//Este código ha sido modificado por Alvaro Zornoza (51540) // Mundo.h: interface for the CMundo class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_MUNDO_H__9510340A_3D75_485F_93DC_302A43B8039A__INCLUDED_) #define AFX_MUNDO_H__9510340A_3D75_485F_93DC_302A43B8039A__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include <vector> #include "Plano.h" #include "Esfera.h" #include "Raqueta.h" //Includes de las tuberias #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> //Includes para la memoria compartida #include "DatosMemCompartida.h" #include <sys/mman.h> //Includes para el cliente-servidor #include <pthread.h> //Includes para sockets #include "Socket.h" class CMundo { public: void Init(); CMundo(); virtual ~CMundo(); void InitGL(); void OnKeyboardDown(unsigned char key, int x, int y); void OnTimer(int value); void OnDraw(); Esfera esfera; std::vector<Plano> paredes; Plano fondo_izq; Plano fondo_dcho; Raqueta jugador1; Raqueta jugador2; int puntos1; int puntos2; //Creación de la tubería //int tuberia; //Creación del atributo de memoria compartida DatosMemCompartida MemComp; DatosMemCompartida* pMemComp; //No se necesitan tuberias cliente-servidor //Sockets para la practica 5 Socket socket_comunicacion; }; #endif // !defined(AFX_MUNDO_H__9510340A_3D75_485F_93DC_302A43B8039A__INCLUDED_)
[ "j.sromero@alumnos.upm.es" ]
j.sromero@alumnos.upm.es
28add9ebb6c13051850d2de0e6296b2a9232ed41
8ec29c000894bb31f30f5a98a1677aff5f61cf45
/曲線描画/【中地講師】曲線サンプル/LaserTest/LaserTest/LaserTest/Scene/GameOverScene.cpp
76ef3e00d715668f814ff401c0f2354ce5ff7a06
[]
no_license
Kasugai0083/LateTask
2fc887b5fafe3766a3cdc25e4b508df96e1aa61e
6a8d08e6e0ef8a5c321ed3875280fbb19b773551
refs/heads/master
2020-11-26T02:56:03.703170
2020-02-05T08:39:00
2020-02-05T08:39:00
228,944,003
0
0
null
null
null
null
UTF-8
C++
false
false
992
cpp
#include "../Engine/Graphics.h" #include "../Engine/Input.h" #include "../Texture/Texture.h" #include "GameOverScene.h" // ゲームオーバーシーンの初期化 void InitGameOverScene(); // ゲームオーバーシーンのメイン void MainGameOverScene(); // ゲームオーバーシーンの終了 SceneId FinishGameOverScene(); SceneId UpdateGameOverScene() { switch (GetCurrentSceneStep()) { case SceneStep::InitStep: InitGameOverScene(); break; case SceneStep::MainStep: MainGameOverScene(); break; case SceneStep::EndStep: return FinishGameOverScene(); break; } return SceneId::GameOverScene; } void DrawGameOverScene() { } void InitGameOverScene() { LoadTexture("Res/GameOverBg.png", TEXTURE_CATEGORY_GAME_OVER, GameOverCategoryTextureList::GameOverBgTex); ChangeSceneStep(SceneStep::MainStep); } void MainGameOverScene() { } SceneId FinishGameOverScene() { ReleaseCategoryTexture(TEXTURE_CATEGORY_GAME_OVER); return SceneId::GameOverScene; }
[ "kasugai0083@gmail.com" ]
kasugai0083@gmail.com
e7650facfaca98032e115e207e5a225131c3d722
1af656c548d631368638f76d30a74bf93550b1d3
/net/third_party/http2/platform/impl/random_util_helper_impl.h
5ca4dd5068399e38c73543f96c0224a638d181ed
[ "BSD-3-Clause" ]
permissive
pineal/chromium
8d246c746141ef526a55a0b387ea48cd4e7d42e8
e6901925dd5b37d55accbac55564f639bf4f788a
refs/heads/master
2023-03-17T05:50:14.231220
2018-10-24T20:11:12
2018-10-24T20:11:12
154,564,128
1
0
NOASSERTION
2018-10-24T20:20:43
2018-10-24T20:20:43
null
UTF-8
C++
false
false
790
h
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_THIRD_PARTY_HTTP2_PLATFORM_IMPL_RANDOM_UTIL_HELPER_IMPL_H_ #define NET_THIRD_PARTY_HTTP2_PLATFORM_IMPL_RANDOM_UTIL_HELPER_IMPL_H_ #include "net/third_party/http2/platform/api/http2_string.h" #include "net/third_party/http2/platform/api/http2_string_piece.h" #include "net/third_party/http2/tools/http2_random.h" namespace http2 { namespace test { Http2String RandomStringImpl(RandomBase* random, int len, Http2StringPiece alphabet); } // namespace test } // namespace http2 #endif // NET_THIRD_PARTY_HTTP2_PLATFORM_IMPL_RANDOM_UTIL_HELPER_IMPL_H_
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
66d1ac90aeac600c7dbb47850b8c6d76ffaacd15
f220418683fb5f270e3f1ce40d69e5390ff4e912
/paddle/fluid/operators/math/im2col_cfo_cpu.h
0d32bc5bd0d7f25479370959cabeb9b9c9e7e2d6
[ "Apache-2.0" ]
permissive
wanghaoshuang/Paddle
dd36299360f44865147889249d95f49a160f689f
8c19599bc640f51b279d95054bbd5eccde210c0c
refs/heads/slim
2023-03-09T06:24:54.702479
2019-02-25T15:36:35
2019-02-25T15:36:35
91,771,236
3
3
Apache-2.0
2019-03-12T05:12:23
2017-05-19T06:05:49
C++
UTF-8
C++
false
false
9,081
h
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #pragma once #include <vector> #include "paddle/fluid/framework/tensor.h" namespace paddle { namespace operators { namespace math { /** * The most common im2col algorithm. * Support dilation, stride and padding. */ template <typename T> inline void im2col_common(const framework::Tensor& im, const std::vector<int>& dilation, const std::vector<int>& stride, const std::vector<int>& padding, framework::Tensor* col) { int im_channels = im.dims()[0]; int im_height = im.dims()[1]; int im_width = im.dims()[2]; int filter_height = col->dims()[1]; int filter_width = col->dims()[2]; int output_height = col->dims()[3]; int output_width = col->dims()[4]; int channels_col = im_channels * filter_height * filter_width; const T* im_data = im.data<T>(); T* col_data = col->data<T>(); for (int c = 0; c < channels_col; ++c) { int w_offset = c % filter_width; int h_offset = (c / filter_width) % filter_height; int c_im = c / (filter_width * filter_height); for (int h = 0; h < output_height; ++h) { int im_row_idx = h * stride[0] - padding[0] + h_offset * dilation[0]; for (int w = 0; w < output_width; ++w) { int im_col_idx = w * stride[1] - padding[1] + w_offset * dilation[1]; int col_idx = (c * output_height + h) * output_width + w; int im_idx = (im_row_idx + c_im * im_height) * im_width + im_col_idx; col_data[col_idx] = (im_row_idx < 0 || im_row_idx >= im_height || im_col_idx < 0 || im_col_idx >= im_width) ? static_cast<T>(0) : im_data[im_idx]; } } } } /** * im2col algorithm with strides == 1, dilations == 1, paddings == 0 */ template <typename T> inline void im2col_sh1sw1dh1dw1ph0pw0(const framework::Tensor& im, framework::Tensor* col) { int im_channels = im.dims()[0]; int im_height = im.dims()[1]; int im_width = im.dims()[2]; int filter_height = col->dims()[1]; int filter_width = col->dims()[2]; int output_height = col->dims()[3]; int output_width = col->dims()[4]; const T* im_data = im.data<T>(); T* col_data = col->data<T>(); int col_matrix_width = output_width * output_height; int im_size = im_height * im_width; size_t copy_size = sizeof(T) * output_width; const T* im_data_oh = im_data; T* dst_data_oh = col_data; for (int oh = 0; oh < output_height; ++oh) { const T* src_data_ic = im_data_oh; T* dst_data = dst_data_oh; for (int ic = 0; ic < im_channels; ++ic) { const T* src_data = src_data_ic; for (int kh = 0; kh < filter_height; ++kh) { for (int kw = 0; kw < filter_width; ++kw) { std::memcpy(dst_data, src_data + kw, copy_size); dst_data = dst_data + col_matrix_width; } src_data = src_data + im_width; } src_data_ic = src_data_ic + im_size; } im_data_oh = im_data_oh + im_width; dst_data_oh = dst_data_oh + output_width; } } /** * im2col algorithm with strides == 1, dilations == 1, paddings == 1 * and filter_width == 1 have a special implementation */ template <typename T> inline void im2col_sh1sw1dh1dw1ph1pw1(const framework::Tensor& im, framework::Tensor* col) { int im_channels = im.dims()[0]; int im_height = im.dims()[1]; int im_width = im.dims()[2]; int filter_height = col->dims()[1]; int filter_width = col->dims()[2]; int output_height = col->dims()[3]; int output_width = col->dims()[4]; constexpr int plh = 1; constexpr int prh = 1; constexpr int plw = 1; constexpr int prw = 1; const T* im_data = im.data<T>(); T* col_data = col->data<T>(); int im_size = im_height * im_width; int col_matrix_width = output_width * output_height; int col_block_fh = filter_width * col_matrix_width; // fw*oh*ow int col_block_ic = filter_height * col_block_fh; // fh*fw*oh*ow // fill height padding { size_t copy_size = sizeof(T) * output_width; T* col_start_l = col_data; T* col_start_r = col_data + (filter_height - 1) * col_block_fh + col_matrix_width - output_width; for (int ic = 0; ic < im_channels; ++ic) { T* dst_data_l = col_start_l; T* dst_data_r = col_start_r; for (int kw = 0; kw < filter_width; ++kw) { std::memset(dst_data_l, 0, copy_size); std::memset(dst_data_r, 0, copy_size); dst_data_l = dst_data_l + col_matrix_width; dst_data_r = dst_data_r + col_matrix_width; } col_start_l = col_start_l + col_block_ic; col_start_r = col_start_r + col_block_ic; } } auto pad = static_cast<T>(0); if (filter_width == 1) { // fill width padding T* dst_data_ic = col_data; for (int ic = 0; ic < im_channels; ++ic) { T* dst_data_kh = dst_data_ic; for (int kh = 0; kh < filter_height; ++kh) { T* dst_data = dst_data_kh; for (int oh = 0; oh < output_height; ++oh) { *dst_data = pad; dst_data = dst_data + output_width - 1; *dst_data = pad; ++dst_data; } dst_data_kh = dst_data_kh + col_block_fh; } dst_data_ic = dst_data_ic + col_block_ic; } // fill core size_t copy_size = sizeof(T) * (output_width - plw - prw); for (int oh = 0; oh < output_height; ++oh) { const T* im_data_start = im_data + (oh - plh > 0 ? oh - plh : 0) * im_width; T* dst_data = col_data + oh * output_width; for (int ic = 0; ic < im_channels; ++ic) { const T* src_data = im_data_start + ic * im_size; for (int kh = 0; kh < filter_height; ++kh) { if ((oh < plh && kh < plh) || (oh > (output_height - prh - 1) && kh > (filter_height - prh - 1))) { dst_data = dst_data + col_matrix_width; continue; } std::memcpy(dst_data + plw, src_data, copy_size); dst_data = dst_data + col_matrix_width; src_data = src_data + im_width; } } } return; } // filter_width != 1 // fill width padding T* dst_data_ic = col_data; for (int ic = 0; ic < im_channels; ++ic) { T* dst_data_kh = dst_data_ic; for (int kh = 0; kh < filter_height; ++kh) { for (T* dst_data : {dst_data_kh, dst_data_kh + (filter_width - prw) * col_matrix_width + output_width - 1}) { // TODO(TJ): from plh, saving repeated assignment for (int oh = 0; oh < output_height; ++oh) { *dst_data = pad; dst_data = dst_data + output_width; } } dst_data_kh = dst_data_kh + col_block_fh; } dst_data_ic = dst_data_ic + col_block_ic; } // TODO(TJ): use array like: size_t copy_size[kw]={sizeof(T) * // (output_width-1)} // length of copy_size is equal kw. for (int oh = 0; oh < output_height; ++oh) { const T* im_data_start = im_data + (oh - plh > 0 ? oh - plh : 0) * im_width; T* dst_data = col_data + oh * output_width; for (int ic = 0; ic < im_channels; ++ic) { const T* src_data = im_data_start + ic * im_size; for (int kh = 0; kh < filter_height; ++kh) { if ((oh < plh && kh < plh) || (oh > (output_height - prh - 1) && kh > (filter_height - prh - 1))) { dst_data = dst_data + filter_width * col_matrix_width; continue; } // TODO(TJ): reuse plw-kw outside this for // try to unify for (int kw = 0; kw < plw; ++kw) { std::memcpy(dst_data + (plw - kw), src_data, sizeof(T) * (output_width - (plw - kw))); dst_data = dst_data + col_matrix_width; } for (int kw = plw; kw < filter_width - prw; ++kw) { std::memcpy(dst_data, src_data + (kw - plw), sizeof(T) * output_width); dst_data = dst_data + col_matrix_width; } int i = 1; for (int kw = filter_width - prw; kw < filter_width; ++kw, ++i) { std::memcpy(dst_data, src_data + (kw - plw), sizeof(T) * (output_width - i)); dst_data = dst_data + col_matrix_width; } src_data = src_data + im_width; } } } } } // namespace math } // namespace operators } // namespace paddle
[ "tangjian03@baidu.com" ]
tangjian03@baidu.com
ca52128f12e34a91b718361f92c0676558edb43b
c2bc339753e08d2249c7eea412c3d6739048a76f
/FractalX/FractalX/Messages.cpp
7e304d2945a2dd28f1cba7708e9493300aa55839
[]
no_license
sjr213/fractalx
071680481de9f805d44543f33e48354fd9a61b76
4e7837bc9b8edf08b5eaf0eeb05fcbefc5ff7c98
refs/heads/master
2022-02-05T14:27:34.587816
2022-01-08T21:45:27
2022-01-08T21:45:27
144,908,700
0
0
null
null
null
null
UTF-8
C++
false
false
1,297
cpp
#include "stdafx.h" #include "Messages.h" const UINT cMessage::tm_finish = RegisterWindowMessage(_T("Finish calculation")); const UINT cMessage::tm_updateprogress = RegisterWindowMessage(_T("Update progress")); const UINT cMessage::tm_render = RegisterWindowMessage(_T("Render 3D if needed")); const UINT cMessage::tm_killPaletteView = RegisterWindowMessage(_T("Kill palette view")); const UINT cMessage::tm_pinsChanged = RegisterWindowMessage(_T("Pins changed")); const UINT cMessage::tm_pinEditDlgClosed = RegisterWindowMessage(_T("Pin edit dlg closed")); const UINT cMessage::tm_killPositionAngleDlg = RegisterWindowMessage(_T("Kill position angle dialog")); const UINT cMessage::tm_mouseCoords = RegisterWindowMessage(_T("Mouse coordinates")); const UINT cMessage::tm_clickIDs = RegisterWindowMessage(_T("Click IDs")); const UINT cMessage::tm_modelPositionChanged = RegisterWindowMessage(_T("Model Position Changed")); const UINT cMessage::tm_modelAngleChanged = RegisterWindowMessage(_T("Model Angle Changed")); const double PROGRESS_SIZE = 10000; WPARAM cMessage::MakeWPARAMProgress(double progress) { return static_cast<WPARAM>(PROGRESS_SIZE * progress + 0.5); } double cMessage::MakeDoubleProgress(WPARAM progress) { return static_cast<double>(progress) / PROGRESS_SIZE; }
[ "sjrobles@yahoo.com" ]
sjrobles@yahoo.com
884344026d2077ff094539ea542440f385af7eb7
5acd15b218d4afd8d1a4f54d1aa855686c9be1b8
/GraphicsEngine/IRenderer.h
bbaeaf63a43e128f2c1c62172c128bac0abf4e34
[]
no_license
Kikuzero/GraphicsEngine
af717b738b8757c54388f040c9681494cdd1be37
784ec65a4405c2bd235340265c02e3b691cd85b9
refs/heads/main
2023-04-03T02:42:42.823424
2020-12-19T05:47:02
2020-12-19T05:47:02
320,292,787
0
0
null
null
null
null
UTF-8
C++
false
false
318
h
#pragma once #include <GL/glew.h> #include <GLFW/glfw3.h> #include <iostream> #include "IndexBuffer.h" #include "VertexArray.h" #include "Shader.h" namespace GraphicsEngine { class IRenderer { public: virtual void Draw(const VertexArray&, const IndexBuffer&, const Shader&) const = 0; }; }
[ "vovaazarov@gmail.com" ]
vovaazarov@gmail.com
71dc62ae73a18172102007a87d1651412dde96b7
bb608853d87c1b51e6cc8a71d037b8480855b6aa
/SrcGame/src/HoBaram/NewEffect/HoEffectView.h
a486e18b7d6d1ea7d10ab01233b60e3b2eaae1ea
[]
no_license
tobiasquinteiro/Source-GothicPT
9b8373f9025b82b4bf5d37e53de610e2ad5bef51
6542d5c6ab8b797cb6d83f66bde5ea0cd663d0e6
refs/heads/master
2022-12-31T04:43:21.159375
2020-10-26T00:26:34
2020-10-26T00:26:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,287
h
#ifndef _HO_EFFECT_VIEW_H_ #define _HO_EFFECT_VIEW_H_ #include "math\\mathGlobal.h" #include "math\\point3.h" #include "math\\color4.h" #include "HoNewEffectHeader.h" #ifndef _HO_NEW_WIN32_ #include ".\\smlib3d\\smd3d.h" #endif #ifdef _HO_NEW_WIN32_ #include "..\\..\\smlib3d\\smd3d.h" #endif #include <list> enum { BILLBOARD_DEFAULT, BILLBOARD_AXIAL, CREATE_MESH, }; class SBillboardRenderInfo { public: int m_Type; point3 m_Pos; point3 m_DesPos; point3 m_Size; point3 m_Angle; color4 m_Color; int m_MatID; int m_iBlendType; SBillboardRenderInfo() : m_Type(BILLBOARD_DEFAULT), m_Pos(0.f, 0.f, 0.f), m_DesPos(0.f, 0.f, 0.f), m_Size(0.f, 0.f, 0.f), m_Angle(0.f, 0.f, 0.f), m_Color(1.f, 1.f, 1.f, 1.f), m_iBlendType(SMMAT_BLEND_LAMP){}; }; class SMeshRenderInfo { public: point3 m_Pos; point3 m_Scale; point3 m_Angle; color4 m_Color; int m_iCurrentFrame; smPAT3D *m_Pat; int m_iBlendType; SMeshRenderInfo() : m_Pos(0.f, 0.f, 0.f), m_Scale(0.f, 0.f, 0.f), m_Angle(0.f, 0.f, 0.f), m_Color(1.f, 1.f, 1.f, 1.f), m_iCurrentFrame(0), m_iBlendType(SMMAT_BLEND_LAMP){}; }; class SLineListRenderInfo { public: int m_iBlendType; color4 m_Color; point3 m_Size; std::list<point3> *m_pList; int m_MatID; SLineListRenderInfo() : m_Color(1.f, 1.f, 1.f, 1.f), m_Size(2.f, 2.f, 0.f), m_MatID(-1), m_pList(NULL), m_iBlendType(SMMAT_BLEND_LAMP){}; }; class HoEffectView { public: HoEffectView(); ~HoEffectView(); public: static bool UpdateBillboard(const SBillboardRenderInfo *renderInfo, int ix, int iy, int iz, int ax, int ay, int az); static bool UpdateMesh(const SMeshRenderInfo *renderInfo, int iX, int iY, int iZ, int ax, int ay, int az); static bool UpdateLineList(const SLineListRenderInfo *renderInfo, int ix, int iy, int iz, int ax, int ay, int az); }; #endif
[ "oarthurdev@gmail.com" ]
oarthurdev@gmail.com
4337e8ddd3bf1e8a9af9941afb08fd1c61659263
d0fb46aecc3b69983e7f6244331a81dff42d9595
/cloudwf/include/alibabacloud/cloudwf/model/GetLatestStaStatisticResult.h
52a52d5434092caab0acec1691e458df594333ce
[ "Apache-2.0" ]
permissive
aliyun/aliyun-openapi-cpp-sdk
3d8d051d44ad00753a429817dd03957614c0c66a
e862bd03c844bcb7ccaa90571bceaa2802c7f135
refs/heads/master
2023-08-29T11:54:00.525102
2023-08-29T03:32:48
2023-08-29T03:32:48
115,379,460
104
82
NOASSERTION
2023-09-14T06:13:33
2017-12-26T02:53:27
C++
UTF-8
C++
false
false
1,656
h
/* * Copyright 2009-2017 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ALIBABACLOUD_CLOUDWF_MODEL_GETLATESTSTASTATISTICRESULT_H_ #define ALIBABACLOUD_CLOUDWF_MODEL_GETLATESTSTASTATISTICRESULT_H_ #include <string> #include <vector> #include <utility> #include <alibabacloud/core/ServiceResult.h> #include <alibabacloud/cloudwf/CloudwfExport.h> namespace AlibabaCloud { namespace Cloudwf { namespace Model { class ALIBABACLOUD_CLOUDWF_EXPORT GetLatestStaStatisticResult : public ServiceResult { public: GetLatestStaStatisticResult(); explicit GetLatestStaStatisticResult(const std::string &payload); ~GetLatestStaStatisticResult(); std::string getMessage()const; std::string getErrorMsg()const; std::string getData()const; int getErrorCode()const; bool getSuccess()const; protected: void parse(const std::string &payload); private: std::string message_; std::string errorMsg_; std::string data_; int errorCode_; bool success_; }; } } } #endif // !ALIBABACLOUD_CLOUDWF_MODEL_GETLATESTSTASTATISTICRESULT_H_
[ "haowei.yao@alibaba-inc.com" ]
haowei.yao@alibaba-inc.com
bcb1a984ba3c7ffa7199665fb11669147391170e
2afe2b142af12d8e08f882d61bdd38e3ffdf225b
/src/FBullsCowsGame.cxx
311a7c33a3664866aa61de6612eac8dbb192927c
[]
no_license
jhaubrich/bulls-and-cows-game
104aa692ac80812b89ca18b57b546b992195f506
dac31244cbe85282da86e38c3053e6d38ad4dfea
refs/heads/master
2020-03-17T21:42:40.871606
2018-05-18T19:30:52
2018-05-18T19:30:52
133,970,863
0
0
null
null
null
null
UTF-8
C++
false
false
48
cxx
#include <iostream> #include "FBullsCowsGame.h"
[ "state_of_the_geos@faa.none" ]
state_of_the_geos@faa.none
d16325880368bf0b3433987a20be7a9e27ae2a15
c5c9e66187321a5d047310972ef2cd6d1089d5b8
/phone_book/callList.h
ceef1819ebfd55fa18288db5fee1e2e2df68b6bf
[]
no_license
smokys123/Phone_Book
9eb8ee033da326c37f48dd0be9ac9bd7c832ca55
dbf016479f326f738e50641cc88bde3d7f32312f
refs/heads/master
2021-01-21T17:22:43.454367
2017-03-28T15:27:59
2017-03-28T15:27:59
85,184,286
0
0
null
null
null
null
UHC
C++
false
false
263
h
#pragma once #include "call.h" class CallHistory { public: //CallHistory의 attribute vector<Call> callhistory; //통화목록을 파일에서 읽고 쓰기위한 method bool readTextFile(const string&); bool saveTextFile(const string&); };
[ "smkoy123@hanyang.ac.kr" ]
smkoy123@hanyang.ac.kr
1fee0e23f584a7c7b12af6ba529ba404882967c0
f911345bb7aae8902935fd8dce02858b5bc3f652
/Home Works/HW_3/Code/Task 1/mc10d_1_b.cpp
a5a50ed2888af9c8a3e9cb59609c3e1a29e90382
[]
no_license
sayem-eee-kuet/High-Performence-Scientific-Computing
a0b991d70c34eb8f579d38a03e1d9b6c5769b378
217f5ee4aed8d921635f03a3908efb93b240dfdc
refs/heads/master
2023-01-12T18:13:10.551450
2020-11-18T03:08:42
2020-11-18T03:08:42
294,141,175
1
0
null
null
null
null
UTF-8
C++
false
false
4,063
cpp
/******************* * 10D Monte Carlo ********************/ #include <iostream> #include <cstdlib> #include <ctime> #include <cmath> #include <chrono> using namespace std; double integration_fqn(unsigned long long int NumPoint, int dimention); // main calculation double error_per_step(double current, double previous); //Error calculation double fqn(double *x, int y); // Lets take a simple fqn: f(x) = x in 10D. // To check where is the point double interval_map(double lowerLim, double upperLim); // mapping the interval double volume(double a, double b, int dim); //, double a2, double b2); // function for 2D voulume calculation int main(int argc, char **argv) { //double intigral = 0.0; srand(time(NULL)); //Declearation and Initialization of the variables unsigned long long int N = atoll(argv[1]); // Number of Random point int dimention = 10; //auto t_start = std::chrono::high_resolution_clock::now(); // In this case 10D intigration integration_fqn(N, dimention); // auto t_end = std::chrono::high_resolution_clock::now(); //std::chrono::duration<double, std::milli> duration = (t_end - t_start); // cout << N << " " << piN << " " << error(piN) << endl; return 0; } double integration_fqn(unsigned long long int NumPoint, int dimention) { auto t_start = std::chrono::high_resolution_clock::now(); unsigned long long int N_attemps = NumPoint; //Total Number of points //double I = 0.0; //Approximate integration double a = -1.0; //lower bound double b = 1.0; // upper bound //int D = dimention; double *x; x = new double[dimention]; double sum = 0.0; double V = volume(a, b, dimention); unsigned long long int check = 4; double previous = 0.0; for (unsigned long long int i = 0; i < N_attemps; ++i) { for (int j = 0; j < dimention; ++j) { x[j] = interval_map(a, b); } sum = sum + fqn(x, dimention); if (i == check) { double current = V * sum / double(i); double err_per_step = error_per_step(current, previous); previous = current; check = 4 * check; auto t_end = std::chrono::high_resolution_clock::now(); std::chrono::duration<double, std::milli> duration = (t_end - t_start); cout << i << " " << current << " " << err_per_step << " " << duration.count()/1000<<endl; //cout << i << " " << current << " " << err_per_step << endl; } } delete[] x; return 0; } double interval_map(double lowerLim, double upperLim) { /************************************************************** * Mapping the [0,1]=>[lowerLim, upperLim] * f(x) = mx + c, f(0) = lowerLim and f(1) = upperLim * Solving this we get, f(x) = (upperLim-lowerLim)x + lowerLim ***************************************************************/ // double upperLim = b; // double lowerLim = a; double randomNumber = ((double)rand()) / ((double)RAND_MAX); return ((upperLim - lowerLim) * randomNumber + lowerLim); } /********************************************************* * ****************f(x) = x in 10D: ********************** * f(x1,x2....,x10) = 1 + x1 + x2 + x3 +...+ x10 = 2**10 * **********************************************************/ double fqn(double *x, int dim) { double value = 0.0; for (int i = 0; i < dim; ++i) { value = value + x[i]; } value = 1 + value; return value; } double volume(double a, double b, int dim) //, double a2, double b2) { int length = b - a; /************* * V = L**dim **************/ return std::pow(length, dim); } double error_per_step(double a, double b) { // const double pi = 3.141592653589793; // double absolute_error = fabs(piN - pi); // return absolute_error; return fabs(a - b); }
[ "skhan2@umassd.edu" ]
skhan2@umassd.edu
905495877ffe6189116b47d0514c90a558ac7c56
33ac633b566c21f00a6073fba2f896020cd7f62c
/SDO/SDOInfo.cpp
bd54f42b5c8becf2f83b238b889c9246cfb7323d
[]
no_license
orichisonic/GMServer_20091221
ef4d454d4b78d01b49b8752eed2170c3419af22a
19847f86a45a2706ddf645a2ca9e98f80affb198
refs/heads/master
2020-03-13T04:33:08.253747
2018-04-25T07:29:55
2018-04-25T07:29:55
130,965,261
0
0
null
null
null
null
GB18030
C++
false
false
88,676
cpp
#include "StdAfx.h" #include "SDOInfo.h" #pragma warning(disable:4129) CSDOInfo::CSDOInfo(void) { } CSDOInfo::~CSDOInfo(void) { } //初始化类中的变量 COperVector * CSDOInfo::initialize(CSession * pSess,CEnumCore::Message_Tag_ID MessageTagID, unsigned char * pbuf, int length) { COperVector * operVector = NULL; try { ZeroMemory(localIP, 20); ZeroMemory(SDO_DBName, 64); ZeroMemory(Log_DBName, 64); ZeroMemory(Item_DBName, 64); logFile.ReadValue("scheme", "DATABASE","Address",localIP, 20);//获取本地的数据库地址 logFile.ReadValue("SDO", "DATABASE","DBName",SDO_DBName, 64);//获取游戏数据库名称 logFile.ReadValue("SDO", "DATABASE","LogDBName",Log_DBName, 64);//获取日志数据库名称 logFile.ReadValue("SDO", "DATABASE","ItemDBName",Item_DBName, 64);//获取道具数据库名称 //调用基类初始化方法 operVector = CGameInfo::initialize(pSess, MessageTagID, pbuf, length); } catch(...) { } return operVector; } //查询玩家基本资料信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_UserInfo(int userByID, char * ServerName, char * ServerIP,char * Account,char * NickName,int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_UserInfo", "", operName, ServerName, Account); operSDO.WriteText("SDO",strLog); //获取远程操作的Sql语句 if(strcmp("",Account)) { if(!operSDO.getRemoteSql("SDO", "SDO_CharInfo_Account",operRemoteSql,1)) { return DBTFLV;//无法得到查询玩家角色信息的sql语句 } DBTFLV=GameDBQuery("SDO",ServerIP,0,iIndex,iPageSize,operRemoteSql,SDO_DBName,SDO_DBName,SDO_DBName,SDO_DBName,Account); } else { if(!operSDO.getRemoteSql("SDO", "SDO_CharInfo_Nick",operRemoteSql,1)) { return DBTFLV;//无法得到查询玩家角色信息的sql语句 } // printf(operRemoteSql,SDO_DBName,SDO_DBName,SDO_DBName,SDO_DBName,"\%",NickName,"\%"); DBTFLV=GameDBQuery("SDO",ServerIP,0,iIndex,iPageSize,operRemoteSql,SDO_DBName,SDO_DBName,SDO_DBName,SDO_DBName,"\%",NickName,"\%"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查询玩家帐号信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_AccountInfo(int userByID, char * ServerName, char * ServerIP,char * Account,char * NickName,int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_AccountInfo", "", operName,ServerName,Account); operSDO.WriteText("SDO",strLog); //获取远程操作的Sql语句 if(strcmp("",Account)) { if(!operSDO.getRemoteSql("SDO","SDO_MemberInfo_Account",operRemoteSql, 1)) { return DBTFLV;//无法得到查询玩家帐号信息的sql语句 } // printf(operRemoteSql,SDO_DBName,SDO_DBName,Account); DBTFLV=GameDBQuery("SDO",ServerIP,0,iIndex,iPageSize,operRemoteSql,SDO_DBName,SDO_DBName,Account); } else { if(!operSDO.getRemoteSql("SDO","SDO_MemberInfo_Nick",operRemoteSql, 1)) { return DBTFLV;//无法得到查询玩家帐号信息的sql语句 } // sprintf(operszSql,operRemoteSql,SDO_DBName,SDO_DBName,"\%",NickName,"\%"); DBTFLV=GameDBQuery("SDO",ServerIP,0,iIndex,iPageSize,operRemoteSql,SDO_DBName,SDO_DBName,"\%",NickName,"\%"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查询玩家物品 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_ItemInfo(int userByID, char * ServerName, char * ServerIP,char * Account, int UserID,int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_ItemInfo", "", operName,ServerName,Account); operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2)) { return DBTFLV;//无法获取真正的服务器IP } if(!operSDO.getRemoteSql("SDO","SDO_ItemInfo_Query",operRemoteSql,1)) { return DBTFLV;//无法得到查询玩家物品信息的sql语句 } DBTFLV=GameDBQuery("SDO",ServerIP,0,iIndex,iPageSize,operRemoteSql,Item_DBName,Item_DBName,UserID); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查询玩家宠物信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_PetInfo(int userByID,char * ServerName, char * ServerIP,char * Account, int UserID,int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_PetInfo", "", operName,ServerName,Account); operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2)) { return DBTFLV;//无法获取真正的服务器IP } if(!operSDO.getRemoteSql("SDO", "SDO_PetInfo_Query",operRemoteSql,1)) { return DBTFLV;//无法得到查询玩家宠物信息的sql语句 } // sprintf(operszSql,operRemoteSql,Item_DBName,Item_DBName,Item_DBName,UserID);//构造完整查询的sql语句 DBTFLV=GameDBQuery("SDO",ServerIP,0,iIndex,iPageSize,operRemoteSql,Item_DBName,Item_DBName,Item_DBName,UserID); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查看玩家的宠物删除信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_PetDrop(int userByID, char * ServerName, char * ServerIP,char * Account, int UserID,int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_PetDrop", "", operName,ServerName,Account); operSDO.WriteText("SDO",strLog); char tempServerIp[20]; if(!operSDO.GetServerIP(tempServerIp,ServerIP,3)) { return DBTFLV;//无法获取真正的服务器IP } if(!operSDO.getRemoteSql("SDO", "SDO_PetDrop_Query",operRemoteSql, 1)) { return DBTFLV;//无法得到查询玩家宠物删除信息的sql语句 } // sprintf(operszSql,operRemoteSql,Log_DBName,SDO_DBName,UserID);//构造完整查询的sql语句 DBTFLV=GameDBQuery("SDO",tempServerIp,0,iIndex,iPageSize,operRemoteSql,Log_DBName,SDO_DBName,UserID); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查询玩家账号登录记录 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_LoginLog(int userByID, char * ServerName, char * ServerIP,char * Account,int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_LoginLog", "", operName,ServerName,Account); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO", "SDO_UserLogin_Query",operRemoteSql,1)) { return DBTFLV;//无法得到查询玩家账号登录记录的sql语句 } // sprintf(operszSql,operRemoteSql,Log_DBName,Account);//构造完整查询的sql语句 DBTFLV=GameDBQuery("SDO",ServerIP,0,iIndex,iPageSize,operRemoteSql,Log_DBName,Account); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查询玩家物品赠送记录 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_UserTrade_Log(int userByID, char * ServerName, char * ServerIP,char * Account,char * NickName,int itype, int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_UserTrade_Log", "", operName,ServerName,NickName); operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,3)) { return DBTFLV;//无法获取真正的服务器IP } if(itype == 1)//玩家作为发送人 { if(!operSDO.getRemoteSql("SDO", "SDO_TradeLog_Sender",operRemoteSql,1)) { return DBTFLV;//无法得到查询玩家物品赠送记录的sql语句 } // printf(operRemoteSql, Log_DBName, Account, Log_DBName, Account); DBTFLV=GameDBQuery("SDO",ServerIP,0,iIndex,iPageSize,operRemoteSql, Log_DBName, Account, Log_DBName, Account); } else if(itype == 2)//玩家作为接收人 { if(!operSDO.getRemoteSql("SDO","SDO_TradeLog_Recver",operRemoteSql,1)) { return DBTFLV;//无法得到查询玩家物品赠送记录的sql语句 } // printf(operRemoteSql, Log_DBName, "\%", NickName, "\%", Log_DBName, "\%", NickName, "\%"); DBTFLV=GameDBQuery("SDO",ServerIP,0,iIndex,iPageSize,operRemoteSql, Log_DBName, "\%", NickName, "\%", Log_DBName, "\%", NickName, "\%"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查询玩家消费记录 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_UserConsume(int userByID, char * ServerName, char * ServerIP,char * Account,char * NickName,int iMoneytype, char *ItemName, char *BeginTime, char *EndTime, int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_UserConsume", "", operName,ServerName,NickName); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO", "SDO_UserConsume",operRemoteSql,1)) { return DBTFLV;//无法得到查询玩家消费记录的sql语句 } DBTFLV=GameDBQuery("SDO",ServerIP,0,iIndex,iPageSize,operRemoteSql,Log_DBName,Account,iMoneytype,BeginTime,EndTime,"\%",ItemName,"\%", Log_DBName,Account,iMoneytype,BeginTime,EndTime,"\%",ItemName,"\%"); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查看玩家当前状态(服务器/房间/在线状态) vector<CGlobalStruct::TFLV> CSDOInfo::SDO_UserStatus(int userByID, char * ServerName, char * ServerIP,char * Account,int UserID,int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_UserStatus", "", operName,ServerName,Account); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO","SDO_UserStatus",operRemoteSql, 1)) { return DBTFLV;//无法得到查看玩家当前状态的sql语句 } // printf(operRemoteSql,SDO_DBName,SDO_DBName,UserID); DBTFLV=GameDBQuery("SDO",ServerIP,0,iIndex,iPageSize,operRemoteSql,SDO_DBName,SDO_DBName,UserID); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查看玩家婚姻状态 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_UserMarriage(int userByID, char * ServerName, char * ServerIP,char * Account,char * NickName,int UserID,int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_UserMarriage", "", operName,ServerName,NickName); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO","SDO_UserMarriage",operRemoteSql,1)) { return DBTFLV;//无法得到查看玩家婚姻状态的sql语句 } DBTFLV=GameDBQuery("SDO",ServerIP,0,iIndex,iPageSize,operRemoteSql,UserID,UserID,UserID,UserID,SDO_DBName,SDO_DBName,SDO_DBName,UserID,UserID); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查看玩家摇摇乐获得物品 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_YYItem_QUERY(int userByID, char * ServerName, char * ServerIP,char * Account,int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_YYItem_QUERY", "", operName,ServerName,Account); operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,3)) { return DBTFLV;//无法获取真正的服务器IP } if(!operSDO.getRemoteSql("SDO", "SDO_RewardItem_Query",operRemoteSql,1)) { return DBTFLV;//无法得到查看玩家摇摇乐获得物品的sql语句 } DBTFLV=GameDBQuery("SDO",ServerIP,0,iIndex,iPageSize,operRemoteSql,Log_DBName,Account); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //强制玩家下线 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_KickPlayer_Off(int userByID, char * ServerName, char * ServerIP,char * Account, int UserID) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_KickPlayer", "", "", operName,ServerName,Account); int IsOnline = 0; if(!operSDO.getRemoteSql("SDO","SDO_UserOnline_Status",operRemoteSql,1)) { return DBTFLV;//无法得到获取玩家在线状态的sql语句 } operSDO.QuerySingleValue(&IsOnline, "SDO", ServerIP, 0, operRemoteSql, SDO_DBName, UserID);//获取玩家是否在线的状态 if(IsOnline != 1)//玩家不在线 { DBTFLV = operSDO.ReturnOpMsg(strLog,"SDO_UserNotOnline");//将错误信息写入日志中并返回错误信息 } else { if(!operSDO.getRemoteSql("SDO", "SDO_KickPlayer_Off",operRemoteSql,1)) { return DBTFLV;//无法得到强制玩家下线的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO",ServerIP,0,operRemoteSql,SDO_DBName,UserID); if(tmpLength == 0) { DBTFLV = operSDO.ReturnOpMsg(strLog,"KickPlayer_Fail");//将错误信息写入日志中并返回错误信息 } else { DBTFLV = operSDO.ReturnOpMsg(strLog,"KickPlayer_Success");//将错误信息写入日志中并返回错误信息 } } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查询玩家封停状态 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_UserBanStatus(int userByID, char * ServerName, char * ServerIP,char * Account,int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_UserBanStatus", "", operName,ServerName,Account); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO","SDO_Banishment_Query",operRemoteSql,1)) { return DBTFLV;//无法得到查询玩家封停状态的sql语句 } // sprintf(operszSql,operRemoteSql,SDO_DBName,Account); DBTFLV=GameDBQuery("SDO",ServerIP,0,iIndex,iPageSize,operRemoteSql,SDO_DBName,Account); if (DBTFLV.empty()) { DBTFLV = operSDO.ReturnOpMsg(strLog,"ACOUNT_CLOSEED"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //封停玩家帐号 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_Account_Close(int userByID, char * ServerName, char * ServerIP,char * Account,char *BanReason) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_Account_Close", "", "", operName,ServerName,Account,BanReason); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO","SDO_Account_Close",operRemoteSql,1)) { return DBTFLV;//无法得到封停玩家帐号的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO",ServerIP, 0,operRemoteSql,SDO_DBName,SDO_DBName,Account); if(tmpLength == 0) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Account_Close_Fail"); } else { operSDO.GetLogText(strLog, "SDO_Account_Close", "", "Success", operName,ServerName,Account,BanReason); operSDO.WriteDBLog(userByID,"SDO","SDO_Account_Close",ServerIP,strLog); if(!operSDO.getRemoteSql("SDO","SDO_BanAccount_Local",operRemoteSql,1)) { return DBTFLV;//无法得到封停玩家帐号的sql语句 } tmpLength = 0; // printf(operRemoteSql, userByID, Account, BanReason, ServerIP); tmpLength = GameDBOper("SDO",localIP, 4, operRemoteSql, userByID, Account, BanReason, ServerIP); if(tmpLength == 0) { DBTFLV = operSDO.ReturnOpMsg(strLog,"MiddleState"); } else { DBTFLV = operSDO.ReturnOpMsg(strLog,"Account_Close_Success"); } } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //查询所有被封停帐号列表 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_QueryBan_All(int userByID, char * ServerName, char * ServerIP,int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage1", "SDO_QueryBanAll", "", operName,ServerName); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO","SDO_QueryBan_All",operRemoteSql,1)) { return false;//无法得到查询所有被封停帐号列表的sql语句 } DBTFLV=GameDBQuery("SDO",localIP,4,iIndex,iPageSize,operRemoteSql,ServerIP); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //解封玩家帐号 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_Account_Open(int userByID, char * ServerName, char * ServerIP,char * Account,char *UnbindReason) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_Account_Open", "", "", operName,ServerName,Account,UnbindReason); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO","SDO_Account_Open",operRemoteSql,1)) { return DBTFLV;//无法得到解封玩家帐号的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO",ServerIP, 0,operRemoteSql,SDO_DBName,Account); if(tmpLength == 0) { operSDO.WriteDBLog(userByID,"SDO","SDO_Account_Open",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Account_Open_Fail"); } else { operSDO.GetLogText(strLog, "SDO_Account_Open", "", "Success", operName,ServerName,Account,UnbindReason); operSDO.WriteDBLog(userByID,"SDO","SDO_Account_Open",ServerIP,strLog); if(!operSDO.getRemoteSql("SDO","SDO_UnbindAccount_Local",operRemoteSql,1)) { return DBTFLV;//无法得到本地解封玩家帐号的sql语句 } tmpLength = 0; tmpLength = GameDBOper("SDO",localIP, 0,operRemoteSql, Account, ServerIP); if(tmpLength == 0) { DBTFLV = operSDO.ReturnOpMsg(strLog,"MiddleState"); } else { DBTFLV = operSDO.ReturnOpMsg(strLog,"Account_Open_Success"); } } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //查询公告信息列表 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_NoticeInfo(int userByID, char * ServerName, char * ServerIP,int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage2", "SDO_NoticeInfo", "", operName); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO", "SDO_NoticeInfo",operRemoteSql,1)) { return DBTFLV;//无法得到查询所有被封停帐号列表的sql语句 } // sprintf(operszSql,operRemoteSql);//构造完整查询的sql语句 DBTFLV = BroadTask_Query("SDO",operRemoteSql,iIndex,iPageSize); // DBTFLV=GameDBQuery("SDO",localIP,4,iIndex,iPageSize,operRemoteSql); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //添加公告信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_AddNotice(int userByID, char * ServerName, char * ServerIP, char *BoardMessage, char *BeginTime, char *EndTime, int interval, int iNoticeType) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { int iAtonce ; char strNotice[10]; ZeroMemory(strNotice, 10); /* if (iNoticeType == 1) //及时公告 { logFile.ReadValue("SDO", "NOTICETYPE", "NOtice_inTime", strNotice, 10); iAtonce = -1; } else //定时公告 { logFile.ReadValue("SDO", "NOTICETYPE", "NOtice_Time", strNotice, 10); iAtonce = 0; } */ //获取公告类型名称<strNotice>以及类型标识<iAtonce> GetNoticeType(strNotice, iAtonce, iNoticeType); //写发送公告的日志 operSDO.GetLogText(strLog, "SDO_AddNotice", "", "", operName, ServerName, BoardMessage,BeginTime, EndTime, interval, strNotice); operSDO.WriteText("SDO",strLog); sprintf(operszSql,"exec SDO_TaskList_Insert %i,'%s','%s','%s','%s',%i", userByID,ServerIP,BoardMessage,BeginTime, EndTime, interval); int tmpLength = 0; tmpLength = GameDBOper("SDO",localIP,4,"exec SDO_TaskList_Insert %i,'%s','%s','%s','%s',%i,%i", userByID,ServerIP,BoardMessage,BeginTime, EndTime, interval, iAtonce); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_AddNotice", "", "Fail", operName, ServerName, BoardMessage,BeginTime, EndTime, interval, strNotice); operSDO.WriteDBLog(userByID,"SDO","SDO_AddNotice",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Add_Notice_Fail"); } else { operSDO.GetLogText(strLog, "SDO_AddNotice", "", "Success", operName, ServerName, BoardMessage,BeginTime, EndTime, interval, strNotice); operSDO.WriteDBLog(userByID,"SDO","SDO_AddNotice",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Add_Notice_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //查询发送公告的大区列表信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_BoardCity_Query(int userByID, int taskID,int iIndex,int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_BoardCity_Query", "", "", operName, taskID); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO", "SDO_BoardCity_Query",operRemoteSql,1)) { return DBTFLV;//无法得到查询发送公告的大区列表信息的sql语句 } DBTFLV = GameDBQuery("SDO",localIP,4, iIndex, iPageSize, operRemoteSql,taskID); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //修改公告信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_EditNotice(int userByID, char * ServerName, char * ServerIP, int taskID, char *BoardMessage, char *BeginTime, char *EndTime, int interval,int status,int iNoticeType) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { int iAtonce ; char strNotice[10]; ZeroMemory(strNotice, 10); /* if (iNoticeType == 1) //及时公告 { logFile.ReadValue("SDO", "NOTICETYPE", "NOtice_inTime", strNotice, 10); iAtonce = -1; } else //定时公告 { logFile.ReadValue("SDO", "NOTICETYPE", "NOtice_Time", strNotice, 10); iAtonce = 0; } */ //获取公告类型名称<strNotice>以及类型标识<iAtonce> GetNoticeType(strNotice, iAtonce, iNoticeType); operSDO.GetLogText(strLog, "SDO_EditNotice", "", "", operName, taskID,ServerName,BoardMessage,BeginTime,EndTime,interval,status, strNotice); operSDO.WriteText("SDO",strLog); int tmpLength = 0; tmpLength = GameDBOper("SDO", localIP, 4, "exec SDO_TaskList_Update %i,'%s',%i,'%s','%s','%s',%i,%i,%i", userByID,ServerIP,taskID,BoardMessage,BeginTime, EndTime, interval, status,iAtonce); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_EditNotice", "", "Fail", operName, taskID,ServerName,BoardMessage,BeginTime,EndTime,interval,status, strNotice); operSDO.WriteDBLog(userByID,"SDO","SDO_EditNotice",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Edit_Notice_Fail"); } else { operSDO.GetLogText(strLog, "SDO_EditNotice", "", "Success", operName, taskID,ServerName,BoardMessage,BeginTime,EndTime,interval,status, strNotice); operSDO.WriteDBLog(userByID,"SDO","SDO_EditNotice",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Edit_Notice_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //查询家族基本信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_FamilyInfo(int userByID, char * ServerName, char * ServerIP, char *FamilyName, int iIndex, int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_FamilyInfo", "SDO_UserInfo", "", operName, ServerName, FamilyName); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO","SDO_FamilyInfo_Query",operRemoteSql,1)) { return DBTFLV;//无法得到查询家族基本信息的sql语句 } // printf(operRemoteSql,SDO_DBName,SDO_DBName,SDO_DBName, "\%", FamilyName, "\%"); DBTFLV = GameDBQuery("SDO",ServerIP,0, iIndex, iPageSize, operRemoteSql,SDO_DBName,SDO_DBName,SDO_DBName, "\%", FamilyName, "\%"); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查询家族成员信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_FamilyMember(int userByID, char * ServerName, char * ServerIP, int FamilyID, char *FamilyName, int iIndex, int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_FamilyInfo", "SDO_MemberInfo", "", operName, ServerName, FamilyName); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO", "SDO_FamilyMember_Query",operRemoteSql,1)) { return DBTFLV;//无法得到查询家族成员信息的sql语句 } // printf(operRemoteSql,SDO_DBName,SDO_DBName,SDO_DBName,FamilyID); DBTFLV = GameDBQuery("SDO",ServerIP,0, iIndex, iPageSize, operRemoteSql,SDO_DBName,SDO_DBName,SDO_DBName,FamilyID); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查询申请中家族成员信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_FamilyFormal(int userByID, char * ServerName, char * ServerIP, int FamilyID, char *FamilyName, int iIndex, int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_FamilyInfo", "SDO_ApplicationMember", "", operName, ServerName, FamilyName); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO", "SDO_Family_ApplicMember",operRemoteSql,1)) { return DBTFLV;//无法得到查询申请中家族成员信息的sql语句 } // printf(operRemoteSql,SDO_DBName,SDO_DBName,FamilyID); DBTFLV = GameDBQuery("SDO",ServerIP,0, iIndex, iPageSize, operRemoteSql,SDO_DBName,SDO_DBName,FamilyID); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查询家族勋章信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_FamilyBadge(int userByID, char * ServerName, char * ServerIP, int FamilyID, char *FamilyName, int iIndex, int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_FamilyInfo", "SDO_BadgeInfo", "", operName, ServerName, FamilyName); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO","SDO_FamilyBadge_Query",operRemoteSql,1)) { return DBTFLV;//无法得到查询家族勋章信息的sql语句 } // printf(operRemoteSql,SDO_DBName,SDO_DBName,SDO_DBName,FamilyID); DBTFLV = GameDBQuery("SDO",ServerIP,0, iIndex, iPageSize, operRemoteSql,SDO_DBName,SDO_DBName,SDO_DBName,FamilyID); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查询家族金库捐赠明细 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_FamilyDonate(int userByID, char * ServerName, char * ServerIP, int FamilyID, char *FamilyName, char *BeginTime, char *EndTime,int iIndex, int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_FamilyInfo", "SDO_DonateInfo", "", operName, ServerName, FamilyName); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO","SDO_FamilyDonate_Query",operRemoteSql,1)) { return DBTFLV;//无法得到查询家族金库捐赠明细的sql语句 } // printf(operRemoteSql,SDO_DBName,SDO_DBName,FamilyID,BeginTime,EndTime); DBTFLV = GameDBQuery("SDO",ServerIP,0, iIndex, iPageSize, operRemoteSql,SDO_DBName,SDO_DBName,FamilyID,BeginTime,EndTime); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //查询家族购买记录 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_FamilyConsume(int userByID, char * ServerName, char * ServerIP, int FamilyID, char *FamilyName, char *BeginTime, char *EndTime,int iIndex, int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_FamilyInfo", "SDO_FamilyConsume", "", operName, ServerName, FamilyName); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO","SDO_FamilyConsume_Query",operRemoteSql,1)) { return DBTFLV;//无法得到查询家族金库捐赠明细的sql语句 } DBTFLV = GameDBQuery("SDO",ServerIP,0, iIndex, iPageSize, operRemoteSql,SDO_DBName,SDO_DBName,SDO_DBName,FamilyID,BeginTime,EndTime); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //修改家族成员职务 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_ModiMemDuty(int userByID, char * ServerName, char * ServerIP, char *NickName, int UserID, int FamilyID, char *FamilyName, int type) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { int type = 0; type = StrToInt((char *)&(recvVect.getTLVByTag(CEnumCore::TagName::SDO_Type,0)).lpdata);//成员的职务类型 char MemDuty[10]; ZeroMemory(MemDuty, 10); if(type == 255) { logFile.ReadValue("SDO","Code","Shaikh",MemDuty,10);//族长 } if(type == 2) { logFile.ReadValue("SDO","Code","AssistShaikh",MemDuty,10);//副族长 } if(type == 0) { logFile.ReadValue("SDO","Code","CommonMem",MemDuty,10);//普通成员 } if(type == 1) { logFile.ReadValue("SDO","Code","Admin",MemDuty,10);//管理员 } operSDO.GetLogText(strLog, "SDO_ModiMemDuty", "", "", operName, ServerName, FamilyName, NickName, MemDuty); operSDO.WriteText("SDO",strLog); if(type == 255)//如果要修改玩家为族长 { int ShaikhNum = 0;//初始化家族族长个数信息 if(!operSDO.getRemoteSql("SDO","SDO_FamilyShaikh_Query",operRemoteSql,1)) { return DBTFLV;//无法得到查询家族族长信息的sql语句 } operSDO.QuerySingleValue(&ShaikhNum, "SDO", ServerIP, 0, operRemoteSql, SDO_DBName, FamilyID);//获取家族族长的个数 if(ShaikhNum != 0)//如果已经存在家族族长 { DBTFLV = operSDO.ReturnOpMsg(strLog, "SDO_ShaiExist"); return DBTFLV; } } if(!operSDO.getRemoteSql("SDO","SDO_Update_MemDuty",operRemoteSql,1)) { return DBTFLV;//无法得到修改玩家职务信息的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,SDO_DBName,type,MemDuty,FamilyID,UserID); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_ModiMemDuty", "", "Fail", operName, ServerName, FamilyName, NickName, MemDuty); operSDO.WriteDBLog(userByID,"SDO","SDO_ModiMemDuty",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog, "Update_Member_Fail"); } else { operSDO.GetLogText(strLog, "SDO_ModiMemDuty", "", "Success", operName, ServerName, FamilyName, NickName, MemDuty); operSDO.WriteDBLog(userByID,"SDO","SDO_ModiMemDuty",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog, "Update_Member_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog, "Error"); } return DBTFLV; } //解散家族 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_DeleteFamily(int userByID, char * ServerName, char * ServerIP, int FamilyID, char *FamilyName) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_FamilyDelete", "", "", operName, ServerName, FamilyName); operSDO.WriteText("SDO",strLog); char TableFlag[20]; char TableName[40]; ZeroMemory(TableFlag,20);//初始化表的标识符 ZeroMemory(TableName,40);//初始化表名称 logFile.ReadValue("SDO","TABLE","TabelName",TableName,40);//获取家族徽章的表名称 if(!operSDO.getRemoteSql("SDO","SDO_FamSelDBInfo",operRemoteSql,1)) { return DBTFLV;//无法得到查询家族的徽章相关信息的sql语句 } sprintf(operszSql,operRemoteSql,SDO_DBName,SDO_DBName,FamilyID);//构造完整查询的sql语句 if(!operSDO.BackupDataBase("",localIP,0,TableName,"SDO",ServerIP,0,operszSql))//将查询得到的数据插入到T_sdo_personal_emblem表里面 { return DBTFLV; } if(!operSDO.getRemoteSql("SDO","SDO_FamilyDBInfo",operRemoteSql,1)) { return DBTFLV;//无法得到查询家族的相关数据库信息的sql语句 } char TableNum[4]; ZeroMemory(TableNum,4); logFile.ReadValue("SDO","TABLE","TabelNum", TableNum, 4);//获取要备份的表的数量 int intTableNum = StrToInt(TableNum); int i=1; for(i=1; i<=intTableNum; i++) { sprintf(TableFlag,"%s%i","TabelName",i); logFile.ReadValue("SDO","TABLE",TableFlag,TableName,40);//获取相应的家族表名称 sprintf(operszSql,operRemoteSql,SDO_DBName,TableName,FamilyID);//构造完整查询的sql语句 if(!operSDO.BackupDataBase("",localIP,0,TableName,"SDO",ServerIP,0,operszSql))//将查询得到的数据插入到备份家族表里面 { return DBTFLV; } } if(!operSDO.getRemoteSql("SDO","SDO_DelFamEmblem",operRemoteSql,1)) { return DBTFLV;//无法得到删除家族的徽章表信息的sql语句 } int tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,SDO_DBName,SDO_DBName,FamilyID); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_FamilyDelete", "", "Fail", operName, ServerName, FamilyName); operSDO.WriteDBLog(userByID,"SDO","SDO_FamilyDelete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog, "Delete_Family_Fail"); return DBTFLV; } if(!operSDO.getRemoteSql("SDO", "SDO_DelFamTable",operRemoteSql,1)) { return DBTFLV;//无法得到删除家族的相应表信息的sql语句 } for(i=1; i<=intTableNum; i++) { sprintf(TableFlag,"%s%i","TabelName",i); logFile.ReadValue("SDO","TABLE",TableFlag,TableName,40);//获取相应的家族表名称 tmpLength = 0; tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,SDO_DBName,TableName,FamilyID); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_FamilyDelete", "", "Fail", operName, ServerName, FamilyName); operSDO.WriteDBLog(userByID,"SDO","SDO_FamilyDelete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog, "Delete_Family_Fail"); return DBTFLV; } } operSDO.GetLogText(strLog, "SDO_FamilyDelete", "", "Success", operName, ServerName, FamilyName); operSDO.WriteDBLog(userByID,"SDO","SDO_FamilyDelete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog, "Delete_Family_Success"); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog, "Error"); } return DBTFLV; } //添加家族徽章 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_Insert_FamilyBadge(int userByID, char * ServerName, char * ServerIP, char *NickName, int UserID, int FamilyID, char *FamilyName, int EmblemType, int EmblemNum) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_InsertEmblem", "", "", operName, ServerName, FamilyName, NickName, EmblemType, EmblemNum); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO", "SDO_Emblem_Insert",operRemoteSql,1)) { return DBTFLV;//无法得到添加家族徽章的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,SDO_DBName,UserID,EmblemType,EmblemNum); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_InsertEmblem", "", "Fail",operName, ServerName, FamilyName, NickName, EmblemType, EmblemNum); operSDO.WriteDBLog(userByID,"SDO","SDO_InsertEmblem",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog, "Insert_Emblem_Fail"); } else { operSDO.GetLogText(strLog, "SDO_InsertEmblem", "", "Success",operName, ServerName, FamilyName, NickName, EmblemType, EmblemNum); operSDO.WriteDBLog(userByID,"SDO","SDO_InsertEmblem",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog, "Insert_Emblem_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog, "Error"); } return DBTFLV; } //删除家族徽章 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_Delete_FamilyBadge(int userByID, char * ServerName, char * ServerIP, char *NickName, int UserID, char *FamilyName, int EmblemType) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_DeleteEmblem", "", "", operName, ServerName, FamilyName, NickName, EmblemType); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO","SDO_Emblem_Delete",operRemoteSql,1)) { return DBTFLV;//无法得到删除家族徽章的sql语句 } sprintf(operszSql,operRemoteSql,SDO_DBName,UserID,EmblemType);//构造完整查询的sql语句 int tmpLength = 0; tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,SDO_DBName,UserID,EmblemType); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_DeleteEmblem", "", "Fail",operName, ServerName, FamilyName, NickName, EmblemType); operSDO.WriteDBLog(userByID,"SDO","SDO_DeleteEmblem",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog, "Delete_Emblem_Fail"); } else { operSDO.GetLogText(strLog, "SDO_DeleteEmblem", "", "Success",operName, ServerName, FamilyName, NickName, EmblemType); operSDO.WriteDBLog(userByID,"SDO","SDO_DeleteEmblem",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog, "Delete_Emblem_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog, "Error"); } return DBTFLV; } //查看玩家G币 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_UserGCash_Query(int userByID, char * ServerName, char * ServerIP, char *Account) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_UserGCash", "", operName,ServerName,Account); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO","SDO_UserGCash_Query",operRemoteSql,1)) { return DBTFLV;//无法得到查看玩家G币信息的sql语句 } // printf(operRemoteSql,SDO_DBName,Account); DBTFLV = GameDBQuery("SDO", ServerIP, 0, 0, 0, operRemoteSql,SDO_DBName,Account); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //补发玩家G币 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_UserGCash_Update(int userByID, char * ServerName, char * ServerIP, char *Account, int GCash) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_UpdateGCash", "", "", operName, ServerName, Account, GCash); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO", "SDO_AddGCash_Query",operRemoteSql, 1)) { return DBTFLV;//无法得到查询玩家有没有添加G币信息的sql语句 } // printf(operRemoteSql,SDO_DBName,Account); DBTFLV = GameDBQuery("SDO", ServerIP, 0, 0, 0, operRemoteSql,SDO_DBName,Account); int tmpLength = 0; if(DBTFLV.empty()) { if(!operSDO.getRemoteSql("SDO", "SDO_AddGCash_Insert",operRemoteSql,1)) { return DBTFLV;//无法得到给玩家添加G币的sql语句 } // printf(operRemoteSql,SDO_DBName,Account,GCash); tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,SDO_DBName,Account,GCash); } else { if(!operSDO.getRemoteSql("SDO", "SDO_AddGCash_Update",operRemoteSql, 1)) { return DBTFLV;//无法得到给玩家更新G币的sql语句 } // printf(operRemoteSql,SDO_DBName,GCash,Account); tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,SDO_DBName,GCash,Account); } if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_UpdateGCash", "", "Fail", operName, ServerName, Account, GCash); operSDO.WriteDBLog(userByID,"SDO","SDO_UpdateGCash",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Update_GCash_Fail"); } else { operSDO.GetLogText(strLog, "SDO_UpdateGCash", "", "Success", operName, ServerName, Account, GCash); operSDO.WriteDBLog(userByID,"SDO","SDO_UpdateGCash",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Update_GCash_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //大赛挑战信息查询 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_CHALLENGE_QUERY(int userByID, char * ServerName, char * ServerIP, int iIndex, int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage1", "SDO_ChallengeInfo", "", operName,ServerName); operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2)) { return DBTFLV;//无法获取真正的服务器IP } if(!operSDO.getRemoteSql("SDO", "SDO_Challenge_Query",operRemoteSql, 1)) { return DBTFLV;//无法得到查看大赛挑战信息的sql语句 } DBTFLV = GameDBQuery("SDO", ServerIP, 0, iIndex, iPageSize, operRemoteSql,Item_DBName); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //设置大赛挑战信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_CHALLENGE_INSERT(int userByID, char * ServerName, char * ServerIP, int weekDay, int matPtMin, int stPtMin, int GCash, int scence, int isBattle) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { char readTag[20];//获取配置文件的标签信息 char strWeekDay[10];//大赛设在周几的中文 char SceneName[64];//场景的中文 char BattleMode[20];//比赛模式的中文 ZeroMemory(readTag,20);//初始化获取配置文件的标签信息 ZeroMemory(strWeekDay,10);//初始化大赛设在周几的中文 ZeroMemory(SceneName,64);//初始化场景的中文 ZeroMemory(BattleMode,20);//初始化比赛模式的中文 sprintf(readTag, "%s%i", "WeekDay", weekDay); logFile.ReadValue("SDO","Code",readTag,strWeekDay,10);//获取当前是星期几 operSDO.getRemoteSql("SDO", "SDO_SceneName_Query",operRemoteSql,1);//获取查询场景名称的sql语句 operSDO.QuerySingleValue(SceneName, "", localIP, 0, operRemoteSql, scence);//获取当前场景名称 ZeroMemory(readTag,20);//初始化获取配置文件的标签信息 if (isBattle == 10) { sprintf(readTag, "%s", "BattleType1"); logFile.ReadValue("SDO","Code",readTag,BattleMode,20);//获取当前的比赛模式 } else if (isBattle == 13) { sprintf(readTag, "%s", "BattleType2"); logFile.ReadValue("SDO","Code",readTag,BattleMode,20);//获取当前的比赛模式 } else if (isBattle == 12) { sprintf(readTag, "%s", "BattleType3"); logFile.ReadValue("SDO","Code",readTag,BattleMode,20);//获取当前的比赛模式 } else if (isBattle == 11) { sprintf(readTag, "%s", "BattleType4"); logFile.ReadValue("SDO","Code",readTag,BattleMode,20);//获取当前的比赛模式 } operSDO.GetLogText(strLog, "SDO_Challenge_Insert", "", "", operName, ServerName, strWeekDay,stPtMin,matPtMin,GCash,SceneName,BattleMode);//构造执行操作的日志 operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2)) { return DBTFLV;//无法获取真正的服务器IP } if(!operSDO.getRemoteSql("SDO", "SDO_Challenge_Insert",operRemoteSql, 1)) { return DBTFLV;//无法得到添加大赛挑战信息的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,Item_DBName,weekDay,matPtMin,stPtMin,GCash,scence,isBattle); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_Challenge_Insert", "", "Fail", operName, ServerName, strWeekDay,stPtMin,matPtMin,GCash,SceneName,BattleMode);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Challenge_Insert",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Insert_Challenge_Fail"); } else { operSDO.GetLogText(strLog, "SDO_Challenge_Insert", "", "Success", operName, ServerName, strWeekDay,stPtMin,matPtMin,GCash,SceneName,BattleMode);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Challenge_Insert",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Insert_Challenge_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //修改大赛挑战信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_CHALLENGE_UPDATE(int userByID, char * ServerName, char * ServerIP, int ChallengeID, int weekDay, int matPtMin, int stPtMin, int GCash, int scence, int isBattle) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { char readTag[20];//获取配置文件的标签信息 char strWeekDay[10];//大赛设在周几的中文 char SceneName[64];//场景的中文 char BattleMode[20];//比赛模式的中文 ZeroMemory(readTag,20);//初始化获取配置文件的标签信息 ZeroMemory(strWeekDay,10);//初始化大赛设在周几的中文 ZeroMemory(SceneName,64);//初始化场景的中文 ZeroMemory(BattleMode,20);//初始化比赛模式的中文 sprintf(readTag, "%s%i", "WeekDay", weekDay); logFile.ReadValue("SDO","Code",readTag,strWeekDay,10);//获取当前是星期几 operSDO.getRemoteSql("SDO", "SDO_SceneName_Query",operRemoteSql,1);//获取查询场景名称的sql语句 operSDO.QuerySingleValue(SceneName,"",localIP,0,operRemoteSql,scence);//获取当前场景名称 ZeroMemory(readTag,20);//初始化获取配置文件的标签信息 if (isBattle == 10) { sprintf(readTag, "%s", "BattleType1"); logFile.ReadValue("SDO","Code",readTag,BattleMode,20);//获取当前的比赛模式 } else if (isBattle == 13) { sprintf(readTag, "%s", "BattleType2"); logFile.ReadValue("SDO","Code",readTag,BattleMode,20);//获取当前的比赛模式 } else if (isBattle == 12) { sprintf(readTag, "%s", "BattleType3"); logFile.ReadValue("SDO","Code",readTag,BattleMode,20);//获取当前的比赛模式 } else if (isBattle == 11) { sprintf(readTag, "%s", "BattleType4"); logFile.ReadValue("SDO","Code",readTag,BattleMode,20);//获取当前的比赛模式 } operSDO.GetLogText(strLog,"SDO_Challenge_Update","","",operName,ServerName,ChallengeID,strWeekDay,stPtMin,matPtMin,GCash,SceneName,BattleMode);//构造执行操作的日志 operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2)) { return DBTFLV;//无法获取真正的服务器IP } //保存备份信息 operSDO.BakUpdateInfo(userByID,"SDO_Challenge_Update","SDO",ServerIP,0,Item_DBName, "SDO_ChallengeBak_Get", "SDO_CHALLENGE_UPDATE", ChallengeID, -1); if(!operSDO.getRemoteSql("SDO", "SDO_Challenge_Update",operRemoteSql, 1)) { return DBTFLV;//无法得到修改大赛挑战信息的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,Item_DBName,weekDay,matPtMin,stPtMin,GCash,scence,isBattle,ChallengeID); if(tmpLength == 0) { operSDO.GetLogText(strLog,"SDO_Challenge_Update","","Fail",operName,ServerName,ChallengeID,strWeekDay,stPtMin,matPtMin,GCash,SceneName,BattleMode);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Challenge_Update",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Update_Challenge_Fail"); } else { operSDO.GetLogText(strLog,"SDO_Challenge_Update","","Success",operName,ServerName,ChallengeID,strWeekDay,stPtMin,matPtMin,GCash,SceneName,BattleMode);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Challenge_Update",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Update_Challenge_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //删除大赛挑战信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_CHALLENGE_DELETE(int userByID, char * ServerName, char * ServerIP, int ChallengeID) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog,"SDO_Challenge_Delete","","",operName,ServerName,ChallengeID);//构造执行操作的日志 operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP, ServerIP,2)) { return DBTFLV;//无法获取真正的服务器IP } if(!operSDO.getRemoteSql("SDO", "SDO_Challenge_Delete",operRemoteSql, 1)) { return DBTFLV;//无法得到删除大赛挑战信息的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,Item_DBName,ChallengeID); if(tmpLength == 0) { operSDO.GetLogText(strLog,"SDO_Challenge_Delete","","Fail",operName,ServerName,ChallengeID);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Challenge_Delete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Delete_Challenge_Fail"); } else { operSDO.GetLogText(strLog,"SDO_Challenge_Delete","","Success",operName,ServerName,ChallengeID);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Challenge_Delete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Delete_Challenge_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //查看大赛场景列表 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_SCENE_QUERY(int userByID, char * ServerName, char * ServerIP) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage2", "SDO_Scene_Query", "", operName); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO", "SDO_Scene_Query",operRemoteSql, 1)) { return DBTFLV;//无法得到查看大赛场景列表的sql语句 } DBTFLV = GameDBQuery("SDO", localIP, 4, 0, 0, operRemoteSql); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //添加大赛挑战的场景 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_SCENE_CREATE(int userByID, char * ServerName, char * ServerIP, char *SceneName) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_Scene_Insert", "", "", operName,SceneName);//构造日志语句 operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO", "SDO_Scene_Insert",operRemoteSql, 1)) { return DBTFLV;//无法得到添加大赛挑战场景的sql语句 } int tmpLength = 0; // printf(operRemoteSql,SceneName); tmpLength = GameDBOper("SDO", localIP, 4, operRemoteSql,SceneName); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_Scene_Insert", "", "Fail", operName,SceneName);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Scene_Insert",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Insert_Scene_Fail"); } else { operSDO.GetLogText(strLog, "SDO_Scene_Insert", "", "Success", operName,SceneName);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Scene_Insert",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Insert_Scene_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //修改大赛挑战的场景 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_SCENE_UPDATE(int userByID, char * ServerName, char * ServerIP, int SceneID, char *SceneName) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { int SceneID =StrToInt((char *)&(recvVect.getTLVByTag(CEnumCore::TagName::SDO_SenceID,0)).lpdata);//场景ID char SceneName[64]; ZeroMemory(SceneName,64);//初始化场景名称 sprintf(SceneName,"%s",(char *)&(recvVect.getTLVByTag(CEnumCore::TagName::SDO_Sence,0)).lpdata);//获取场景名称 operSDO.GetLogText(strLog, "SDO_Scene_Update", "", "", operName,SceneID,SceneName);//构造日志语句 operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO", "SDO_Scene_Update",operRemoteSql, 1)) { return DBTFLV;//无法得到修改大赛挑战场景的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO", localIP, 4, operRemoteSql,SceneName,SceneID); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_Scene_Update", "", "Fail", operName,SceneID,SceneName);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Scene_Update",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Update_Scene_Fail"); } else { operSDO.GetLogText(strLog, "SDO_Scene_Update", "", "Success", operName,SceneID,SceneName);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Scene_Update",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Update_Scene_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //删除大赛挑战的场景 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_SCENE_DELETE(int userByID, char * ServerName, char * ServerIP, int SceneID) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_Scene_Delete", "", "", operName,SceneID);//构造日志语句 operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO", "SDO_Scene_Delete",operRemoteSql, 1)) { return DBTFLV;//无法得到删除大赛挑战的场景的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO", localIP, 4, operRemoteSql,SceneID); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_Scene_Delete", "", "Fail", operName,SceneID);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Scene_Delete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Delete_Scene_Fail"); } else { operSDO.GetLogText(strLog, "SDO_Scene_Delete", "", "Success", operName,SceneID);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Scene_Delete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Delete_Scene_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //查看在游戏里摇摇乐获得概率 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_YYHappyItem_Query(int userByID, char * ServerName, char * ServerIP, int iIndex, int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage1", "SDO_YYHappyItem_Query", "", operName,ServerName); operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2))//获取真正的服务器IP { return DBTFLV; } if(!operSDO.getRemoteSql("SDO", "SDO_YYHappyItem_Query",operRemoteSql, 1)) { return DBTFLV;//无法得到查询游戏里摇摇乐获得概率的sql语句 } DBTFLV = GameDBQuery("SDO", ServerIP, 0, iIndex, iPageSize, operRemoteSql,Item_DBName); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //添加摇摇乐获得概率 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_YYHappyItem_Insert(int userByID, char * ServerName, char * ServerIP, int itemCode1, int itemCode2, int level, int levPercent, int precent, int timeslimit, int dayslimit, char *itemName1, char *itemName2) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_YYHappyItem_Insert", "", "", operName, ServerName, itemCode1,itemName1,itemCode2,itemName2,level,levPercent,precent,timeslimit,dayslimit);//构造执行操作的日志 operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2)) { return DBTFLV;//无法获取真正的服务器IP } int itemCount = 0; if(!operSDO.getRemoteSql("SDO", "SDO_YYHappyItem_Count",operRemoteSql,1)) { return DBTFLV;//无法得到添加摇摇乐获得概率的sql语句 } operSDO.QuerySingleValue(&itemCount,"SDO",ServerIP,0,operRemoteSql,Item_DBName,itemCode1); int tmpLength = 0; if(itemCount > 0) { if(!operSDO.getRemoteSql("SDO", "SDO_YYHappyItem_Create",operRemoteSql, 1)) { return DBTFLV;//无法得到添加摇摇乐获得概率的sql语句 } tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,Item_DBName,level,levPercent,precent,timeslimit,dayslimit,itemCode1); } else { if(!operSDO.getRemoteSql("SDO", "SDO_YYHappyItem_Insert",operRemoteSql,1)) { return DBTFLV;//无法得到添加摇摇乐获得概率的sql语句 } tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,Item_DBName,itemCode1,itemCode2,level,levPercent,precent,timeslimit,dayslimit); } if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_YYHappyItem_Insert", "", "Fail", operName, ServerName, itemCode1,itemName1,itemCode2,itemName2,level,levPercent,precent,timeslimit,dayslimit);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_YYHappyItem_Insert",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Insert_YYHappyItem_Fail"); } else { operSDO.GetLogText(strLog, "SDO_YYHappyItem_Insert", "", "Success", operName, ServerName, itemCode1,itemName1,itemCode2,itemName2,level,levPercent,precent,timeslimit,dayslimit);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_YYHappyItem_Insert",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Insert_YYHappyItem_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //更新摇摇乐获得概率 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_YYHappyItem_Update(int userByID, char * ServerName, char * ServerIP, int itemCode, int itemCode1, int itemCode2, int level, int levPercent, int precent, int timeslimit, int dayslimit, char *itemName1, char *itemName2) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_YYHappyItem_Update", "", "", operName, ServerName, itemCode, itemCode1,itemName1,itemCode2,itemName2,level,levPercent,precent,timeslimit,dayslimit);//构造执行操作的日志 operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2)) { return DBTFLV;//无法获取真正的服务器IP } if(!operSDO.getRemoteSql("SDO", "SDO_YYHappyItem_Update",operRemoteSql, 1)) { return DBTFLV;//无法得到更新摇摇乐获得概率的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,Item_DBName,itemCode1,itemCode2,level,levPercent,precent,timeslimit,dayslimit,itemCode); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_YYHappyItem_Update", "", "Fail", operName, ServerName, itemCode, itemCode1,itemName1,itemCode2,itemName2,level,levPercent,precent,timeslimit,dayslimit);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_YYHappyItem_Update",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Update_YYHappyItem_Fail"); } else { operSDO.GetLogText(strLog, "SDO_YYHappyItem_Update", "", "Success", operName, ServerName, itemCode, itemCode1,itemName1,itemCode2,itemName2,level,levPercent,precent,timeslimit,dayslimit);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_YYHappyItem_Update",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Update_YYHappyItem_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //删除摇摇乐道具获得概率 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_YYHappyItem_Delete(int userByID, char * ServerName, char * ServerIP, int itemCode) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_YYHappyItem_Delete", "", "", operName,ServerName, itemCode);//构造日志语句 operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2)) { return DBTFLV;//无法获取真正的服务器IP } if(!operSDO.getRemoteSql("SDO", "SDO_YYHappyItem_Delete",operRemoteSql, 1)) { return DBTFLV;//无法得到删除摇摇乐道具获得概率的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,Item_DBName,itemCode); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_YYHappyItem_Delete", "", "Fail", operName,ServerName, itemCode);//构造日志语句 operSDO.WriteDBLog(userByID,"SDO","SDO_Scene_Delete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Delete_YYHappyItem_Fail"); } else { operSDO.GetLogText(strLog, "SDO_YYHappyItem_Delete", "", "Success", operName,ServerName, itemCode);//构造日志语句 operSDO.WriteDBLog(userByID,"SDO","SDO_Scene_Delete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Delete_YYHappyItem_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //查看游戏里面的道具信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_Item_QueryAll(int userByID, char * ServerName, char * ServerIP, int BigType, int SmallType, int Sex, char * itemName) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_ItemInfo_All", "", "", operName,ServerName,BigType,SmallType,Sex,itemName); operSDO.WriteText("SDO",strLog); // printf("exec SDO_ItemShop_Query_ALL '%s','%i','%i',%i,'%s'",ServerIP, BigType, SmallType, Sex, itemName); DBTFLV = GameDBQuery("SDO", localIP, 4, 0, 0, "exec SDO_ItemShop_Query_ALL '%s','%i','%i',%i,'%s'", ServerIP, BigType, SmallType, Sex, itemName); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //道具获取比率查询 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_MedalItem_Query(int userByID, char * ServerName, char * ServerIP, int iIndex, int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage1", "SDO_MedalItem_Query", "", operName,ServerName); operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2))//获取真正的服务器IP { return DBTFLV; } if(!operSDO.getRemoteSql("SDO", "SDO_MedalItem_Query",operRemoteSql, 1)) { return DBTFLV;//无法得到查询道具获取比率的sql语句 } DBTFLV = GameDBQuery("SDO", ServerIP, 0, iIndex, iPageSize, operRemoteSql,Item_DBName); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //单个道具获取比率查询 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_MedalItem_Owner_Query(int userByID, char * ServerName, char * ServerIP, char *itemName, int iIndex, int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage1", "SDO_MedalItem_Owner_Query", "", operName,ServerName); operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2))//获取真正的服务器IP { return DBTFLV; } if(!operSDO.getRemoteSql("SDO", "SDO_MedalItem_Owner_Query",operRemoteSql, 1)) { return DBTFLV;//无法得到查询单个道具获取比率的sql语句 } printf(operRemoteSql, "\%", itemName, "\%"); DBTFLV = GameDBQuery("SDO", localIP, 4, iIndex, iPageSize, operRemoteSql, "\%", itemName, "\%"); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //添加道具获取比率 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_MedalItem_Insert(int userByID, char * ServerName, char * ServerIP, int itemCode, int precent, char *itemName) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog,"SDO_MedalItem_Insert","","",operName,ServerName,itemCode,itemName,precent);//构造执行操作的日志 operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2)) { return DBTFLV;//无法获取真正的服务器IP } int itemCount = 0; if(!operSDO.getRemoteSql("SDO", "SDO_MedalItem_Count",operRemoteSql, 1)) { return DBTFLV;//无法得到查看道具相应比率存不存在的sql语句 } operSDO.QuerySingleValue(&itemCount,"SDO",ServerIP,0,operRemoteSql,Item_DBName,itemCode); int tmpLength = 0; if(itemCount > 0) { if(!operSDO.getRemoteSql("SDO", "SDO_MedalItem_Update",operRemoteSql, 1)) { return DBTFLV;//无法得到更新道具获取比率的sql语句 } tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,Item_DBName,precent,itemCode); } else { if(!operSDO.getRemoteSql("SDO", "SDO_MedalItem_Insert",operRemoteSql, 1)) { return DBTFLV;//无法得到添加道具获取比率的sql语句 } tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,Item_DBName,itemCode,precent); } if(tmpLength == 0) { operSDO.GetLogText(strLog,"SDO_MedalItem_Insert","","Fail",operName,ServerName,itemCode,itemName,precent);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_MedalItem_Insert",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Insert_MedalItem_Fail"); } else { operSDO.GetLogText(strLog,"SDO_MedalItem_Insert","","Success",operName,ServerName,itemCode,itemName,precent);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_MedalItem_Insert",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Insert_MedalItem_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //更新道具获取比率 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_MedalItem_Update(int userByID, char * ServerName, char * ServerIP, int itemCode, int precent, char *itemName) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog,"SDO_MedalItem_Update","","",operName,ServerName,itemCode,itemName,precent);//构造执行操作的日志 operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2)) { return DBTFLV;//无法获取真正的服务器IP } if(!operSDO.getRemoteSql("SDO", "SDO_MedalItem_Update",operRemoteSql, 1)) { return DBTFLV;//无法得到更新道具获取比率的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,Item_DBName,precent,itemCode); if(tmpLength == 0) { operSDO.GetLogText(strLog,"SDO_MedalItem_Update","","Fail",operName,ServerName,itemCode,itemName,precent);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_MedalItem_Update",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Update_MedalItem_Fail"); } else { operSDO.GetLogText(strLog,"SDO_MedalItem_Update","","Success",operName,ServerName,itemCode,itemName,precent);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_MedalItem_Update",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Update_MedalItem_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //删除道具获取比率 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_MedalItem_Delete(int userByID, char * ServerName, char * ServerIP, int itemCode, char *itemName) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { int itemCode = StrToInt((char *)&(recvVect.getTLVByTag(CEnumCore::TagName::SDO_ItemCode,0)).lpdata);//道具code char itemName[128]; ZeroMemory(itemName,128); sprintf(itemName,"%s",(char *)&(recvVect.getTLVByTag(CEnumCore::TagName::SDO_ItemName,0)).lpdata);//获取道具名称 operSDO.GetLogText(strLog,"SDO_MedalItem_Delete","","",operName,ServerName,itemCode,itemName);//构造执行操作的日志 operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2)) { return DBTFLV;//无法获取真正的服务器IP } if(!operSDO.getRemoteSql("SDO", "SDO_MedalItem_Delete",operRemoteSql, 1)) { return DBTFLV;//无法得到删除道具获取比率的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,Item_DBName,itemCode); if(tmpLength == 0) { operSDO.GetLogText(strLog,"SDO_MedalItem_Delete","","Fail",operName,ServerName,itemCode,itemName);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_MedalItem_Delete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Delete_MedalItem_Fail"); } else { operSDO.GetLogText(strLog,"SDO_MedalItem_Delete","","Success",operName,ServerName,itemCode,itemName);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_MedalItem_Delete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Delete_MedalItem_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //更新玩家角色信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_CharacterInfo_Update(int userByID, char * ServerName, char * ServerIP, int UserID, char *Account,int level, int experience, int battle, int win, int draw, int lose, int MCash, int GCash) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_CharacterInfo_Update", "", "", operName, ServerName,Account, level,experience,battle,win,draw,lose,MCash,GCash);//构造执行操作的日志 operSDO.WriteText("SDO",strLog); //备份更新信息 operSDO.BakUpdateInfo(userByID,"SDO_CharacterInfo_Update","SDO",ServerIP,0,SDO_DBName,"SDO_CharInfo_Bak","SDO_CharInfo_Update",UserID,-1); if(!operSDO.getRemoteSql("SDO", "SDO_CharInfo_Update",operRemoteSql, 1)) { return DBTFLV;//无法得到更新玩家角色信息的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,SDO_DBName,experience,win,lose,MCash,GCash,UserID); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_CharacterInfo_Update", "", "Fail", operName, ServerName,Account, level,experience,battle,win,draw,lose,MCash,GCash);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_CharacterInfo_Update",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Update_CharacterInfo_Fail"); } else { operSDO.GetLogText(strLog, "SDO_CharacterInfo_Update", "", "Success", operName, ServerName,Account, level,experience,battle,win,draw,lose,MCash,GCash);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_CharacterInfo_Update",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Update_CharacterInfo_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //删除玩家身上道具 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_ItemShop_Delete(int userByID, char * ServerName, char * ServerIP, int UserID, char *Account, int itemCode, char *itemName) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog,"SDO_UserEquip_Delete","","",operName,Account,itemCode,itemName);//构造执行操作的日志 operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(ServerIP,ServerIP,2)) { return DBTFLV;//无法获取真正的服务器IP } //备份删除信息 operSDO.BakDeleteInfo(userByID,"SDO_UserEquip_Delete","SDO",ServerIP,0,Item_DBName, "T_sdo_item","SDO_Remote_GetEquipInfo","SDO_Remote_SaveInfo",itemCode, UserID); if(!operSDO.getRemoteSql("SDO", "SDO_UserEquip_Delete",operRemoteSql,1)) { return DBTFLV;//无法得到删除玩家身上道具的sql语句 } int tmpLength = 0; tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,Item_DBName,itemCode,UserID); if(tmpLength == 0) { operSDO.GetLogText(strLog,"SDO_UserEquip_Delete","","Fail",operName,ServerName,Account,itemCode,itemName);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_UserEquip_Delete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Delete_UserEquip_Fail"); } else { operSDO.GetLogText(strLog,"SDO_UserEquip_Delete","","Success",operName,ServerName,Account,itemCode,itemName);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_UserEquip_Delete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Delete_UserEquip_Success"); } } catch (...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //查看玩家礼物盒道具 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_GiftBox_Query(int userByID, char * ServerName, char * ServerIP, int UserID, char *Account, int iIndex, int iPageSize) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_GiftBox", "", operName,ServerName,Account); operSDO.WriteText("SDO",strLog); if(!operSDO.getRemoteSql("SDO", "SDO_GiftBox_Query",operRemoteSql, 1)) { return DBTFLV;//无法得到查看玩家礼物盒道具的sql语句 } DBTFLV = GameDBQuery("SDO", ServerIP, 0, iIndex, iPageSize, operRemoteSql,SDO_DBName,UserID); } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return DBTFLV; } //删除玩家礼物盒道具 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_GiftBox_Delete(int userByID, char * ServerName, char * ServerIP, int UserID, char *Account, int itemCode, char *itemName) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog,"SDO_GiftBox_Delete","","",operName,ServerName,Account,itemCode,itemName);//构造执行操作的日志 operSDO.WriteText("SDO",strLog); //备份删除信息 operSDO.BakDeleteInfo(userByID,"SDO_GiftBox_Delete","SDO",ServerIP,0,SDO_DBName, "T_sdo_Message","SDO_BackUp_GiftBox","SDO_Remote_SaveInfo",itemCode, UserID); if(!operSDO.getRemoteSql("SDO", "SDO_GiftBox_Delete",operRemoteSql, 1)) { return DBTFLV;//无法得到删除玩家礼物盒道具的sql语句 } int tmpLength; tmpLength = GameDBOper("SDO", ServerIP, 0, operRemoteSql,SDO_DBName,itemCode,UserID); if(tmpLength == 0) { operSDO.GetLogText(strLog,"SDO_GiftBox_Delete","","Fail",operName,ServerName,Account,itemCode,itemName);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_GiftBox_Delete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Delete_GiftBox_Fail"); } else { operSDO.GetLogText(strLog,"SDO_GiftBox_Delete","","Success",operName,ServerName,Account,itemCode,itemName);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_GiftBox_Delete",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Delete_GiftBox_Success"); } } catch (...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //给玩家发送道具 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_GiftBox_Insert(int userByID, char * ServerName, char * ServerIP, int UserID, char *Account, int itemCode, int timeslimit, int DateLimit, char *itemName, char *title, char *content) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { operSDO.GetLogText(strLog, "SDO_GiftBox_Insert", "", "", operName, ServerName, Account, itemCode,itemName,timeslimit,DateLimit,title,content);//构造执行操作的日志 operSDO.WriteText("SDO",strLog); int bigtype = 0; if(!operSDO.getRemoteSql("SDO", "SDO_ItemType_Query",operRemoteSql, 1)) { return DBTFLV;//无法得到查询道具所属大类的sql语句 } operSDO.QuerySingleValue(&bigtype,"",localIP,0,operRemoteSql,itemCode); if(bigtype == 3) { if(!operSDO.getRemoteSql("SDO", "SDO_GiftBox_Insert",operRemoteSql, 1)) { return DBTFLV;//无法得到给玩家发送道具的sql语句 } sprintf(operszSql,operRemoteSql,SDO_DBName,UserID,title,content,itemCode,DateLimit,-1,0,3);//构造完整操作的sql语句 } else { char StrInt[10]; char tmpStr[10]; ZeroMemory(StrInt,10);//初始化 ZeroMemory(tmpStr, 10); _itoa(itemCode, StrInt, 10); int i=0;//循环因子 for(i=1; i<=12; i++) { sprintf(tmpStr, "0%i", i); if(!strcmp(tmpStr, StrInt)) { if(!operSDO.getRemoteSql("SDO", "SDO_GiftMedal_Insert",operRemoteSql, 1)) { return DBTFLV;//无法得到给玩家发送勋章道具的sql语句 } sprintf(operszSql,operRemoteSql,SDO_DBName,2^(i-1),2^(i-1),UserID);//构造完整操作的sql语句 break; } } if(i<=12) { } else { if(!operSDO.getRemoteSql("SDO", "SDO_GiftBox_Insert",operRemoteSql, 1)) { return DBTFLV;//无法得到给玩家发送道具的sql语句 } if((itemCode==100003) || (itemCode==100004) || (itemCode==100005) || (itemCode==100006) || (itemCode==100007) || (itemCode==100021) || (itemCode==100022) || (itemCode==100023) || (itemCode==100024) || (itemCode==100025) || (itemCode==100061) || (itemCode==100063) || (itemCode==100611) || (itemCode==100612) || (itemCode==100868) || (itemCode==100776) || (itemCode==100778) || (itemCode==100780) || (itemCode==100754) || (itemCode==100756) || (itemCode==100758) || (itemCode==100069) || (itemCode==100065) || (itemCode==100067) || (itemCode==100420) || (itemCode==100728) || (itemCode==100922) || (itemCode==100924) || (itemCode==100926) || (itemCode==100912) || (itemCode==100913) || (itemCode==100914) || (itemCode==100915) || (itemCode==100898) || (itemCode==200000) || (itemCode==202999)) { sprintf(operszSql,operRemoteSql,SDO_DBName,UserID,title,content,itemCode,DateLimit,-1,0,3);//构造完整操作的sql语句 } else if((itemCode==100000) || (itemCode==100002) || (itemCode==100020) || (itemCode==100030) || (itemCode==100031) || (itemCode==100032) || (itemCode==100033) || (itemCode==100034) || (itemCode==100035) || (itemCode==100036) || (itemCode==100037) || (itemCode==100038) || (itemCode==100039) || (itemCode==100040) || (itemCode==100041) || (itemCode==100050) || (itemCode==100051) || (itemCode==100052) || (itemCode==100060) || (itemCode==100062) || (itemCode==100064) || (itemCode==100066) || (itemCode==100068) || (itemCode==100070) || (itemCode==100071) || (itemCode==100072) || (itemCode==100080) || (itemCode==100081) || (itemCode==100082) || (itemCode==100083) || (itemCode==100084) || (itemCode==100085) || (itemCode==100086) || (itemCode==100087) || (itemCode==100088) || (itemCode==100089) || (itemCode==100140) || (itemCode==100141) || (itemCode==100142) || (itemCode==100410) || (itemCode==100500) || (itemCode==100501) || (itemCode==100502) || (itemCode==100601) || (itemCode==100602) || (itemCode==100713) || (itemCode==100714) || (itemCode==100715) || (itemCode==100716) || (itemCode==100717) || (itemCode==100718) || (itemCode==100719) || (itemCode==100720) || (itemCode==100721) || (itemCode==100722) || (itemCode==100723) || (itemCode==100724) || (itemCode==100725) || (itemCode==100726) || (itemCode==100727) || (itemCode==100729) || (itemCode==100730) || (itemCode==100731) || (itemCode==100732) || (itemCode==100733) || (itemCode==100739) || (itemCode==100741) || (itemCode==100743) || (itemCode==100745) || (itemCode==100747) || (itemCode==100749) || (itemCode==100751) || (itemCode==100753) || (itemCode==100755) || (itemCode==100757) || (itemCode==100759) || (itemCode==100761) || (itemCode==100763) || (itemCode==100765) || (itemCode==100767) || (itemCode==100769) || (itemCode==100771) || (itemCode==100773) || (itemCode==100775) || (itemCode==100777) || (itemCode==100779) || (itemCode==100781) || (itemCode==100783) || (itemCode==100785) || (itemCode==100787) || (itemCode==100789) || (itemCode==100790) || (itemCode==100792) || (itemCode==100794) || (itemCode==100796) || (itemCode==100797) || (itemCode==100798) || (itemCode==100807) || (itemCode==100815) || (itemCode==100823) || (itemCode==100831) || (itemCode==100839) || (itemCode==100847) || (itemCode==100855) || (itemCode==100866) || (itemCode==100867) || (itemCode==100869) || (itemCode==100876) || (itemCode==100882) || (itemCode==100883) || (itemCode==100884) || (itemCode==100886) || (itemCode==100887) || (itemCode==100888) || (itemCode==100889) || (itemCode==100890) || (itemCode==100891) || (itemCode==100892) || (itemCode==100893) || (itemCode==100894) || (itemCode==100895) || (itemCode==100896) || (itemCode==100897) || (itemCode==100903) || (itemCode==100904) || (itemCode==100905) || (itemCode==100906) || (itemCode==100907) || (itemCode==100908) || (itemCode==100909) || (itemCode==100910) || (itemCode==100911) || (itemCode==100916) || (itemCode==100917) || (itemCode==100918) || (itemCode==100927)) { sprintf(operszSql,operRemoteSql,SDO_DBName,UserID,title,content,itemCode,-1,timeslimit,0,3);//构造完整操作的sql语句 } else { sprintf(operszSql,operRemoteSql,SDO_DBName,UserID,title,content,itemCode,DateLimit,timeslimit,0,3);//构造完整操作的sql语句 } } } int tmpLength = 0; tmpLength = GameDBOper("SDO", ServerIP, 0, operszSql); if(tmpLength == 0) { operSDO.GetLogText(strLog, "SDO_GiftBox_Insert", "", "Fail", operName, ServerName, Account, itemCode,itemName,timeslimit,DateLimit,title,content);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_GiftBox_Insert",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Insert_GiftBox_Fail"); } else { operSDO.GetLogText(strLog, "SDO_GiftBox_Insert", "", "Success", operName, ServerName, Account, itemCode,itemName,timeslimit,DateLimit,title,content);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_GiftBox_Insert",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"Insert_GiftBox_Success"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } //批量添加比赛信息 vector<CGlobalStruct::TFLV> CSDOInfo::SDO_Challenge_InsertAll(int userByID, char * ServerName, char * ServerIP, int weekDay, int matPtMin, int stPtMin, int GCash, int scence, int isBattle) { vector<CGlobalStruct::TFLV> DBTFLV; COperatorSDO operSDO; try { char readTag[20];//获取配置文件的标签信息 char strWeekDay[10];//大赛设在周几的中文 char SceneName[64];//场景的中文 char BattleMode[20];//比赛模式的中文 ZeroMemory(readTag,20);//初始化获取配置文件的标签信息 ZeroMemory(strWeekDay,10);//初始化大赛设在周几的中文 ZeroMemory(SceneName,64);//初始化场景的中文 ZeroMemory(BattleMode,20);//初始化比赛模式的中文 sprintf(readTag, "%s%i", "WeekDay", weekDay); logFile.ReadValue("SDO","Code",readTag,strWeekDay,10);//获取当前是星期几 operSDO.getRemoteSql("SDO", "SDO_SceneName_Query",operRemoteSql, 1);//获取查询场景名称的sql语句 operSDO.QuerySingleValue(SceneName, "", localIP, 0, operRemoteSql, scence);//获取当前场景名称 ZeroMemory(readTag,20);//初始化获取配置文件的标签信息 if (isBattle == 10) { sprintf(readTag, "%s", "BattleType1"); logFile.ReadValue("SDO","Code",readTag,BattleMode,20);//获取当前的比赛模式 } else if (isBattle == 13) { sprintf(readTag, "%s", "BattleType2"); logFile.ReadValue("SDO","Code",readTag,BattleMode,20);//获取当前的比赛模式 } else if (isBattle == 12) { sprintf(readTag, "%s", "BattleType3"); logFile.ReadValue("SDO","Code",readTag,BattleMode,20);//获取当前的比赛模式 } else if (isBattle == 11) { sprintf(readTag, "%s", "BattleType4"); logFile.ReadValue("SDO","Code",readTag,BattleMode,20);//获取当前的比赛模式 } operSDO.GetLogText(strLog, "SDO_Challenge_InsertAll", "", "", operName, ServerName, strWeekDay,stPtMin,matPtMin,GCash,SceneName,BattleMode);//构造执行操作的日志 operSDO.WriteText("SDO",strLog); char SuccessSvr[500]; char FailSvr[500]; ZeroMemory(SuccessSvr, 500);//初始化添加成功的服务器名称 ZeroMemory(FailSvr, 500);//初始化添加失败的服务器名称 char tempServerIP[64]; ZeroMemory(tempServerIP,64); const char* split = ",";//服务器地址用","隔开 int splitNum = 1;//设置为获取第一个","号 char tmpServerIP[64]; char tmpServerName[64]; ZeroMemory(tmpServerIP, 64); ZeroMemory(tmpServerName, 64); operSDO.strGetChar(ServerIP, split, tmpServerIP, 64, splitNum);//获取第一个服务器IP operSDO.strGetChar(ServerName, split, tmpServerName, 64, splitNum);//获取第一个服务器名称 int tmpLength = 0; while(strcmp("",tmpServerIP)) { if(!operSDO.GetServerIP(tempServerIP,tmpServerIP,2)) { return DBTFLV;//无法获取真正的服务器IP } if(!operSDO.getRemoteSql("SDO", "SDO_Challenge_Insert",operRemoteSql, 1)) { return DBTFLV;//无法得到添加大赛挑战信息的sql语句 } tmpLength = GameDBOper("SDO", tempServerIP, 0, operRemoteSql,Item_DBName,weekDay,matPtMin,stPtMin,GCash,scence,isBattle); if(tmpLength == 0) { if(strcmp("",FailSvr)) { sprintf(FailSvr,"%s,%s",FailSvr,tmpServerName); } else { sprintf(FailSvr,"%s",tmpServerName); } } else { if(strcmp("",SuccessSvr)) { sprintf(SuccessSvr,"%s,%s",SuccessSvr,tmpServerName); } else { sprintf(SuccessSvr,"%s",tmpServerName); } } splitNum++;//循环增加","的个数 operSDO.strGetChar(ServerIP, split, tmpServerIP, 64, splitNum);//获取第splitNum个服务器IP operSDO.strGetChar(ServerName, split, tmpServerName, 64, splitNum);//获取第splitNum个服务器名称 } ZeroMemory(strLog, 2048); if(!strcmp("",FailSvr)) { operSDO.GetLogText(strLog, "SDO_Challenge_InsertAll", "", "Success", operName, ServerName, strWeekDay,stPtMin,matPtMin,GCash,SceneName,BattleMode);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Challenge_InsertAll",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"InsertAll_Challenge_Success"); } else if(!strcmp("",SuccessSvr)) { operSDO.GetLogText(strLog, "SDO_Challenge_InsertAll", "", "Fail", operName, ServerName, strWeekDay,stPtMin,matPtMin,GCash,SceneName,BattleMode);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Challenge_InsertAll",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"InsertAll_Challenge_Fail"); } else { operSDO.GetLogText(strLog, "SDO_Challenge_InsertAll_Result", "", "", operName, SuccessSvr, FailSvr, strWeekDay,stPtMin,matPtMin,GCash,SceneName,BattleMode);//构造执行操作的日志 operSDO.WriteDBLog(userByID,"SDO","SDO_Challenge_InsertAll",ServerIP,strLog); DBTFLV = operSDO.ReturnOpMsg(strLog,"MiddleState"); } } catch(...) { DBTFLV = operSDO.ReturnOpMsg(strLog,"Error"); } return DBTFLV; } /************************************************************************/ /* //查看玩家身上道具 bool CSDOInfo::SDO_UserEquip_Query() { try { operSDO.GetLogText(strLog, "BaseMessage", "SDO_UserEquip", "", m_UserName,SDO_ServerName,SDO_Account); operSDO.WriteText("SDO",strLog); if(!operSDO.GetServerIP(SDO_ServerIP,SDO_ServerIP,2)) { return false;//无法获取真正的服务器IP } if(!operSDO.getRemoteSql("SDO_UserEquip_Query",operRemoteSql)) { return false;//无法得到查看玩家身上道具的sql语句 } sprintf(operszSql,operRemoteSql,Item_DBName,Item_DBName,UserID);//构造完整查询的sql语句 int tmpLength = DBVect.OperVectorMain("SDO", SDO_ServerIP, operszSql, 0, index, iPageSize);//构造从数据库查询得到的数据 operSDO.ReturnData(&DBVect, tmpLength, operszSql);//发送数据 } catch(...) { operSDO.ReturnOpMsg(strLog,"Error");//将错误信息写入日志中并返回错误信息 } return false; } */ /************************************************************************/ //获取公告类型 <iSouNT: 1 及时公告,0 定时公告 void CSDOInfo::GetNoticeType(char *strDesNT,int &iDesNT, int iSouNT) { if (iSouNT == 1) //及时公告 { logFile.ReadValue("SDO", "NOTICETYPE", "NOtice_inTime", strDesNT, sizeof(&strDesNT)); iDesNT = -1; } else //定时公告 { logFile.ReadValue("SDO", "NOTICETYPE", "NOtice_Time", strDesNT, sizeof(&strDesNT)); iDesNT = 0; } }
[ "wanglin36@CENTALINE.COM.CN" ]
wanglin36@CENTALINE.COM.CN
e5fb03aa0a4b88fff378aab142d97a6b2641852f
d25cd5b322157c6ac17494ecf07360a8d71a5a81
/TargetCode.cpp
97c1e0edd3885785bcb13782c8ab6f6e72cc295b
[ "MIT" ]
permissive
tsemo4917/BUAA-Simple-C0-Compiler
0db77e3539b12eb25d46adedebee26783433c5c8
3d454402f6f1152de60be972f844f69ef95bdc8e
refs/heads/master
2023-04-08T17:49:51.525764
2021-03-16T09:25:22
2021-03-16T09:25:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,034
cpp
#include "TargetCode.h" #include <map> #include <sstream> #include <set> using std::map; using std::set; using std::ostringstream; string reg2str(mipsReg reg) { const static string reg2strArray[] = { "$0", "$at", "$v0", "$v1", "$a0", "$a1", "$a2", "$a3", "$t0", "$t1", "$t2", "$t3", "$t4", "$t5", "$t6", "$t7", "$s0", "$s1", "$s2", "$s3", "$s4", "$s5", "$s6", "$s7", "$t8", "$t9", "$k0", "$k1", "$gp", "$sp", "$fp", "$ra" }; return reg2strArray[(int)reg]; //return "$" + std::to_string(int(reg)); } string TargetCode::toString() { static map<mipsInstr, string> instr2str = { {instr_addiu, "addiu"}, {instr_sll, "sll"}, {instr_slti,"slti"}, {instr_sra, "sra"}, {instr_addu, "addu"}, {instr_subu, "subu"}, {instr_mul, "mul"}, {instr_div, "div"}, {instr_mflo, "mflo"}, {instr_mfhi, "mfhi"}, {instr_move, "move"}, {instr_slt, "slt"}, {instr_seq, "seq"}, {instr_sne, "sne"}, {instr_sgt, "sgt"}, {instr_sge, "sge"}, {instr_sle, "sle"}, {instr_move, "move"}, {instr_sw, "sw"}, {instr_sb, "sb"}, {instr_lw, "lw"}, {instr_lb, "lb"}, {instr_li, "li"}, {instr_la, "la"}, {instr_j, "j"}, {instr_jal, "jal"}, {instr_jr, "jr"}, {instr_beq, "beq"}, {instr_bne, "bne"}, /*{instr_beqz, "beqz"}, {instr_bnez, "bnez"},*/ {instr_blt, "blt"}, {instr_ble, "ble"}, {instr_bgt, "bgt"}, {instr_bge, "bge"}, {instr_label, ""}, {instr_note, "#"}, {instr_syscall, "syscall"} }; ostringstream ostr; if (instr != instr_label) { ostr << "\t" << instr2str[instr] << "\t"; } switch (instr) { case instr_addiu: case instr_sll: case instr_slti: case instr_sra: case instr_addu: case instr_subu: case instr_mul: case instr_slt: case instr_seq: case instr_sne: case instr_sgt: case instr_sge: case instr_sle: { ostr << result << "\t" << var1 << "\t" << var2; break; } case instr_move: ostr << result << "\t" << var1; break; /**********************************************************/ case instr_div: ostr << var1 << "\t" << var2; break; /**********************************************************/ case instr_sw: case instr_sb: case instr_lw: case instr_lb:{ ostr << result << "\t" << var1 << "(" << var2 << ")"; break; } case instr_li: case instr_la: ostr << result << "\t" << var1; break; /**********************************************************/ case instr_mflo: case instr_mfhi: ostr << result; break; case instr_j: case instr_jal: case instr_jr: ostr << result; break; case instr_beq: case instr_bne: case instr_blt: case instr_ble: case instr_bgt: case instr_bge: /*case instr_beqz: case instr_bnez: */{ ostr << var1 << "\t"; if (var2.length() == 0) { ostr << reg2str(reg_0); } else { ostr << var2; } ostr << "\t" << result; break; } /**********************************************************/ case instr_label: { ostr << result << ":"; break; } case instr_note: { ostr << result; break; } case instr_syscall: break; default: break; } return ostr.str(); } bool TargetCode::isCalInstr() { static set<mipsInstr> calInstrSet = { // I_instr instr_addiu, instr_sll, instr_slti, // R_instr instr_addu, instr_subu, instr_mul, /*instr_div,*/ instr_mflo, instr_mfhi, instr_move, instr_slt, instr_seq, instr_sne, instr_sgt, instr_sge, instr_sle, }; return (calInstrSet.find(instr) != calInstrSet.end()); } bool TargetCode::isLoadInstr() { return (instr == instr_lw || instr == instr_lb); } bool TargetCode::isStoreInstr() { return (instr == instr_sw || instr == instr_sb); }
[ "mo491745115@foxmail.com" ]
mo491745115@foxmail.com
b1c688a16fac8a5e4b8a8e802b5577b5bbf4dcbb
3ebf737a1db26350cdcbb9df94a69544af786a16
/Recurssion Multiply/Multiply.cpp
d2f44a358a5863960ef6aad2334dceb342eca407
[]
no_license
takanju/Programming_Assignment_180A
8964d974a32723e060746c85a465a4e268475640
0cfaf116a81c8621271bf535b22e5bd166b546ef
refs/heads/master
2023-02-26T10:44:24.260277
2021-02-04T06:30:29
2021-02-04T06:30:29
335,859,228
0
0
null
null
null
null
UTF-8
C++
false
false
506
cpp
/* * Multiply.cpp * * Created on: Oct 20, 2020 * Author: swapnanjali */ #include <iostream> #include <iomanip> using namespace std; long multiply(int i, int j); int main() { int n1 = 8; int n2 = 12; long product = multiply(n1, n2); cout << "The product of " << n1 << " and " << n2 << " is " << product << endl; } long multiply(int i, int j) { switch (i) { case 0: return 0; case 1: return j; default: return j + multiply(i-1, j); } }
[ "tak.anju@gmail.com" ]
tak.anju@gmail.com
d6136c3cbc70577bc765c9d04b4a45871383479d
6c15077cdd6ec01215332c58428d2d9bda3217b1
/spank3d/inc/ui/style/PieceInfo.h
70076c39db960f572c01a22fd851199da138c47f
[]
no_license
zjhlogo/spank3d
6efb88a59ef281707bafaeab74736482a7c13bd8
540b197d1a66bb72cc2fc30f1476b22c6ce1c3b3
refs/heads/master
2016-09-10T19:19:27.739776
2013-04-18T01:12:46
2013-04-18T01:12:46
32,371,451
0
0
null
null
null
null
UTF-8
C++
false
false
668
h
/*! * \file PieceInfo.h * \date 9-20-2012 14:08:04 * * * \author zjhlogo (zjhlogo@gmail.com) */ #ifndef __PIECEINFO_H__ #define __PIECEINFO_H__ #include "../../type/BaseType.h" #include "../../render/ITexture.h" #include <tinyxml-2.6.2/tinyxml.h> class PieceInfo { public: PieceInfo(const tstring& id); ~PieceInfo(); const tstring& GetId() const; bool FromXml(TiXmlElement* pXmlPieceInfo, ITexture* pTex); TiXmlElement* ToXml(); public: float x; float y; float width; float height; float u; float v; float du; float dv; ITexture* pTexture; private: tstring strId; }; #endif // __PIECEINFO_H__
[ "zjhlogo@146e4613-b970-0576-f1ea-3e13f537ed8b" ]
zjhlogo@146e4613-b970-0576-f1ea-3e13f537ed8b
5e5663417e3c1778d425021be0bb77879a7fb9e0
89870ca1f16af0f2ba65ec0175cd089da852afbc
/codeforces/round-737-div-2/a.cpp
b686d6c55c14aa64f5efcd9592aae4f6d1072b60
[]
no_license
Merisho/comprog
3b8ce833f0f16dbcfa252f9c6678c160bf081a11
fb4829ba93fcb376078a5baccda0c07ce35d6d04
refs/heads/master
2023-08-18T00:10:45.535195
2023-08-11T07:16:02
2023-08-11T07:16:02
216,174,595
0
0
null
null
null
null
UTF-8
C++
false
false
444
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int T; cin >> T; cout << setprecision(9); ll s = 0; ll mx = -1e9; double ans; for (int test_case = 1; test_case <= T; ++test_case) { int n; cin >> n; s = 0; mx = -1e9; for (int i = 0; i < n; ++i) { ll a; cin >> a; s += a; mx = max(mx, a); } ans = mx + double(s - mx) / double(n - 1); cout << ans << endl; } return 0; }
[ "merishot@gmail.com" ]
merishot@gmail.com
47aecf5f9cfe0c6f3ba0112acb23325243161ecb
71c1c86b30c1518e21728f7d5e0f09b5e602baac
/Algo_Engine/Market_Data/Wombat_Market_Data_Source.cpp
630c7c8a3ee72fbd5619dafa580fae9819499ebc
[]
no_license
ssh352/ronin
3ddf360fec5f106015c6902b5107aedefe934836
33301b6c5e68fa9d02c7d54bc86f6b7732985fc2
refs/heads/master
2023-05-03T11:00:39.368460
2021-05-17T18:41:08
2021-05-17T18:41:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,265
cpp
#include <ace/log_msg.h> #include "Wombat_Market_Data_Source.hpp" using namespace dart; using namespace Wombat; #include "Transport_Callback.hpp" #include "Dictionary_Callback.hpp" #include <Bullseye/Bullseye_Common.hpp> #include <cassert> Wombat_Market_Data_Conduit::Wombat_Market_Data_Conduit () : bridge_ (0), transport_ (0), queue_ (0) { try { // TODO: Will have to make this configurable for // production to allow LBM connections as well. bridge_ = Mama::loadBridge ("wmw"); // VERY important this is done AFTER Mama::loadBridge() // but before any other initialization steps! Mama::open (); this->transport_ = new MamaTransport (); // TODO: Will have to make this configurable for // production to allow different configuration names this->transport_->create ("ronin", bridge_); transport_->setTransportCallback (new Transport_Callback ()); this->queue_ = Mama::getDefaultEventQueue (bridge_); if (queue_ == 0) { throw std::runtime_error ("cannot get default MAMA queue"); } Mama::startBackground (this->bridge_, this); } catch (const MamaStatus &e) { ACE_ERROR ((LM_ERROR, ACE_TEXT (e.toString ()))); } } int Wombat_Market_Data_Conduit::subscribe_symbol (const char *symbol) { Symbols::const_iterator iter (this->symbol_subscriptions_.find (symbol)); // Only subscribe if we are not already getting data if (iter == this->symbol_subscriptions_.end ()) { try { MamaSubscription *psubscription = new MamaSubscription (); psubscription->setSubscriptionType (MAMA_SUBSC_TYPE_NORMAL); psubscription->setServiceLevel (MAMA_SERVICE_LEVEL_REAL_TIME, 0); // TODO: This subscription is either for CTA or NASDAQ; which one it is will // have to be determined by another lookup to the TPOS database to determine // the feed it's on. For now, we'll artificially pick one or the other. psubscription->create (this->transport_, this->queue_, this, "NASDAQ", symbol); this->subscriptions_.insert (psubscription); this->symbol_subscriptions_.insert (std::string (symbol)); } catch (const MamaStatus &mama_error) { ACE_ERROR ((LM_ERROR, ACE_TEXT (mama_error.toString ()))); return -1; } } return 0; } int Wombat_Market_Data_Conduit::unsubscribe_symbol (const char*) { return -1; } Price_Block* Wombat_Market_Data_Conduit::get_price_block (const char *symbol) const { return this->get_price_block (std::string (symbol)); } Price_Block* Wombat_Market_Data_Conduit::get_price_block (const std::string &symbol) const { assert (!symbol.empty ()); ACE_Guard <ACE_Thread_Mutex> g (this->mutex_); Watch_Map::const_iterator i (sym_watches_.find (symbol)); if (i == sym_watches_.end ()) { return 0; } Price_Block *pnewblock = new Price_Block (i->second); return pnewblock; } void Wombat_Market_Data_Conduit::onStartComplete (MamaStatus status) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (DART_LOG ("%s received status %s")), __FUNCTION__, status.toString ())); } void Wombat_Market_Data_Conduit::onCreate (Wombat::MamaSubscription *psubscription) { ACE_DEBUG ((LM_DEBUG, DART_LOG ("Successfully created subscription for %s\n"), psubscription ? psubscription->getSymbol () : "nullptr")); } void Wombat_Market_Data_Conduit::onError (MamaSubscription *psubscription, const MamaStatus &status, const char *msg) { ACE_DEBUG ((LM_DEBUG, DART_LOG ("Error on subscription for %s with status %s: %s"), psubscription ? psubscription->getSymbol () : "nullptr", status.toString (), msg ? msg : "nullptr")); } void Wombat_Market_Data_Conduit::onMsg (MamaSubscription *psubscription, MamaMsg &msg) { if (msg.getType () != MAMA_MSG_TYPE_INITIAL && msg.getType () != MAMA_MSG_TYPE_QUOTE) return; ACE_Guard <ACE_Thread_Mutex> guard (this->mutex_); const char *psym = 0; bool foundsym = msg.tryString (0, 305 /*wIssueSymbol*/, psym); if (!foundsym) { psym = psubscription->getSymbol (); if (psym == 0 || !isalpha (psym [0])) { const char *pstr_try_again = 0; msg.tryString (0, 305, pstr_try_again); } } Price_Block *pblock = 0; if (foundsym) { Watch_Map::iterator price_block_iter = this->sym_watches_.find (psym); if (price_block_iter != this->sym_watches_.end ()) { pblock = & (price_block_iter->second); } else { // Add priceb lock for the first time Watch_Map_Insert_Result result = this->sym_watches_.insert (std::make_pair (std::string (psym), Price_Block ())); if (result.second) { Watch_Map::iterator iter (result.first); pblock = & (iter->second); } } if (pblock) { switch (msg.getType ()) { case MAMA_MSG_TYPE_INITIAL: processInitialUpdate (msg, pblock); case MAMA_MSG_TYPE_QUOTE: updatePriceBlock (msg, pblock); break; case MAMA_MSG_TYPE_TRADE: break; default: break; } } } } void Wombat_Market_Data_Conduit::processInitialUpdate (const MamaMsg & /*msg*/, Price_Block * /*pblock*/) { #if 0 pblock->initialized_ = true; msg.tryI64 (0, 324 /*wLotSize*/, pblock->lot_size); #endif } void Wombat_Market_Data_Conduit::updatePriceBlock (const MamaMsg & /*msg*/, Price_Block * /*pblock*/) { #if 0 msg.tryF64 (0, 109 /*ask price*/, pblock->ask_price); msg.tryF64 (0, 237 /*bid price*/, pblock->bid_price); msg.tryI64 (0, 110 /*ask size */, pblock->ask_size); msg.tryI64 (0, 238 /*bid size */, pblock->bid_size ); const char *pbuffer = 0; if (msg.tryString (0, 108 /*wAskPartId*/, pbuffer)) { pblock->ask_part_id = pbuffer; } if (msg.tryString (0, 236 /*wBidPartId*/, pbuffer)) { pblock->bid_part_id = pbuffer; } // Sanity check: did we get this quote before? mama_i32_t current_seq_num (-1); if (msg.tryI32 (0, 441 /*wQuoteSeqNum*/, current_seq_num)) { if (current_seq_num == pblock->quote_seq_no_) { cerr << "Got this quote already! pblock->Quote ID = " << current_seq_num << endl; cerr << *pblock << endl; } pblock->quote_seq_no_ = current_seq_num; } #endif } void Wombat_Market_Data_Conduit::onQuality (MamaSubscription*, mamaQuality quality, const char *symbol, short, const void*) { ACE_DEBUG ((LM_DEBUG, DART_LOG ("Quality update on %s: %s"), symbol ? symbol : "nullptr", mamaQuality_convertToString (quality))); }
[ "pflynn@sumocap.com" ]
pflynn@sumocap.com
159339a40beae840fc993241e6e3f6bfc29a3c53
a7764174fb0351ea666faa9f3b5dfe304390a011
/drv/PColStd/PColStd_FieldOfHArray1OfInteger_0.cxx
e9137f392886974d3cb626f02ca9011108ddf8c9
[]
no_license
uel-dataexchange/Opencascade_uel
f7123943e9d8124f4fa67579e3cd3f85cfe52d91
06ec93d238d3e3ea2881ff44ba8c21cf870435cd
refs/heads/master
2022-11-16T07:40:30.837854
2020-07-08T01:56:37
2020-07-08T01:56:37
276,290,778
0
0
null
null
null
null
UTF-8
C++
false
false
1,932
cxx
// This file is generated by WOK (CPPExt). // Please do not edit this file; modify original file instead. // The copyright and license terms as defined for the original file apply to // this header file considered to be the "object code" form of the original source. #include <PColStd_FieldOfHArray1OfInteger.hxx> #ifndef _Standard_Type_HeaderFile #include <Standard_Type.hxx> #endif #ifndef _Standard_NegativeValue_HeaderFile #include <Standard_NegativeValue.hxx> #endif #ifndef _Standard_OutOfRange_HeaderFile #include <Standard_OutOfRange.hxx> #endif #ifndef _Standard_DimensionMismatch_HeaderFile #include <Standard_DimensionMismatch.hxx> #endif #ifndef _Standard_NullObject_HeaderFile #include <Standard_NullObject.hxx> #endif #ifndef _PColStd_VArrayNodeOfFieldOfHArray1OfInteger_HeaderFile #include <PColStd_VArrayNodeOfFieldOfHArray1OfInteger.hxx> #endif #ifndef _PColStd_VArrayTNodeOfFieldOfHArray1OfInteger_HeaderFile #include <PColStd_VArrayTNodeOfFieldOfHArray1OfInteger.hxx> #endif IMPLEMENT_STANDARD_TYPE(PColStd_FieldOfHArray1OfInteger) IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() STANDARD_TYPE(DBC_BaseArray), STANDARD_TYPE(Standard_Storable), IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() IMPLEMENT_STANDARD_TYPE_END(PColStd_FieldOfHArray1OfInteger) #define Item Standard_Integer #define Item_hxx <Standard_Integer.hxx> #define DBC_VArrayNode PColStd_VArrayNodeOfFieldOfHArray1OfInteger #define DBC_VArrayNode_hxx <PColStd_VArrayNodeOfFieldOfHArray1OfInteger.hxx> #define DBC_VArrayTNode PColStd_VArrayTNodeOfFieldOfHArray1OfInteger #define DBC_VArrayTNode_hxx <PColStd_VArrayTNodeOfFieldOfHArray1OfInteger.hxx> #define Handle_DBC_VArrayNode Handle_PColStd_VArrayNodeOfFieldOfHArray1OfInteger #define DBC_VArrayNode_Type_() PColStd_VArrayNodeOfFieldOfHArray1OfInteger_Type_() #define DBC_VArray PColStd_FieldOfHArray1OfInteger #define DBC_VArray_hxx <PColStd_FieldOfHArray1OfInteger.hxx> #include <DBC_VArray.gxx>
[ "shoka.sho2@excel.co.jp" ]
shoka.sho2@excel.co.jp
fd804ae4f86660833eb38969edaa24c654755311
72121bfc135741af84a0d8e36706fb55e8497d95
/src/server/src/io_dispatcher.h
4740971458b1af334717eedee5ba4781d85d7976
[]
no_license
lylw/lylw-C--
901a78e2286df7ecb88d80685f2e4a95d5e75a65
8f46f06f934fb4fafc5532279dec00361e0fbd90
refs/heads/master
2021-01-10T19:58:25.506031
2013-09-18T10:33:17
2013-09-18T10:33:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,771
h
#ifndef NETWORK_EVENT_H_ #define NETWORK_EVENT_H_ #include <network_common.h> #include <tcp_connection.h> #include "opcodes_handler.h" #include "session_manager.h" class IODispatcher { public: IODispatcher(){} ~IODispatcher(){} public: void NewConnectionHandler(const TcpConnectionPtr& connection, const InetAddress& peerAddress) { GameSession* session = SessionPool::instance().acquire(connection->handle()); SessionManager::instance().add_session(session); std::cout << "New Session [NativeHandle = " << connection->handle() << ", Peer = " << peerAddress.toIpHost() << "]" << std::endl; } void WriteCompletedHandler(const TcpConnectionPtr& connection, uint32_t bytes_transferred) { std::cout << "Write completed handler." << std::endl; } void ReadCompletedHandler( const TcpConnectionPtr& connection, uint32_t opcode, const google::protobuf::Message& message, uint32_t bytes_transferred) { std::cout << "Read completed handler." << std::endl; std::cout << " opcode = " << opcode << std::endl; OpcodeHandler* handler = OpcodeTable::instance()[opcode]; if (handler != NULL) { GameSession* session = SessionManager::instance().get(connection->handle()); if (session != NULL) handler->message_handler(session, message); } } void ConnectionClosed(const TcpConnectionPtr& connection) { std::cout << "Connection closed handler." << std::endl; GameSession* session = SessionManager::instance().get(connection->handle()); SessionManager::instance().remove_session(session); SessionPool::instance().release(session); } }; #endif
[ "138001655@qq.com" ]
138001655@qq.com
547329b16b149853b0c78d09d0e476fe95bbf2ad
cefd6c17774b5c94240d57adccef57d9bba4a2e9
/WebKit/Source/JavaScriptCore/ftl/FTLSwitchCase.h
123a4753a8e607a939e7e20b800ab9f596b2fc84
[ "BSL-1.0" ]
permissive
adzhou/oragle
9c054c25b24ff0a65cb9639bafd02aac2bcdce8b
5442d418b87d0da161429ffa5cb83777e9b38e4d
refs/heads/master
2022-11-01T05:04:59.368831
2014-03-12T15:50:08
2014-03-12T15:50:08
17,238,063
0
1
BSL-1.0
2022-10-18T04:23:53
2014-02-27T05:39:44
C++
UTF-8
C++
false
false
1,982
h
/* * Copyright (C) 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef FTLSwitchCase_h #define FTLSwitchCase_h #if ENABLE(FTL_JIT) #include "FTLAbbreviatedTypes.h" #include "FTLWeight.h" namespace JSC { namespace FTL { class SwitchCase { public: SwitchCase(LValue value, LBasicBlock target, Weight weight) : m_value(value) , m_target(target) , m_weight(weight) { } LValue value() const { return m_value; } LBasicBlock target() const { return m_target; } Weight weight() const { return m_weight; } private: LValue m_value; LBasicBlock m_target; Weight m_weight; }; } } // namespace JSC::FTL #endif // ENABLE(FTL_JIT) #endif // FTLSwitchCase_h
[ "adzhou@hp.com" ]
adzhou@hp.com
8e42c0d4bbb67d01d3f9d0641a828a61929c2927
ef9a782df42136ec09485cbdbfa8a56512c32530
/branches/Separator/base/message.cpp
7d30b814652474a2979c13ec05cac58ed3150323
[]
no_license
penghuz/main
c24ca5f2bf13b8cc1f483778e72ff6432577c83b
26d9398309eeacbf24e3c5affbfb597be1cc8cd4
refs/heads/master
2020-04-22T15:59:50.432329
2017-11-23T10:30:22
2017-11-23T10:30:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,747
cpp
/****************************************************************************\ $URL$ $LastChangedDate$ $LastChangedRevision$ $LastChangedBy$ \****************************************************************************/ #include "message.h" #include "bstime.h" #include <string.h> #include "../tools/fileAccess.h" //--------------- Initialize static members ------------------------------------ #ifndef NITROSCAPE ofstream * message::fw=NULL; ofstream * message::fl=NULL; char * message::WarnFileName=NULL; char * message::LogFileName=NULL; int message::Warnings=0; int message::Copies=0; #endif //------------------------------------------------------------------------------ message::message() { Copies++; #ifndef NITROSCAPE if (Copies!=1) FatalError("message::message - Only one instance of this class is allowed"); #else fw=NULL; fl=NULL; fd=NULL; ff1=NULL; ff2=NULL; WarnFileName=NULL; LogFileName=NULL; DebugFileName=NULL; FieldFile1Name=NULL; FieldFile2Name=NULL; Warnings=0; #endif } message::~message() { fw->close(); fl->close(); if (fw) { delete fw; fw=NULL; delete fl; fl=NULL; delete WarnFileName; delete LogFileName; } Copies--; } char * message::AssignString(char * c) { char * ch=(char*)::operator new(strlen(c)+1); strcpy(ch,c); return ch; } // Must be called by simulation start. Can only be called once. void message::InitMessage(char * WarnFN,char * LogFN) { Warnings = 0; if (!fw) { WarnFileName=AssignString(WarnFN); LogFileName=AssignString(LogFN); fw = new ofstream(WarnFileName,ios::out); *fw << "FASSET v2.1" << endl; fl = new ofstream(); // fl = new fstream(LogFileName,ios::out); fl->open(LogFileName,ios::out); // cout << LogFileName << endl; // if (fstream::failbit!=0) // cout << "help"; *fl << "FASSET v2.1" << endl; // *fd << "FASSET v2.1" << endl; } else FatalError("message::InitMessage called twice"); } void message::Warning(const char * cp1,const char * cp2,const char * cp3) { if (fw) { *fw << cp1 << cp2 << cp3 << " (" << theTime << ")" << endl; Warnings++; } else FatalError("message::Warning called prior to initialization"); } void message::Warning(const string st1, const string st2, const string st3) { Warning((char*) st1.c_str(),(char*) st2.c_str(),(char*) st3.c_str()); } void message::WarningWithDisplay(const char * cp1,const char * cp2,const char * cp3) { Warning(cp1,cp2,cp3); cout << endl << cp1 << cp2 << cp3 << " (" << theTime << ")" << endl; } void message::WarningWithDisplay(const string st1, const string st2, const string st3) { WarningWithDisplay((char*) st1.c_str(),(char*) st2.c_str(),(char*) st3.c_str()); } void message::Warning(const string cp1,const int anint) { if (fw) { *fw << cp1 << anint << " (" << theTime << ")" << endl; Warnings++; } else FatalError("message::Warning called prior to initialization"); } void message::WarningWithDisplay(const char * cp1,const double aNumber,const char * cp3) { char NumberString[40]; sprintf(NumberString, " %f ", aNumber); WarningWithDisplay(cp1,NumberString,cp3); } void message::FatalError(string cp1,string cp2,string cp3) { FatalError((char*) cp1.c_str(),(char*) cp2.c_str(),(char*) cp3.c_str()); } void message::FatalError(const char * cp1,const char * cp2,const char * cp3) { cout << endl << "Fatal error: " << cp1 << cp2 << cp3 << endl; cout << " (" << theTime << ")" << endl; // cout << "Program will terminate. Press any key." << endl; cout << "Press 'Y' to terminate, any other key to continue." << endl; // While debugging #ifndef __BCplusplus__ char ch=getchar(); #else char ch=getch(); #endif if (ch=='y' || ch=='Y' ) { fl->close(); fw->close(); exit(99); } } void message::LogEvent(const char * cp) { if (fl) { *fl << cp << endl; } else FatalError("message::LogEvent called prior to initialization"); } void message::LogEvent(const char * cp, double number) { if (fl) { *fl << cp << number << endl; } else FatalError("message::LogEvent called prior to initialization"); } int message::NumOfWarnings() { return Warnings; } // Allows "streaming" of logfile-output. ofstream * message::GiveHandle() { if (!fl) FatalError("message::GiveHandle called prior to initialization"); return fl; } void message::LogEventWithTime(const char * cp1) { if (fl) { *fl << theTime << " "; LogEvent(cp1); } else FatalError("message::LogEvent called prior to initialization"); } void message::LogEventWithTime(const char * cp, const double number) { if (fl) { *fl << theTime << " "; LogEvent(cp, number); } else FatalError("message::LogEvent called prior to initialization"); }
[ "sai@agro.au.dk" ]
sai@agro.au.dk
0dfb769ad1b5b301bdb32ed52e9c9e5db401eaf2
6a26fd3ac0160db38c45aa1d7d2f808b273ea4a3
/Geometry Wars Qt v2/Geometry_Wars_v2/game.h
4c39227603c7d37edf4850dd7f24c0c860f4cfab
[]
no_license
gtm2654197/School-Projects
c1c7717d69c69da5e68d0e4c9fc99f301a10b0c9
fa0798172e1c0f2b0fecb332c5655caa464babe1
refs/heads/master
2021-01-19T06:38:22.760951
2017-04-21T15:13:08
2017-04-21T15:13:08
87,474,438
0
0
null
null
null
null
UTF-8
C++
false
false
5,364
h
#ifndef GAME_H #define GAME_H #include <vector> #include <SFML/Graphics.hpp> #include <SFML/Audio.hpp> #include <cstdlib> #include <time.h> #include <math.h> #include <string> #include <queue> #include "player.h" #include "constants.h" #include "enemy.h" #include "blue.h" #include "purple.h" #include "green.h" #include "pink.h" #include "smallpink.h" #include "weapon.h" #include "weapont1.h" #include "weapont2.h" #include "weapont3.h" #include "expparticles.h" using namespace std; class game { public: game(); //Default Constructor void Draw(); //Draws all sprites to window void run(); //Contains loop for update, render, draw, process void processEvents(); //Interprets user input and updates relevant data void update(); //Updates sprite positions and performs collision checks void render(); //Calls window clear, Draw() function, then display void processMovement(); //Called by process events to interpret movement input void Fire(float x, float y); //Called by process fire to spawn bullets with direction x,y void processFire(); //Called by process events to interpret fire input void RandomSpawn(int enemyType); //Called by enemyEvent() to spawn enemy at random position void updateOverlay(); //Overlay for score and life count void enemyEvent(); //Handles all enemy spawning events void PlayerCollision(); //Handles and resolves player collision, set gameOver if no lives void gameOverhandler(); //Called if gameOver == true, displays game over screen, waits for input void playerExplosion(); //Inserts explosion particles into explosions vector for player collision void weaponSwitch(); //Handles weapon switching at different intervals private: vector<Enemy> livingEnemies; //Contains all enemies to be displayed vector<Weapon> bullets; //Contains all bullets to be displayed vector<ExpParticles> explosions; //Current explosion particles to draw std::queue<Enemy> eventEnemies; //Enemies queued and waiting to be pushed std::queue<int> eventType; //Type of event to know how to push eventEnemies to livingEnemies bool timedEvent; //Tells enemyEvent whether or not to eventType is timed int eventIterations; //How many iterations of a timed event for enemy spawning sf::Clock timedSpawn; //Spawns enemies of timed event at regular interval //All textures drawn to sprites in game sf::Texture bullet1, bullet2, bullet3, enemyBlue, enemyPurple, enemyGreen, enemyPink, enemysmallPink; //All sounds effects to play for certain actions sf::Sound weapon1, weapon2, weapon3, spawnEnemy, wallCollision, enemyHit, shipexplode, shipspawn; //Sound buffer to load in sounds from file sf::SoundBuffer weapon1b, weapon2b, weapon3b, spawnEnemyb, wallCollisionb, enemyHitb, shipexplodeb, shipspawnb; //Music to be played in background depending on game state sf::Music backgroundMusic, endgameMusic; sf::RenderWindow window; //Window to draw game sf::View playerCenter; //View port for camera to follow player sf::Clock spawnClock; //Clock for spawning enemies at regular interval bool fireReady; //Resolves fire rate sf::Clock fireRate; //Allows firing at regular interval sf::Clock frameClock; //Updates game at 60Hz int weaponType; //Current weapon type of player player _player; //Player object, contains player sprite, velocity, etc sf::RectangleShape border; //Game border sf::Texture backgroundImage; //Background texture for background sprite sf::Sprite background; //Background drawn first bool spawnReady; //Checks if enough time has elapsed to spawn enemy int spawnTime; //Changes spawn rate as game progresses int score; //Current score int multiplier; //Multiplier accrued over time, default = 1 int nextMult; //Next multiplier threshold int tonextMult; //Points accrued toward nextMult threshold int tonextWeaponSwitch; //Points accrued toward nextWeaponSwitch threshold int nextWeaponSwitch; //Next weapon switch threshold sf::Text displayScore; //Text to display score to screen sf::Text displayLives; //Text to display lives to screen sf::Text gameOverText1; //Game over text "Game Over" sf::Text gameOverText2; //Game over text "Press [Space] to continue" bool showMultiplier; //Set to true when multiplier incremented sf::Text multiplierMessage; //Displays new multiplier value if showMultiplier = true sf::Clock multiplierClock; //Shows multiplier message for set amount of time sf::Font font; //Unique font used by text int lives; //Number of lives player currently has, default = 3 bool gameOver; //Set to true when player lives = 0 }; #endif // GAME_H
[ "taylor.mcclamroch@gmail.com" ]
taylor.mcclamroch@gmail.com