blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
201
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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
sequencelengths 1
1
| author
stringlengths 0
119
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7eb330f56293327d266c4af9106ac42d0dc632d9 | 05de7d132222e530da57c651ec7d1c42d3859ed2 | /src/pbbastian/stbi.hpp | 982bc70b613f7dea1406ec2240117d01c43edc56 | [
"MIT"
] | permissive | Ruias/vulkan-tutorial | 7a988f12eeaebc1ad61c5c6fead585a333aa765f | 6a83aa0ab1824a5127bbfbcb2edfb6bc51f62eda | refs/heads/master | 2021-06-02T10:48:27.676588 | 2016-08-16T17:25:51 | 2016-08-16T17:25:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 783 | hpp | #pragma once
#include <memory>
#include <stb_image.h>
namespace pbbastian {
namespace stbi {
enum class comp_type {
default_ = 0, // only used for req_comp
grey = 1,
grey_alpha = 2,
rgb = 3,
rgb_alpha = 4
};
using image = std::unique_ptr<stbi_uc, decltype(&stbi_image_free)>;
inline image load(const char *filename, int &x, int &y, int &comp,
comp_type req_comp) {
auto image_ptr =
stbi_load(filename, &x, &y, &comp, static_cast<int>(req_comp));
return image(image_ptr, stbi_image_free);
}
inline image load(const char *filename, int &x, int &y, comp_type req_comp) {
auto image_ptr =
stbi_load(filename, &x, &y, nullptr, static_cast<int>(req_comp));
return image(image_ptr, stbi_image_free);
}
}
}
| [
"Peter Bay Bastian"
] | Peter Bay Bastian |
98669efe2e05904b7299860c4fc8221228cf3033 | 2c0dc4ef9f16ba973dbca5fdc5b2403362fdf209 | /fs/tfs_state.cpp | 16683a6d6673a5340ada1c823f4204ea53568f29 | [
"BSD-3-Clause"
] | permissive | melody97/tablefs-kv-wrapper | e07176efa09f11a398f3298859f7feaf76e6c090 | f14e23443e0680c989785e4dbd57ae284f155138 | refs/heads/master | 2023-08-14T12:51:28.025207 | 2021-10-15T06:59:57 | 2021-10-15T06:59:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,555 | cpp | #include <unistd.h>
#include "fs/tfs_state.h"
#include "adaptor/leveldb_wrapper.h"
#ifdef UTREE
#include "adaptor/utree_wrapper.h"
#endif
#ifdef ROCKSDB
#include "adaptor/rocksdb_wrapper.h"
#endif
#ifdef METAKV
#include "adaptor/metakv_wrapper.h"
#endif
#ifdef HIKV
#include "adaptor/hikv_adaptor.h"
#endif
#ifdef ROART
#include "adaptor/roart_wrapper.h"
#endif
#ifdef TLHASH
#include "adaptor/tlhash_wrapper.h"
#endif
namespace tablefs {
FileSystemState::FileSystemState() :
metadb(NULL), max_inode_num(0), threshold_(0), logs(NULL) {
}
FileSystemState::~FileSystemState() {
}
int FileSystemState::Setup(Properties& prop) {
char resolved_path[4096];
char* ret;
ret = realpath(prop.getProperty("metadir").c_str(), resolved_path);
metadir_ = std::string(resolved_path);
ret = realpath(prop.getProperty("datadir", "/mnt/pmem/tablefs").c_str(), resolved_path);
datadir_ = std::string(resolved_path);
ret = realpath(prop.getProperty("mountdir").c_str(), resolved_path);
mountdir_= std::string(resolved_path);
threshold_ = prop.getPropertyInt("threshold", 4096);
if (access(datadir_.c_str(), W_OK)>0 || access(metadir_.c_str(), W_OK)>0) {
fprintf(stderr, "cannot open directory!\n");
exit(1);
}
logs = new Logging(prop.getProperty("logfile", ""));
logs->SetDefault(logs);
logs->Open();
Properties prop_ = prop;
prop_.setProperty("leveldb.db", metadir_+std::string("/meta"));
prop_.setProperty("leveldb.create.if.missing.db", "true");
//metadb = new LeveldbWrapper();
#ifdef UTREE
printf("Init with utree\n");
metadb = new uTreeWrapper();
#endif
#ifdef ROCKSDB
printf("Init with rocksdb\n");
metadb = new RocksdbWrapper();
#endif
#ifdef METAKV
printf("Init with metakv\n");
metadb = new MetaKVWrapper();
#endif
#ifdef HIKV
printf("Init with hikv\n");
metadb = new HikvWrapper();
#endif
#ifdef ROART
printf("Init with roart\n");
metadb = new RoartWrappr();
#endif
#ifdef TLHASH
printf("Init with tlhash\n");
metadb = new TlhashWrapper();
#endif
metadb->SetProperties(prop_);
metadb->SetLogging(logs);
/*if (metadb->Init() < 0) {
printf("failed to open metadb %s\n", prop_.getProperty("leveldb.db").c_str());
return -1;
} else {
printf("open metadb successfully %s\n", metadir_.c_str());
}*/
logs->LogMsg("Initialized two databases.\n");
char fpath[256];
sprintf(fpath, "%s/root.dat", datadir_.data());
FILE *f = fopen(fpath, "r");
if (f == NULL) {
f = fopen(fpath, "w");
max_inode_num = 0;
fprintf(f, "%u\n", max_inode_num);
fclose(f);
char fpath[512];
sprintf(fpath, "%s/%d", datadir_.data(), 0);
mkdir(fpath, 0777);
} else {
if (fscanf(f, "%u", &max_inode_num) == 0) {
max_inode_num = 0;
}
fclose(f);
}
return 0;
}
void FileSystemState::Destroy() {
char fpath[256];
sprintf(fpath, "%s/root.dat", datadir_.data());
FILE* f = fopen(fpath, "w");
if (f != NULL) {
fprintf(f, "%u\n", max_inode_num);
fclose(f);
logs->LogMsg("fpath: %s\n", fpath);
} else {
logs->LogMsg("Cannot write the max inode num: %s %s\n",
fpath, strerror(errno));
}
if (metadb != NULL) {
metadb->Cleanup();
delete metadb;
}
if (logs != NULL)
delete logs;
}
tfs_inode_t FileSystemState::NewInode() {
++max_inode_num;
if (max_inode_num % (NUM_FILES_IN_DATADIR) == 0) {
char fpath[512];
sprintf(fpath, "%s/%d", datadir_.data(),
(int) max_inode_num >> 14);
mkdir(fpath, 0777);
}
return max_inode_num;
}
}
| [
"[email protected]"
] | |
be972ef62816cc28d02b45c96517edce9b3d745d | 843369b29c7b8423b2387a1b847e844280e892d4 | /block.cc | b945404a877192cf041509bd0aa9723e0b67950a | [] | no_license | koileee/Biquadris | a97357d8eeef31ea0c0d90dcf5c51ec0f528766f | f19898c941f58e72295dddb4346a80abf8255fb0 | refs/heads/master | 2020-07-09T08:42:58.350778 | 2019-08-23T08:15:09 | 2019-08-23T08:15:09 | 203,930,259 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 846 | cc | #include <iostream>
#include <vector>
#include <string>
#include "block.h"
using namespace std;
char Block::getType(){
return type;
}
int Block::getLevel(){
return level;
}
Block::Block(char type_, int level_, string color_,
int r_, int c_, int pieces_, int state_, bool isheavy_):
type{type_}, level{level_}, color{color_}, r{r_}, c{c_}, pieces{pieces_},
state{state_}, isheavy{isheavy_} {
if (level_ >= 3) {
isheavy = true;
}
}
Block::~Block(){}
bool Block::isHeavy(){
return isheavy;
}
void Block::losePiece(){
--pieces;
}
bool Block::isCleared(){
return (pieces == 0);
}
void Block::up(){
--r;
}
void Block::down(){
++r;
}
void Block::left(){
--c;
}
void Block::right(){
++c;
}
void Block::cw(){
state = (state+1)%4;
}
void Block::ccw(){
state = (state+3)%4;
}
string Block::getColor(){
return color;
}
| [
"[email protected]"
] | |
5104deb0ec8254c196772c7251160ce83bf1a394 | 0581be965f480308cbbabc2c0afd32d9aeefbcae | /project 3/inputs.cpp | 2f284bda140e51039abf038f7149adf5176c496d | [] | no_license | asifmahmud/ICS_45C_Projects | c3fb0bccabaeec779e0fc19ec607f338c0c46338 | ff91a69da8ddec6cefdce4c9f11de1a4a825a60d | refs/heads/master | 2021-01-18T18:38:30.830600 | 2017-03-31T23:43:00 | 2017-03-31T23:43:00 | 86,868,475 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,725 | cpp | #include <iostream>
#include <string>
#include <sstream>
#include "inputs.hpp"
Commands::Commands()
:main_commands(true), debug_commands(false)
{
HashMap hm;
}
std::string Commands::return_input()
{
std::string input;
std::getline(std::cin, input);
return input;
}
void Commands::handle_debug(const std::string &input1,
const std::string &input2,
const std::string &input3)
{
if (input1 == "DEBUG" && input2 == "ON" && debug_commands)
{
std::cout << "ON ALREADY" << std::endl;
}
else if (input1 == "DEBUG" && input2 == "ON" && !debug_commands)
{
debug_commands = true;
std::cout << "ON NOW" << std::endl;
}
else if (input1 == "DEBUG" && input2 == "OFF" && !debug_commands)
{
std::cout << "OFF ALREADY" << std::endl;
}
else if (input1 == "DEBUG" && input2 == "OFF" && debug_commands)
{
debug_commands = false;
std::cout << "OFF NOW" << std::endl;
}
else if (!debug_commands && ((input1 == "LOGIN" && input2 == "COUNT") ||
(input1 == "BUCKET" && input2 == "COUNT") ||
(input1 == "LOAD" && input2 == "FACTOR") ||
(input1 == "MAX" && input2 == "BUCKET" && input3 == "SIZE")))
{
std::cout << "INVALID" << std::endl;
}
else
{
hd_inv = "INVALID";
}
}
void Commands::handle_main_commands(const std::string &input1,
const std::string &input2,
const std::string &input3)
{
//CREATE
if (input1 == "CREATE" && input2 != "none" && input3 != "none")
{
if (hm.contains(input2))
{
std::cout << "EXISTS" << std::endl;
}
else
{
hm.add(input2, input3);
std::cout << "CREATED" << std::endl;
}
}
//REMOVE
else if (input1 == "REMOVE" && input2 != "none")
{
if (hm.contains(input2))
{
hm.remove(input2);
std::cout << "REMOVED" << std::endl;
}
else
{
std::cout << "NONEXISTENT" << std::endl;
}
}
//LOGIN
else if (input1 == "LOGIN" && input2 != "none" && input3 != "none")
{
if (hm.contains(input2) && (hm.value(input2) == input3))
{
std::cout << "SUCCEEDED" << std::endl;
}
else
{
std::cout << "FAILED" << std::endl;
}
}
//CLEAR
else if (input1 == "CLEAR")
{
hm.clear();
std::cout << "CLEARED" << std::endl;
}
else
{
main_inv = "INVALID";
}
}
void Commands::handle_debug_commands(const std::string &input1,
const std::string &input2,
const std::string &input3)
{
if (debug_commands)
{
if (input1 == "LOGIN" && input2 == "COUNT")
{
std::cout << hm.size() << std::endl;
}
else if (input1 == "BUCKET" && input2 == "COUNT")
{
std::cout << hm.bucketCount() << std::endl;
}
else if (input1 == "LOAD" && input2 == "FACTOR")
{
std::cout << hm.loadFactor() << std::endl;
}
else if (input1 == "MAX" && input2 == "BUCKET" && input3 == "SIZE")
{
std::cout << hm.maxBucketSize() << std::endl;
}
else
{
hdc_inv = "INVALID";
}
}
}
void Commands::parse_input(const std::string& input)
{
std::istringstream i(input);
i >> input1 >> input2 >> input3;
if (input1 == "" || input1 == "none")
{
input1 = "none";
}
else if (input2 == "" || input2 == "none")
{
input2 = "none";
}
else if (input3 == "" || input3 == "none")
{
input3 = "none";
}
handle_debug_commands(input1, input2, input3);
handle_debug(input1, input2, input3);
handle_main_commands(input1, input2, input3);
if (hd_inv == "INVALID" && main_inv == "INVALID" && !debug_commands)
{
std::cout << "INVALID" << std::endl;
}
if (hd_inv == "INVALID" && main_inv == "INVALID" && hdc_inv == "INVALID")
{
std::cout << "INVALID" << std::endl;
}
input1 = "none"; input2 = "none"; input3 = "none";
hd_inv = ""; main_inv = ""; hdc_inv = "";
}
| [
"[email protected]"
] | |
e5719c51a6fa6503be53901ec9294471a150a964 | 53161be3b8fbc7de07fdef2a72324f7be4501f57 | /GroupChat.cpp | f24e4fa11f414bf06e20e3d8c8d04e02ab408886 | [] | no_license | plato-cambrian/Cambrian-src | 3689560871395df151d7667db178921b8190f32b | faa7bd0fa54664be752795742921a9ed645a7417 | refs/heads/master | 2021-01-09T06:51:27.851054 | 2014-10-14T19:40:45 | 2014-10-14T19:40:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,553 | cpp | ///////////////////////////////////////////////////////////////////////////////////////////////////
// GroupChat.cpp
//
// File containing the events and tasks related to group chat.
//
// Since group chat involves a lot of classes and has many lines of code, the modivation for having this file is to keep IEvent.cpp and SocketTasks.cpp for simple events and tasks.
//
#ifndef PRECOMPILEDHEADERS_H
#include "PreCompiledHeaders.h"
#endif
#include "GroupChat.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
CEventGroupMemberJoin::CEventGroupMemberJoin(const TIMESTAMP * ptsEventID) : IEvent(ptsEventID)
{
m_pMember = NULL;
m_pContactInvitedBy = NULL;
}
CEventGroupMemberJoin::CEventGroupMemberJoin(TContact * pMember) : IEvent(NULL)
{
Assert(pMember->EGetRuntimeClass() == RTI(TContact));
m_pMember = pMember;
m_pContactInvitedBy = NULL;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
#define d_chAttribute_strMemberJID 'm'
// CEventGroupMemberJoin::IEvent::XmlSerializeCoreE()
EXml
CEventGroupMemberJoin::XmlSerializeCoreE(IOUT CBinXcpStanza * pbinXmlAttributes) const
{
pbinXmlAttributes->BinAppendXmlAttributeOfContactIdentifier(d_chAttribute_strMemberJID, m_pMember);
return eXml_zAttributesOnly;
}
// CEventGroupMemberJoin::IEvent::XmlUnserializeCore()
void
CEventGroupMemberJoin::XmlUnserializeCore(const CXmlNode * pXmlNodeElement)
{
_XmlUnserializeAttributeOfContactIdentifier(d_chAttribute_strMemberJID, OUT &m_pMember, pXmlNodeElement);
}
// CEventGroupMemberJoin::IEvent::ChatLogUpdateTextBlock()
void
CEventGroupMemberJoin::ChatLogUpdateTextBlock(INOUT OCursor * poCursorTextBlock) CONST_MAY_CREATE_CACHE
{
_BinHtmlInitWithTime(OUT &g_strScratchBufferStatusBar);
if (m_pMember != NULL)
g_strScratchBufferStatusBar.BinAppendText_VE("invited <b>$s</b> to join the group", m_pMember->TreeItem_PszGetNameDisplay());
poCursorTextBlock->InsertHtmlBin(g_strScratchBufferStatusBar, c_brushSilver);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// IMPLEMENTATION NOTES
// At the moment the Contact Identifier is the JID, however in the future it may be a hash of the contact's public key.
//
// PERFORMANCE NOTES
// Considering a single contact may have multiple identifier, such as having multiple JIDs, it will be wise in the future to use a hash table to cache the identifiers.
TContact *
TAccountXmpp::Contact_PFindByIdentifierOrCreate_YZ(const CXmlNode * pXmlNodeEvent, CHS chAttributeName, INOUT CBinXcpStanza * pbinXcpApiExtraRequest) CONST_MCC
{
PSZUC pszContactIdentifier = pXmlNodeEvent->PszuFindAttributeValue(chAttributeName);
if (pszContactIdentifier != NULL)
{
Assert(pszContactIdentifier[0] != '\0');
TContact * pContact = Contact_PFindByJID(pszContactIdentifier, eFindContact_zDefault);
if (pContact != NULL)
return pContact;
MessageLog_AppendTextFormatSev(eSeverityErrorWarning, "Unable to find contact identifier '$s' from XML node: ^N\n", pszContactIdentifier, pXmlNodeEvent);
if (!m_strJID.FCompareStringsJIDs(pszContactIdentifier))
{
// Create a new contact
if (pbinXcpApiExtraRequest != NULL)
{
}
return TreeItemAccount_PContactAllocateNewToNavigationTree_NZ(IN pszContactIdentifier);
}
}
return NULL;
}
// Append to the blob an XML attribute representing the Contact Identifier.
// This method is used to serialize a pointer to a contact when saving to vault of event.
//
// IMPLEMENTATION NOTES
// At the moment the Contact Identifier is the JID, however in the future it may be a hash of the contact's public key.
//
// SEE ALSO: Contact_PFindByIdentifierOrCreate_YZ(), CBin ^i
void
CBin::BinAppendXmlAttributeOfContactIdentifier(CHS chAttributeName, const TContact * pContact)
{
if (pContact != NULL)
{
Assert(pContact->EGetRuntimeClass() == RTI(TContact));
BinAppendXmlAttributeCStr(chAttributeName, pContact->m_strJidBare);
}
}
TContact *
TAccountXmpp::Contact_PFindByIdentifierGroupSender_YZ(const CXmlNode * pXmlNodeEvent) CONST_MCC
{
return Contact_PFindByIdentifierOrCreate_YZ(pXmlNodeEvent, d_chXCPa_pContactGroupSender, NULL);
}
void
IEvent::_XmlUnserializeAttributeOfContactIdentifier(CHS chAttributeName, OUT TContact ** ppContact, const CXmlNode * pXmlNodeElement) const
{
Assert(ppContact != NULL);
Assert(pXmlNodeElement != NULL);
Assert(m_pVaultParent_NZ != NULL);
Assert(m_pVaultParent_NZ->m_pParent->m_pAccount->EGetRuntimeClass() == RTI(TAccountXmpp));
*ppContact = m_pVaultParent_NZ->m_pParent->m_pAccount->Contact_PFindByIdentifierOrCreate_YZ(pXmlNodeElement, chAttributeName, NULL);
}
void
CBinXcpStanza::BinXmlAppendAttributeOfContactIdentifierOfGroupSenderForEvent(const IEvent * pEvent)
{
AssertValidEvent(pEvent);
Endorse(m_pContact == NULL); // Saving to disk
/*
TContact * pContact = pEvent->m_pContactGroupSender_YZ;
if (pContact != NULL && pContact != m_pContact)
{
Assert(pContact->EGetRuntimeClass() == RTI(TContact));
pContact->BinAppendXmlAttributeOfContactIdentifier(INOUT this, d_chXCPa_pContactGroupSender);
}
*/
if (pEvent->m_pContactGroupSender_YZ != m_pContact)
{
Endorse(pEvent->m_pContactGroupSender_YZ == NULL); // The event was sent, or was received on a 1-to-1 conversation. If this pointer is NULL, then the method BinAppendXmlAttributeOfContactIdentifier() will ignore it
BinAppendXmlAttributeOfContactIdentifier(d_chXCPa_pContactGroupSender, pEvent->m_pContactGroupSender_YZ);
}
}
| [
"[email protected]"
] | |
dd544dc215854196ee03cc3ea2ab15165157934c | 07ee3b13866d994e8ce8b2cbf2b3578dc72e30b6 | /100 Programs/17. Leap year or not.cpp | 08c2f69f97213309f822cb56c0268e0d6803ac01 | [] | no_license | anshul567/Programs | 34fe809918f29ba9408e8bf547bfce2066791a18 | bdf621b260f4cbd99a661d981d23325e084f2816 | refs/heads/master | 2023-01-23T11:03:29.268404 | 2020-11-22T18:29:17 | 2020-11-22T18:29:17 | 250,313,640 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 202 | cpp | #include<iostream>
using namespace std;
main()
{
int y;
cout<<"Enter year\n";
cin>>y;
if(y%400==0 || (y%4==0 && y%100!=0))
cout<<"it's a leap year\n";
else
cout<<"Not a leap year";
}
| [
"[email protected]"
] | |
60836a06980d761a375575c436ba8287d58a75ea | 3ea829b5ad3cf1cc9e6eb9b208532cf57b7ba90f | /libvpvl2/include/vpvl2/extensions/sfml/ApplicationContext.h | 3a8960de8ddc861840b9b39413c187521d7bffd7 | [] | no_license | hkrn/MMDAI | 2ae70c9be7301e496e9113477d4a5ebdc5dc0a29 | 9ca74bf9f6f979f510f5355d80805f935cc7e610 | refs/heads/master | 2021-01-18T21:30:22.057260 | 2016-05-10T16:30:41 | 2016-05-10T16:30:41 | 1,257,502 | 74 | 22 | null | 2013-07-13T21:28:16 | 2011-01-15T12:05:26 | C++ | UTF-8 | C++ | false | false | 11,952 | h | /**
Copyright (c) 2010-2014 hkrn
All rights reserved.
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.
- Neither the name of the MMDAI project team nor the names of
its contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.
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 OWNER 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.
*/
#pragma once
#ifndef VPVL2_EXTENSIONS_SFML_APPLICATIONCONTEXT_H_
#define VPVL2_EXTENSIONS_SFML_APPLICATIONCONTEXT_H_
/* libvpvl2 */
#include <vpvl2/extensions/BaseApplicationContext.h>
#include <vpvl2/extensions/icu4c/String.h>
#include <unicode/regex.h>
/* SFML */
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#if !defined(VPVL2_OS_WINDOWS)
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#ifdef VPVL2_HAS_OPENGL_GLX
#include <GL/glx.h>
#endif
#endif
#ifdef VPVL2_OS_OSX
#include <dlfcn.h>
#endif
namespace vpvl2
{
namespace VPVL2_VERSION_NS
{
namespace extensions
{
using namespace icu4c;
namespace sfml
{
class ApplicationContext : public BaseApplicationContext {
public:
static bool mapFileDescriptor(const std::string &path, uint8 *&address, vsize &size, intptr_t &fd) {
#ifdef VPVL2_OS_WINDOWS
FILE *fp = 0;
errno_t err = ::fopen_s(&fp, path.c_str(), "rb");
if (err != 0) {
return false;
}
fd = reinterpret_cast<intptr_t>(fp);
err = ::fseek(fp, 0, SEEK_END);
if (err != 0) {
return false;
}
size = ::ftell(fp);
err = ::fseek(fp, 0, SEEK_SET);
if (err != 0) {
return false;
}
address = new uint8_t[size];
vsize readSize = ::fread_s(address, size, sizeof(uint8_t), size, fp);
if (readSize != size) {
delete[] address;
address = 0;
return false;
}
#else
fd = ::open(path.c_str(), O_RDONLY);
if (fd == -1) {
return false;
}
struct stat sb;
if (::fstat(fd, &sb) == -1) {
return false;
}
size = sb.st_size;
address = static_cast<uint8 *>(::mmap(0, size, PROT_READ, MAP_PRIVATE, fd, 0));
if (address == reinterpret_cast<uint8 *>(-1)) {
return false;
}
#endif
return true;
}
static bool unmapFileDescriptor(uint8 *address, vsize size, intptr_t fd) {
#ifdef VPVL2_OS_WINDOWS
if (address && size > 0) {
delete[] address;
}
if (FILE *fp = reinterpret_cast<FILE *>(fd)) {
fclose(fp);
}
#else
if (address && size > 0) {
::munmap(address, size);
}
if (fd >= 0) {
::close(fd);
}
#endif
return true;
}
ApplicationContext(Scene *sceneRef, IEncoding *encodingRef, StringMap *configRef)
: BaseApplicationContext(sceneRef, encodingRef, configRef)
{
}
~ApplicationContext() {
}
bool mapFile(const std::string &path, MapBuffer *buffer) const {
return mapFileDescriptor(path, buffer->address, buffer->size, buffer->opaque);
}
bool unmapFile(MapBuffer *buffer) const {
return unmapFileDescriptor(buffer->address, buffer->size, buffer->opaque);
}
bool existsFile(const std::string &path) const {
#ifdef VPVL2_OS_WINDOWS
FILE *fp = 0;
bool exists = ::fopen_s(&fp, path.c_str(), "r") == 0;
fclose(fp);
return exists;
#else
return ::access(path.c_str(), R_OK) == 0;
#endif
}
bool extractFilePath(const std::string &path, std::string &filename, std::string &basename) const {
UErrorCode status = U_ZERO_ERROR;
RegexMatcher filenameMatcher(".+/((.+)\\.\\w+)$", 0, status);
filenameMatcher.reset(UnicodeString::fromUTF8(path));
if (filenameMatcher.find()) {
basename = String::toStdString(filenameMatcher.group(1, status));
filename = String::toStdString(filenameMatcher.group(2, status));
return true;
}
return false;
}
bool extractModelNameFromFileName(const std::string &path, std::string &modelName) const {
UErrorCode status = U_ZERO_ERROR;
RegexMatcher extractMatcher("^.+\\[(.+)(?:\\.(?:cg)?fx)?\\]$", 0, status);
extractMatcher.reset(UnicodeString::fromUTF8(path));
if (extractMatcher.find()) {
status = U_ZERO_ERROR;
modelName = String::toStdString(extractMatcher.group(1, status));
return true;
}
return false;
}
bool uploadTextureOpaque(const uint8 *data, vsize size, const std::string &key, int flags, ModelContext *context, ITexture *&texturePtr) {
sf::Image image;
if (image.loadFromMemory(data, size)) {
return uploadTextureSFML(image, key, flags, context, texturePtr);
}
return context->uploadModelTexture(data, size, key, flags, texturePtr);
}
bool uploadTextureOpaque(const std::string &path, int flags, ModelContext *context, ITexture *&texturePtr) {
sf::Image image;
if (image.loadFromFile(path)) {
return uploadTextureSFML(image, path, flags, context, texturePtr);
}
return context->uploadModelTexture(path, flags, texturePtr);
}
bool uploadTextureSFML(const sf::Image &image, const std::string &key, int flags, ModelContext *context, ITexture *&texturePtr) {
const Vector3 size(image.getSize().x, image.getSize().y, 1);
texturePtr = context->createTexture(image.getPixelsPtr(), defaultTextureFormat(), size, (flags & IApplicationContext::kGenerateTextureMipmap) != 0);
return context->storeTexture(key, flags, texturePtr);
}
struct Resolver : FunctionResolver {
Resolver()
: getStringi(0),
imageHandle(0),
coreProfile(false)
{
#ifdef VPVL2_OS_OSX
imageHandle = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
VPVL2_CHECK(imageHandle);
#endif
GLint flags;
glGetIntegerv(gl::kGL_CONTEXT_FLAGS, &flags);
coreProfile = (flags & gl::kGL_CONTEXT_CORE_PROFILE_BIT) != 0;
getStringi = reinterpret_cast<PFNGLGETSTRINGIPROC>(resolveSymbol("glGetStringi"));
}
~Resolver() {
#ifdef VPVL2_OS_OSX
dlclose(imageHandle);
#endif
}
bool hasExtension(const char *name) const {
if (const bool *ptr = supportedTable.find(name)) {
return *ptr;
}
else if (coreProfile) {
GLint nextensions;
glGetIntegerv(kGL_NUM_EXTENSIONS, &nextensions);
const std::string &needle = std::string("GL_") + name;
for (int i = 0; i < nextensions; i++) {
if (needle == reinterpret_cast<const char *>(getStringi(GL_EXTENSIONS, i))) {
supportedTable.insert(name, true);
return true;
}
}
supportedTable.insert(name, false);
return false;
}
else if (const char *extensions = reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS))) {
bool found = strstr(extensions, name) != NULL;
supportedTable.insert(name, found);
return found;
}
else {
supportedTable.insert(name, false);
return false;
}
}
void *resolveSymbol(const char *name) const {
if (void *const *ptr = addressTable.find(name)) {
return *ptr;
}
else {
void *address = 0;
#if defined(VPVL2_OS_WINDOWS)
address = wglGetProcAddress(name);
#elif defined(VPVL2_OS_OSX)
address = dlsym(imageHandle, name);
#elif defined(VPVL2_HAS_OPENGL_GLX)
address = glXGetProcAddress(name);
#endif
addressTable.insert(name, address);
return address;
}
}
int query(QueryType type) const {
switch (type) {
case kQueryVersion: {
return gl::makeVersion(reinterpret_cast<const char *>(glGetString(GL_VERSION)));
}
case kQueryShaderVersion: {
return gl::makeVersion(reinterpret_cast<const char *>(glGetString(GL_SHADING_LANGUAGE_VERSION)));
}
case kQueryCoreProfile: {
return coreProfile;
}
default:
return 0;
}
}
static const GLenum kGL_NUM_EXTENSIONS = 0x821D;
typedef const GLubyte * (GLAPIENTRY * PFNGLGETSTRINGIPROC) (gl::GLenum pname, gl::GLuint index);
PFNGLGETSTRINGIPROC getStringi;
mutable Hash<HashString, bool> supportedTable;
mutable Hash<HashString, void *> addressTable;
void *imageHandle;
bool coreProfile;
};
static inline FunctionResolver *staticSharedFunctionResolverInstance() {
static Resolver resolver;
return &resolver;
}
FunctionResolver *sharedFunctionResolverInstance() const {
return staticSharedFunctionResolverInstance();
}
#if defined(VPVL2_ENABLE_NVIDIA_CG) || defined(VPVL2_LINK_NVFX)
void getToonColor(const IString *name, Color &value, void *userData) {
ModelContext *modelContext = static_cast<ModelContext *>(userData);
const std::string &path = static_cast<const String *>(modelContext->directoryRef())->toStdString()
+ "/" + static_cast<const String *>(name)->toStdString();
/* TODO: implement this */
(void) path;
value.setValue(1, 1, 1, 1);
}
void getTime(float32 &value, bool sync) const {
value = sync ? 0 : (m_elapsedTicks.getElapsedTime() - m_baseTicks).asMilliseconds() / 1000.0f;
}
void getElapsed(float32 &value, bool sync) const {
sf::Time currentTicks = m_elapsedTicks.getElapsedTime();
value = sync ? 0 : ((m_lastTicks > sf::seconds(0) ? currentTicks - m_lastTicks : sf::seconds(0)).asMilliseconds() / 1000.0f);
m_lastTicks = currentTicks;
}
void uploadAnimatedTexture(float /* offset */, float /* speed */, float /* seek */, void * /* texture */) {
/* FIXME: implement this */
}
#endif
private:
mutable sf::Time m_lastTicks;
sf::Clock m_elapsedTicks;
sf::Time m_baseTicks;
VPVL2_DISABLE_COPY_AND_ASSIGN(ApplicationContext)
};
} /* namespace sfml */
} /* namespace extensions */
} /* namespace VPVL2_VERSION_NS */
using namespace VPVL2_VERSION_NS;
} /* namespace vpvl2 */
#endif /* VPVL2_EXTENSIONS_SFML_APPLICATIONCONTEXT_H_ */
| [
"[email protected]"
] | |
4f06190ac70a16c0eafbad0efef2115a41ac3601 | b7f3edb5b7c62174bed808079c3b21fb9ea51d52 | /components/performance_manager/public/execution_context/execution_context_token.h | fbddcba256287a28d2ab3c633401c5d4c9cc2110 | [
"BSD-3-Clause"
] | permissive | otcshare/chromium-src | 26a7372773b53b236784c51677c566dc0ad839e4 | 64bee65c921db7e78e25d08f1e98da2668b57be5 | refs/heads/webml | 2023-03-21T03:20:15.377034 | 2020-11-16T01:40:14 | 2020-11-16T01:40:14 | 209,262,645 | 18 | 21 | BSD-3-Clause | 2023-03-23T06:20:07 | 2019-09-18T08:52:07 | null | UTF-8 | C++ | false | false | 1,162 | h | // Copyright 2020 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 COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_EXECUTION_CONTEXT_EXECUTION_CONTEXT_TOKEN_H_
#define COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_EXECUTION_CONTEXT_EXECUTION_CONTEXT_TOKEN_H_
#include "base/unguessable_token.h"
#include "base/util/type_safety/strong_alias.h"
namespace performance_manager {
namespace execution_context {
using ExecutionContextToken =
util::StrongAlias<class ExecutionContextTokenTag, base::UnguessableToken>;
// These objects should have the identical size and layout; the StrongAlias
// wrapper is simply there to provide type safety. This allows us to
// safely reinterpret_cast behind the scenes, so we can continue to return
// references and pointers.
static_assert(sizeof(ExecutionContextToken) == sizeof(base::UnguessableToken),
"StrongAlias should not change object layout");
} // namespace execution_context
} // namespace performance_manager
#endif // COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_EXECUTION_CONTEXT_EXECUTION_CONTEXT_TOKEN_H_
| [
"[email protected]"
] | |
3b7d8530104829aa0568b5da98ce34718e2443f5 | 9fc7814b167acb792cf36bc00c0b2df7ba167dbd | /Export/windows/cpp/obj/include/UFO.h | c12a61dee1969215e83015675a9595c9a4eabffc | [] | no_license | Flubman/ReimuBros | c4175f4466efa67ee53555c90f5a561e8ad8a96e | 20dfcc96e462faa17399366b455e2d0f872b81d9 | refs/heads/master | 2020-04-01T23:27:58.747900 | 2015-07-24T03:45:17 | 2015-07-24T03:45:17 | 39,650,645 | 1 | 0 | null | 2015-07-24T18:36:52 | 2015-07-24T18:36:51 | null | UTF-8 | C++ | false | false | 1,468 | h | #ifndef INCLUDED_UFO
#define INCLUDED_UFO
#ifndef HXCPP_H
#include <hxcpp.h>
#endif
#include <Enemy.h>
HX_DECLARE_CLASS0(Animation)
HX_DECLARE_CLASS0(Enemy)
HX_DECLARE_CLASS0(Entity)
HX_DECLARE_CLASS0(MersenneTwister)
HX_DECLARE_CLASS0(UFO)
HX_DECLARE_CLASS3(openfl,_v2,display,Bitmap)
HX_DECLARE_CLASS3(openfl,_v2,display,DisplayObject)
HX_DECLARE_CLASS3(openfl,_v2,display,IBitmapDrawable)
HX_DECLARE_CLASS3(openfl,_v2,events,EventDispatcher)
HX_DECLARE_CLASS3(openfl,_v2,events,IEventDispatcher)
HX_DECLARE_CLASS3(openfl,_v2,geom,Rectangle)
class HXCPP_CLASS_ATTRIBUTES UFO_obj : public ::Enemy_obj{
public:
typedef ::Enemy_obj super;
typedef UFO_obj OBJ_;
UFO_obj();
Void __construct();
public:
inline void *operator new( size_t inSize, bool inContainer=true)
{ return hx::Object::operator new(inSize,inContainer); }
static hx::ObjectPtr< UFO_obj > __new();
static Dynamic __CreateEmpty();
static Dynamic __Create(hx::DynamicArray inArgs);
//~UFO_obj();
HX_DO_RTTI;
static void __boot();
static void __register();
void __Mark(HX_MARK_PARAMS);
void __Visit(HX_VISIT_PARAMS);
::String __ToString() const { return HX_CSTRING("UFO"); }
bool ascend;
int iter;
::MersenneTwister rng;
Float rot;
::String rename;
::String ufotype;
int fuel;
int reducetime;
virtual Void enrage( );
virtual Void update( );
virtual Void bump( );
static ::openfl::_v2::geom::Rectangle HB;
};
#endif /* INCLUDED_UFO */
| [
"[email protected]"
] | |
db4957c3a45f2ccee2b4f9f84c0f1fe5061a575e | 28b50e4aaa477609cadbd6db6fa030beb3917381 | /PrisonEscapeGame/PrisonEscapeGame/Guard.cpp | a1290f2cfbffe52c27ce55ee395f5da5f4c0a3dd | [] | no_license | NathanAlanBeeby/Final-Year-Project | ad8132f0b166489120b42a5eebf5b287d68717a1 | 3413ad3a982b39cf69969d355b7742c15c3335e1 | refs/heads/master | 2021-05-12T04:41:21.162656 | 2018-02-05T22:26:18 | 2018-02-05T22:26:18 | 117,168,720 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,342 | cpp | #include "Guard.h"
#include <iostream>
Guard::Guard(sf::Vector2f size, sf::Vector2f position)
{
if (!guardTexture.loadFromFile("../assets/image_assets/characters/guard_images.png")) {
std::cout << "Error could not load guard texture" << std::endl;
system("pause");
}
guardSprite.setSize(size);
guardSprite.setOrigin(size / 2.0f);
guardSprite.setTexture(&guardTexture);
guardSprite.setPosition(position);
}
Guard::~Guard()
{
}
enum GuardDir { Down, Right, Up, Left, Idle };
GuardDir lastGuardPosition = Down;
sf::Vector2i GuardAnim(1, Down);
void Guard::drawGuard(sf::RenderWindow &window) {
guardState::guardIDLE; // setting the player defaultly to IDLE
vel.x = 0;
vel.y = 0;
std::string SecondsString = std::to_string(guardTime);
sf::Time TimeElapsed = GuardClock.getElapsedTime(); // setting the time to the hud clock, so it can count seconds
sf::Time seconds = sf::seconds(1); // this is to compare to the time elapsed to get 1 second
if (TimeElapsed >= seconds) { // if the time elapsed is a second, increment the HUDTime and restart the HUDClock
guardTime++;
GuardClock.restart();
//std::cout << "Minutes: " << HUDTimeMinute << ", Seconds: " << HUDTime << std::endl;
std::cout << guardTime << std::endl;
}
if (guardState::guardIDLE) {
if (guardTime >= 2) {
guardMove = rand() % 6; // a random number generator between 1 and 8
guardTime = 0;
}
if (guardMove == 1) {
if (guardSprite.getPosition().y < 4352) {
vel.y -= moveSpeed;
GuardAnim.y = Up;
lastGuardPosition = Up;
}
}
else if (guardMove == 2) {
if (guardSprite.getPosition().x > 64) {
vel.x -= moveSpeed;
GuardAnim.y = Left;
lastGuardPosition = Left;
}
}
else if (guardMove == 3) {
if (guardSprite.getPosition().y > 64) {
vel.y += moveSpeed;
GuardAnim.y = Down;
lastGuardPosition = Down;
}
}
else if (guardMove == 4) { // Right Facing Prisoner
if (guardSprite.getPosition().x < 2752) {
vel.x += moveSpeed;
GuardAnim.y = Right;
lastGuardPosition = Right;
}
}
else {
GuardAnim.y = Idle;
lastGuardPosition = Idle;
}
}
guardSprite.move(vel.x, vel.y);
GuardAnim.x++;
if (GuardAnim.x * 32 >= guardTexture.getSize().x) { // once the sprite reaches the end of the sprite sheet, reset to 0 again
GuardAnim.x = 0;
}
guardSprite.setTextureRect(sf::IntRect(GuardAnim.x * 32, GuardAnim.y * 32, 32, 32)); // cropping the image with the position and size of the image
if(guardHealth > 0){
window.draw(guardSprite);
}
//sf::Vector2f guardSize(64, 64);
//Collision(guardPosition, guardSize);
}
//void Guard::Collision(sf::Vector2f guardPosition, sf::Vector2f Size) {
// //std::cout << "Guard Position - X: " << guardPosition.x << ", Y:" << guardPosition.y << std::endl; //getting the guards position for collision
// //std::cout << "Guard Size - X: " << Size.x << ", Y:" << Size.y << std::endl;
//}
void Guard::guardState() {
}
void Guard::onCollision(sf::Vector2f direction)
{
if (direction.x < 0.0f) {
//colliding on the left side so set velocity to 0 to stop movement
vel.x = 0.0f;
}
else if (direction.x > 0.0f) {
//colliding on the right
vel.x = 0.0f;
}
if (direction.y < 0.0f) {
//colliding on the bottom
vel.y = 0.0f;
}
else if (direction.y > 0.0f) {
//colliding on top
vel.y = 0.0f;
}
} | [
"[email protected]"
] | |
604e26e41ff5f30b24f5f071fd387b0c25e4708a | be6494ca016157a7051856f678a4a2749821f716 | /sources/inc/module/modules/LooterModule.hpp | 25d8ab18dc7cca07630340a52081a501b3a41325 | [] | no_license | stryku/amb | 9ffd00d57694e44b814631b48d32b9e64968f105 | f2738e58d104e8dcb87e91c8fdf0bbaf1ac445aa | refs/heads/master | 2021-01-20T06:31:09.805810 | 2017-03-22T22:21:18 | 2017-03-22T22:21:18 | 82,597,607 | 1 | 0 | null | 2017-03-22T22:21:19 | 2017-02-20T20:05:19 | C++ | UTF-8 | C++ | false | false | 4,341 | hpp | #pragma once
#include "ui/modules/healer/HealRule.hpp"
#include "module/ModuleCore.hpp"
#include "Simulator.hpp"
#include "tibiareader.hpp"
#include "db/Items.hpp"
#include "db/Containers.hpp"
#include "client/window/finder/TibiaWindowsFinder.hpp"
#include "client/window/finder/DeadCreatureWindowFinderFactory.hpp"
#include "client/window/finder/DeadCreatureWindowFinder.hpp"
#include "capture/ItemsWindowReader.hpp"
#include "log/ImageConditionalLogger.hpp"
#include "log/condition/ImageLogUniqueCondition.hpp"
#include "ui/modules/looter/LootItem.hpp"
#include <chrono>
namespace Amb
{
namespace Ui
{
namespace Module
{
namespace Looter
{
struct Category;
}
}
}
namespace Config
{
namespace Module
{
struct AdvancedSettingsConfig;
struct LooterConfig;
}
}
namespace Module
{
namespace Looter
{
class LooterModule final : public ModuleCore
{
public:
LooterModule(const Config::Module::LooterConfig &config,
const Config::Module::AdvancedSettingsConfig &advancedSettings,
Simulate::Simulator &simulator,
const Client::TibiaClientWindowInfo &tibiaClientWindowInfo,
Client::Window::Finder::DeadCreatureWindowFinderFactory&& factory,
std::unique_ptr<Client::Reader::TibiaClientReader> tibiaClientReader = nullptr);
void attachToNewProcess(DWORD pid) override;
void setEnableDebugLogs(bool enabled) override;
private:
using UniqueImageLogger = Log::ImageConditionalLogger<Log::Condition::ImageLogUniqueCondition>;
Db::Items items;
Db::Containers containersDb;
Client::Window::Finder::TibiaWindowsFinder windowsFinder;
boost::optional<Client::Window::Finder::DeadCreatureWindowFinder> deadCreatureWindowFinder;
const Client::Window::Finder::DeadCreatureWindowFinderFactory deadCreatureWindowFinderFactory;
UniqueImageLogger unknowWindowsLogger;
const Config::Module::LooterConfig &config;
const Config::Module::AdvancedSettingsConfig &advancedSettings;
Capture::ItemsWindowReader itemsWindowReader;
void runDetails() override;
void applyConfigs() override;
void lootItemsFromWindow(const std::vector<size_t> &itemsPositions,
const Client::Window::TibiaItemsWindow &windowToLootFrom,
const std::vector<Client::Window::TibiaItemsWindow> &playerContainers,
const RelativeRect &capturedRect);
bool lootableItem(const Db::ItemId &id) const;
bool haveEnoughCap(const Amb::Ui::Module::Looter::LootItem &item) const;
bool haveEnoughCap(const Db::ItemId& id) const;
boost::optional<Ui::Module::Looter::LootItem> findLootItemById(const Db::ItemId &id) const;
std::string findLootableItemDestination(const Db::ItemId &id) const;
const Amb::Ui::Module::Looter::Category findLootableItemCategory(const Db::ItemId &id) const;
boost::optional<Pos> findCategoryDestinationPosition(const Amb::Ui::Module::Looter::Category &category,
const std::vector<Client::Window::TibiaItemsWindow> &playerContainers) const;
Pos findPosToMoveLootItem(const Db::ItemId &id, const std::vector<Client::Window::TibiaItemsWindow> &to) const;
const Amb::Ui::Module::Looter::LootItem& findLootableItem(const Db::ItemId &id) const;
std::vector<size_t> findLootableItemsPositions(const std::vector<Db::ItemId> &items) const;
boost::optional<Pos> findDestinationPosition(const std::string &categoryName,
const std::vector<Client::Window::TibiaItemsWindow> &playerContainers) const;
};
}
}
}
| [
"[email protected]"
] | |
bfc8e3fb8bbdec88aa956663a362fc178f551b70 | 7af56561975a5a88eb5a761f01a2f3cfeb175dcd | /Sensor-Actuator Code/isr.ino | 4a00db1f364ca373c4bdb12242fe1e32322ac0ba | [] | no_license | irachitrastogi/Smart-Wearable-to-predict-ASD-meltdowns | ef130beb532f9622911f48ff2e7b06af13f079ee | 4cb3e389f1314cc1d1a8f6a6df61400a0b7c8c8e | refs/heads/master | 2022-11-18T03:49:31.506694 | 2020-07-02T11:18:45 | 2020-07-02T11:18:45 | 260,166,917 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,584 | ino |
volatile int rate[10]; // array to hold last ten IBI values
volatile unsigned long sampleCounter = 0; // used to determine pulse timing
volatile unsigned long lastBeatTime = 0; // used to find IBI
volatile int P = 512; // used to find peak in pulse wave, seeded
volatile int T = 512; // used to find trough in pulse wave, seeded
volatile int thresh = 530; // used to find instant moment of heart beat, seeded
volatile int amp = 0; // used to hold amplitude of pulse waveform, seeded
volatile boolean firstBeat = true; // used to seed rate array so we startup with reasonable BPM
volatile boolean secondBeat = false; // used to seed rate array so we startup with reasonable BPM
hw_timer_t * timer = NULL;
volatile SemaphoreHandle_t timerSemaphore;
portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED;
#define ESP32 // timer interrupt code for ESP32 added by coniferconifer
// see https://github.com/espressif/arduino-esp32/blob/master/libraries/ESP32/examples/Timer/RepeatTimer/RepeatTimer.ino
//
void IRAM_ATTR onTimer() {
portENTER_CRITICAL_ISR(&timerMux); // cli();
// triggered when Timer2 counts to 124
Signal = analogRead(pulsePin); // read the Pulse Sensor
sampleCounter += 2; // keep track of the time in mS with this variable
int N = sampleCounter - lastBeatTime; // monitor the time since the last beat to avoid noise
// find the peak and trough of the pulse wave
if (Signal < thresh && N > (IBI / 5) * 3) { // avoid dichrotic noise by waiting 3/5 of last IBI
if (Signal < T) { // T is the trough
T = Signal; // keep track of lowest point in pulse wave
}
}
if (Signal > thresh && Signal > P) { // thresh condition helps avoid noise
P = Signal; // P is the peak
} // keep track of highest point in pulse wave
// NOW IT'S TIME TO LOOK FOR THE HEART BEAT
// signal surges up in value every time there is a pulse
if (N > 250) { // avoid high frequency noise
if ( (Signal > thresh) && (Pulse == false) && (N > (IBI / 5) * 3) ) {
Pulse = true; // set the Pulse flag when we think there is a pulse
IBI = sampleCounter - lastBeatTime; // measure time between beats in mS
lastBeatTime = sampleCounter; // keep track of time for next pulse
if (secondBeat) { // if this is the second beat, if secondBeat == TRUE
secondBeat = false; // clear secondBeat flag
for (int i = 0; i <= 9; i++) { // seed the running total to get a realisitic BPM at startup
rate[i] = IBI;
}
}
if (firstBeat) { // if it's the first time we found a beat, if firstBeat == TRUE
firstBeat = false; // clear firstBeat flag
secondBeat = true; // set the second beat flag
sei(); // enable interrupts again
return; // IBI value is unreliable so discard it
}
// keep a running total of the last 10 IBI values
word runningTotal = 0; // clear the runningTotal variable
for (int i = 0; i <= 8; i++) { // shift data in the rate array
rate[i] = rate[i + 1]; // and drop the oldest IBI value
runningTotal += rate[i]; // add up the 9 oldest IBI values
}
rate[9] = IBI; // add the latest IBI to the rate array
runningTotal += rate[9]; // add the latest IBI to runningTotal
runningTotal /= 10; // average the last 10 IBI values
BPM = 60000 / runningTotal; // how many beats can fit into a minute? that's BPM!
QS = true; // set Quantified Self flag
// QS FLAG IS NOT CLEARED INSIDE THIS ISR
}
}
if (Signal < thresh && Pulse == true) { // when the values are going down, the beat is over
Pulse = false; // reset the Pulse flag so we can do it again
amp = P - T; // get amplitude of the pulse wave
thresh = amp / 2 + T; // set thresh at 50% of the amplitude
P = thresh; // reset these for next time
T = thresh;
}
if (N > 2500) { // if 2.5 seconds go by without a beat
thresh = 530; // set thresh default
P = 512; // set P default
T = 512; // set T default
lastBeatTime = sampleCounter; // bring the lastBeatTime up to date
firstBeat = true; // set these to avoid noise
secondBeat = false; // when we get the heartbeat back
}
#ifndef ESP32
sei(); // enable interrupts when youre done!
#else
portEXIT_CRITICAL_ISR(&timerMux);
// Give a semaphore that we can check in the loop
xSemaphoreGiveFromISR(timerSemaphore, NULL);
// It is safe to use digitalRead/Write here if you want to toggle an output
#endif
}// end isr
void interruptSetup() { // CHECK OUT THE Timer_Interrupt_Notes TAB FOR MORE ON INTERRUPTS
#ifndef ESP32
// Initializes Timer2 to throw an interrupt every 2mS.
TCCR2A = 0x02; // DISABLE PWM ON DIGITAL PINS 3 AND 11, AND GO INTO CTC MODE
TCCR2B = 0x06; // DON'T FORCE COMPARE, 256 PRESCALER
OCR2A = 0X7C; // SET THE TOP OF THE COUNT TO 124 FOR 500Hz SAMPLE RATE
TIMSK2 = 0x02; // ENABLE INTERRUPT ON MATCH BETWEEN TIMER2 AND OCR2A
sei(); // MAKE SURE GLOBAL INTERRUPTS ARE ENABLED
// Create semaphore to inform us when the timer has fired
#else
timerSemaphore = xSemaphoreCreateBinary();
// Use 1st timer of 4 (counted from zero).
// Set 80 divider for prescaler (see ESP32 Technical Reference Manual for more
// info).
timer = timerBegin(0, 80, true);
// Attach onTimer function to our timer.
timerAttachInterrupt(timer, &onTimer, true);
// Set alarm to call onTimer function every second (value in microseconds).
// Repeat the alarm (third parameter)
timerAlarmWrite(timer, 2000, true);
// Start an alarm
timerAlarmEnable(timer);
#endif
}
| [
"[email protected]"
] | |
533aeac648fc95e853c2349ea1aebebbc5377499 | eec25615d25f92ccfcc74b5f64d6d62cc1f6c046 | /remind/mainwindow.h | 9e5ad2b3cda0e45e2226181088a0506162b082f9 | [] | no_license | Supersil/Chat | a0e729fa0fbadedbf21daccced4ab07c43f76ab8 | b58a46dc0f70e08462e74d0a5952a5db732acf37 | refs/heads/master | 2021-01-12T17:51:53.721781 | 2016-10-23T14:22:39 | 2016-10-23T14:22:39 | 71,654,141 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 472 | h | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTcpSocket>
#include <QHostAddress>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void on_sendBtn_clicked();
void on_loginBtn_clicked();
void incommingMsg();
private:
Ui::MainWindow *ui;
QString login;
QTcpSocket socket;
int curstate;
};
#endif // MAINWINDOW_H
| [
"[email protected]"
] | |
4ac697485826a3063fbf0cdf4f09ecddfad32172 | d1847c146110cbbb0b2a05a41a43eee1a18ffec3 | /Source/S05_TestingGrounds/NPC/PatrolRoute.h | 81c5afac651c5c9d03488ad1ecc3f518401587b7 | [] | no_license | pv62/05_TestingGrounds | 5e873ad856778d5615997f2231ad40dc5c98748a | 83a701b9b1452e40ee67a3c1c7e327d263ef1269 | refs/heads/master | 2020-04-23T16:43:30.943221 | 2019-05-29T21:26:11 | 2019-05-29T21:26:11 | 171,307,468 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 564 | h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "PatrolRoute.generated.h"
/**
* A "route card" to help AI choose their next waypoint
*/
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class S05_TESTINGGROUNDS_API UPatrolRoute : public UActorComponent
{
GENERATED_BODY()
public:
TArray<AActor*> GetPatrolPoints() const;
private:
UPROPERTY(EditInstanceOnly, Category = "Patrol Route")
TArray<AActor*> PatrolPoints;
};
| [
"[email protected]"
] | |
870e46a3b192ca9d372f99683a3aca5bdc3b431d | c51135a26347c93017e27899dca4381508a680ca | /src/crypter.cpp | 3147acccae31e417b497a1e3d09744c86d343284 | [
"MIT"
] | permissive | SHACoinProject/SHACoin | f9296d90cc716e1b3224783054e08116eeb746b7 | 1688f0bf030089b72e540f4ef4dee597199c486d | refs/heads/master | 2021-01-19T15:29:05.538961 | 2014-03-28T16:00:06 | 2014-03-28T16:00:06 | 17,799,026 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,893 | cpp | // Copyright (c) 2014 The SHACoin developer
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <openssl/aes.h>
#include <openssl/evp.h>
#include <vector>
#include <string>
#ifdef WIN32
#include <windows.h>
#endif
#include "crypter.h"
bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const std::vector<unsigned char>& chSalt, const unsigned int nRounds, const unsigned int nDerivationMethod)
{
if (nRounds < 1 || chSalt.size() != WALLET_CRYPTO_SALT_SIZE)
return false;
int i = 0;
if (nDerivationMethod == 0)
i = EVP_BytesToKey(EVP_aes_256_cbc(), EVP_sha512(), &chSalt[0],
(unsigned char *)&strKeyData[0], strKeyData.size(), nRounds, chKey, chIV);
if (i != (int)WALLET_CRYPTO_KEY_SIZE)
{
memset(&chKey, 0, sizeof chKey);
memset(&chIV, 0, sizeof chIV);
return false;
}
fKeySet = true;
return true;
}
bool CCrypter::SetKey(const CKeyingMaterial& chNewKey, const std::vector<unsigned char>& chNewIV)
{
if (chNewKey.size() != WALLET_CRYPTO_KEY_SIZE || chNewIV.size() != WALLET_CRYPTO_KEY_SIZE)
return false;
memcpy(&chKey[0], &chNewKey[0], sizeof chKey);
memcpy(&chIV[0], &chNewIV[0], sizeof chIV);
fKeySet = true;
return true;
}
bool CCrypter::Encrypt(const CKeyingMaterial& vchPlaintext, std::vector<unsigned char> &vchCiphertext)
{
if (!fKeySet)
return false;
// max ciphertext len for a n bytes of plaintext is
// n + AES_BLOCK_SIZE - 1 bytes
int nLen = vchPlaintext.size();
int nCLen = nLen + AES_BLOCK_SIZE, nFLen = 0;
vchCiphertext = std::vector<unsigned char> (nCLen);
EVP_CIPHER_CTX ctx;
bool fOk = true;
EVP_CIPHER_CTX_init(&ctx);
if (fOk) fOk = EVP_EncryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, chKey, chIV);
if (fOk) fOk = EVP_EncryptUpdate(&ctx, &vchCiphertext[0], &nCLen, &vchPlaintext[0], nLen);
if (fOk) fOk = EVP_EncryptFinal_ex(&ctx, (&vchCiphertext[0])+nCLen, &nFLen);
EVP_CIPHER_CTX_cleanup(&ctx);
if (!fOk) return false;
vchCiphertext.resize(nCLen + nFLen);
return true;
}
bool CCrypter::Decrypt(const std::vector<unsigned char>& vchCiphertext, CKeyingMaterial& vchPlaintext)
{
if (!fKeySet)
return false;
// plaintext will always be equal to or lesser than length of ciphertext
int nLen = vchCiphertext.size();
int nPLen = nLen, nFLen = 0;
vchPlaintext = CKeyingMaterial(nPLen);
EVP_CIPHER_CTX ctx;
bool fOk = true;
EVP_CIPHER_CTX_init(&ctx);
if (fOk) fOk = EVP_DecryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, chKey, chIV);
if (fOk) fOk = EVP_DecryptUpdate(&ctx, &vchPlaintext[0], &nPLen, &vchCiphertext[0], nLen);
if (fOk) fOk = EVP_DecryptFinal_ex(&ctx, (&vchPlaintext[0])+nPLen, &nFLen);
EVP_CIPHER_CTX_cleanup(&ctx);
if (!fOk) return false;
vchPlaintext.resize(nPLen + nFLen);
return true;
}
bool EncryptSecret(CKeyingMaterial& vMasterKey, const CSecret &vchPlaintext, const uint256& nIV, std::vector<unsigned char> &vchCiphertext)
{
CCrypter cKeyCrypter;
std::vector<unsigned char> chIV(WALLET_CRYPTO_KEY_SIZE);
memcpy(&chIV[0], &nIV, WALLET_CRYPTO_KEY_SIZE);
if(!cKeyCrypter.SetKey(vMasterKey, chIV))
return false;
return cKeyCrypter.Encrypt((CKeyingMaterial)vchPlaintext, vchCiphertext);
}
bool DecryptSecret(const CKeyingMaterial& vMasterKey, const std::vector<unsigned char>& vchCiphertext, const uint256& nIV, CSecret& vchPlaintext)
{
CCrypter cKeyCrypter;
std::vector<unsigned char> chIV(WALLET_CRYPTO_KEY_SIZE);
memcpy(&chIV[0], &nIV, WALLET_CRYPTO_KEY_SIZE);
if(!cKeyCrypter.SetKey(vMasterKey, chIV))
return false;
return cKeyCrypter.Decrypt(vchCiphertext, *((CKeyingMaterial*)&vchPlaintext));
}
| [
"[email protected]"
] | |
a3f17f1675359c873cf38908ca534adea45ff253 | e7d0656f1705c19d18763c7be1d23fe0dace2e50 | /ext/FadeAnimation.hpp | ff7edafc559f44084f76dd6208779ccc184f7e88 | [] | no_license | paulas/sfml-ruby | c3805cebb9e47579077020ebf9e3ccbb907204e2 | 00c7dbfc669bfe8bb7fa7ebc17ca2769d82b443f | refs/heads/master | 2020-12-03T09:11:44.772639 | 2014-12-19T14:23:10 | 2014-12-19T14:23:10 | 39,339,126 | 1 | 0 | null | 2015-07-19T15:46:53 | 2015-07-19T15:46:53 | null | UTF-8 | C++ | false | false | 927 | hpp | /*
* FadeAnimation.hpp
*
* Created on: 14.11.2013
* Author: hanmac
*/
#ifndef FADEANIMATION_HPP_
#define FADEANIMATION_HPP_
#include "Animation.hpp"
#ifdef HAVE_THOR_ANIMATION_HPP
#include <Thor/Animation.hpp>
#endif
extern VALUE rb_cSFMLFadeAnimation;
void Init_SFMLFadeAnimation(VALUE rb_mSFML);
#ifdef HAVE_THOR_ANIMATION_HPP
class RubyFadeAnimation : public TplRubyAnimation<thor::FadeAnimation>
{
public:
float getIn() const { return m_in;}
float getOut() const { return m_out;}
void setIn(float in) {setInAndOut(in,m_out);}
void setOut(float out) {setInAndOut(m_in,out);}
void ruby_init(int argc,VALUE *argv,VALUE self);
private:
float m_in;
float m_out;
void setInAndOut(float in,float out);
};
template <>
VALUE wrap< RubyFadeAnimation >(RubyFadeAnimation *ani );
template <>
RubyFadeAnimation* unwrap< RubyFadeAnimation* >(const VALUE &vani);
#endif
#endif /* FADEANIMATION_HPP_ */
| [
"[email protected]"
] | |
255da81a1ff4bf776868b3712a3b49649fc48f30 | d50b5cc908f06facaed95c4558c296227270f62c | /UVA/AdHoc/12279_Emoogle_Balance.cpp | ea2b3e20a903e4265237de77940fff2928ab8d11 | [] | no_license | marcelomata/competitive-programming-1 | e24ac3bc129cb4aae2544c03252fc9dd55351c55 | c0631e1f0eb52c6f13b0d047ea976ce61bf0991f | refs/heads/master | 2023-03-17T17:41:28.636855 | 2021-02-28T16:44:50 | 2021-02-28T16:44:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 320 | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n, num, cont1, cont2, cont;
cont = 1;
while(cin>>n && n){
cont1 = 0;
cont2 = 0;
for(int i = 0; i < n; i++){
cin>>num;
if(num == 0) cont2++;
else cont1++;
}
printf("Case %d: %d\n", cont, cont1 - cont2);
cont++;
}
return 0;
} | [
"[email protected]"
] | |
48d2e996e5c99db014cdc9e53282dee74d466d9a | 7aea5c7d4345adecdcfdeb87d757a2808519ec46 | /JS-VEMCUCtl_20140409/SDDElecMap/include/dialog/McCurveDialog.h | 545c486e433348fd6611be8317c12f5248e2bc2b | [] | no_license | wpmyj/MonitorSystem | 105657d0c4aeb4eb677d8dc760143eb45805e718 | f5c49c61f30676b3c5ff07c39fa043cc0dee31b4 | refs/heads/master | 2021-01-21T14:32:53.419350 | 2016-02-01T09:27:28 | 2016-02-01T09:27:28 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 2,966 | h | #pragma once
#include <afxcmn.h>
#include <afxwin.h>
#include "../../resource.h"
#include "canvas/mccurvedata.h"
#include "canvas/LineProp.h"
#include "canvas/precitionedit.h"
// CMcCurvePage1 对话框
class CMcCurvePage1 : public CPropertyPage
{
DECLARE_DYNAMIC(CMcCurvePage1)
public:
CMcCurvePage1();
virtual ~CMcCurvePage1();
// 对话框数据
enum { IDD = IDD_MCCURVEPAGE1 };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
CMcCurveData *pmccurvedata;
int m_nIprecision;
int m_nVprecision;
float m_fLeftcoord;
float m_fTopcoord;
float m_fXlen;
float m_fYlen;
float m_fImin;
float m_fImax;
float m_fVmin;
float m_fVmax;
BYTE m_nNode;
BYTE m_nLine;
int m_nRtu;
BOOL m_bGt;
virtual BOOL OnInitDialog();
virtual void OnOK();
afx_msg void OnBnClickedCheck1();
afx_msg void OnBnClickedButton1();
CPrecitionEdit m_IminEdit;
CPrecitionEdit m_ImaxEdit;
CPrecitionEdit m_VminEdit;
CPrecitionEdit m_VmaxEdit;
afx_msg void OnBnClickedButton13();
CString m_strmcename;
BOOL m_bonlyrealline;
virtual BOOL OnKillActive();
CString m_UpName;
CString m_DownName;
BOOL m_realtime_style;
afx_msg void OnBnClickedCheck2();
};
#pragma once
#include "canvas/lineprop.h"
#include "canvas/colorlist.h"
// CMcCurvePage2 对话框
//typedef BOOL _stdcall ShowFindDotDlg(int kind,char * ename,char * cname);
class CMcCurvePage2 : public CPropertyPage
{
DECLARE_DYNAMIC(CMcCurvePage2)
public:
CMcCurvePage2();
virtual ~CMcCurvePage2();
// 对话框数据
enum { IDD = IDD_MCCURVEPAGE2 };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
//ShowFindDotDlg *pShowFindDot;
void SetList(CURVEARRAY*);
CMcCurveData *pmccurvedata;
TCurve* GetCurSingleLine(int);
public:
int editindex;
int nCurveSel;
afx_msg void OnBnClickedButton1();
afx_msg void OnBnClickedButton11();
BYTE m_BchannelNO;
BYTE m_BDot;
int m_BPrecision;
float m_fRatio;
COLORREF m_nColor;
afx_msg void OnBnClickedButton2();
CColorList m_CurveList;
virtual BOOL OnInitDialog();
public:
void DrawListTitle();
afx_msg void OnCbnSelchangeCombo1();
afx_msg void OnNMClickList2(NMHDR *pNMHDR, LRESULT *pResult);
CComboBox ModeBox;
CStaticColor m_staticcolor;
afx_msg void OnStnClickedColorstatic();
virtual BOOL OnSetActive();
afx_msg void OnBnClickedButton3();
BYTE m_nlinenode;
BYTE m_nlineline;
BYTE m_nlinertu;
virtual void OnOK();
// 简称
CString m_unit;
};
// CMcCurveSheet
class CMcCurveSheet : public CPropertySheet
{
DECLARE_DYNAMIC(CMcCurveSheet)
public:
CMcCurveData *pmccurvedata;
CMcCurveSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
CMcCurveSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
virtual ~CMcCurveSheet();
CMcCurvePage1 mccurvepage1;
CMcCurvePage2 mccurvepage2;
protected:
DECLARE_MESSAGE_MAP()
public:
virtual BOOL OnInitDialog();
};
| [
"[email protected]"
] | |
44d6a96a6d25c83cfc6738fb3c8462810012b68d | def696f2d153970ebf473f09adfeec8c6b73f5cf | /ReOrderList.cpp | 9ae6d48e06fff62d9f58ebaae8a957c626190746 | [] | no_license | amoljadhav250/cpp | bbaadce5349d8e5ae541ec263838086c7ca980e5 | 99834a59c7183b56124714217a17bd79d3aa1b37 | refs/heads/master | 2023-04-29T16:49:27.665757 | 2023-04-19T15:14:00 | 2023-04-19T15:14:00 | 149,591,175 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,267 | cpp | #include<bits/stdc++.h>
#define LL long long int
#define sc(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define pf(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define F first
#define S second
#define d(x) cout<<#x<<":"<<x<<"\t"
#define dn(x) cout<<#x<<":"<<x<<"\n"
using namespace std;
struct ListNode{
int val;
ListNode *next;
};
ListNode *newNode(int x){
ListNode *node = new ListNode;
node->val=x;
node->next=NULL;
return node;
}
void appendList(ListNode **h,int data){
if(*h==NULL){
*h=newNode(data);
}else{
ListNode *t=*h;
while(t->next!=NULL){
t=t->next;
}
t->next=newNode(data);
}
}
void printList(ListNode *head){
while(head){
cout<<head->val<<" ";
head=head->next;
}
cout<<endl;
}
ListNode *reverseList(ListNode *h){
if(h==NULL){
return NULL;
}else if(h->next==NULL){
return h;
}
else{
ListNode *prev=NULL;
ListNode *curr=h;
ListNode *next=curr->next;
while(curr!=NULL){//travel the loop
next=curr->next;
curr->next=prev;
prev=curr;
curr=next;
}
h=prev;
return h;
}
}
ListNode *reorderList(ListNode *A){
ListNode *h=A;
if(h==NULL || h->next==NULL){
return h;
}
ListNode *slow=h;
ListNode *fast=h;
ListNode *prev=NULL;
while(fast!=NULL && fast->next!=NULL){
prev=slow;
slow=slow->next;
fast=fast->next->next;
}
ListNode *s=NULL;
if(fast!=NULL){
ListNode *p=slow->next;
slow->next=NULL;
s=reverseList(p);
}else{
prev->next=NULL;
s=reverseList(slow);
}
ListNode *f=h;
ListNode *fn=f->next;
ListNode *sn=s->next;
while(fn!=NULL && sn!=NULL){
// cout<<"f="<<f->val<<" s="<<s->val<<" fn="<<fn->val<<" sn="<<sn->val<<endl;
f->next=s;
s->next=fn;
f=fn;
s=sn;
fn=f->next;
sn=s->next;
}
f->next=s;
s->next=fn;
f=fn;
s=sn;
fn=f->next;
sn=s->next;
return h;
}
int main() {
ListNode *h=newNode(1);
appendList(&h,2);
appendList(&h,3);
appendList(&h,4);
appendList(&h,5);
appendList(&h,6);
appendList(&h,7);
appendList(&h,8);
appendList(&h,9);
// appendList(&h,10);
cout<<"Print List:-"<<endl;
printList(h);
// h=reverseList(h);
// cout<<"Print List after reversing at i"<<endl;
// printList(h);
h=reorderList(h);
cout<<"Print List after half reversing at i"<<endl;
printList(h);
return 0;
}
| [
"[email protected]"
] | |
4b06e7346710ddf2c91cce291d3f0e7ec12f1d07 | f977c3d904f58786fbba8dbf6d136619fd5f0dbb | /src/walletdb.cpp | 4690cf6cf1f673371fb3bcf916c086a05498930e | [
"MIT",
"OpenSSL"
] | permissive | scottie/bithold | 15137ae7c8560bfebb1da71c571f7e8e3c169932 | 599575926eddcae7aafb3635573e2b22b5e9bbc1 | refs/heads/master | 2021-04-15T06:41:11.063307 | 2018-03-22T15:13:09 | 2018-03-22T15:13:09 | 126,345,236 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 29,638 | cpp | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "walletdb.h"
#include "base58.h"
#include "protocol.h"
#include "serialize.h"
#include "sync.h"
#include "wallet.h"
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
using namespace std;
using namespace boost;
static uint64_t nAccountingEntryNumber = 0;
extern bool fWalletUnlockStakingOnly;
//
// CWalletDB
//
bool CWalletDB::WriteName(const string& strAddress, const string& strName)
{
nWalletDBUpdated++;
return Write(make_pair(string("name"), strAddress), strName);
}
bool CWalletDB::EraseName(const string& strAddress)
{
// This should only be used for sending addresses, never for receiving addresses,
// receiving addresses must always have an address book entry if they're not change return.
nWalletDBUpdated++;
return Erase(make_pair(string("name"), strAddress));
}
bool CWalletDB::WriteTx(uint256 hash, const CWalletTx& wtx)
{
nWalletDBUpdated++;
return Write(std::make_pair(std::string("tx"), hash), wtx);
}
bool CWalletDB::EraseTx(uint256 hash)
{
nWalletDBUpdated++;
return Erase(std::make_pair(std::string("tx"), hash));
}
bool CWalletDB::WriteStealthKeyMeta(const CKeyID& keyId, const CStealthKeyMetadata& sxKeyMeta)
{
nWalletDBUpdated++;
return Write(std::make_pair(std::string("sxKeyMeta"), keyId), sxKeyMeta, true);
}
bool CWalletDB::EraseStealthKeyMeta(const CKeyID& keyId)
{
nWalletDBUpdated++;
return Erase(std::make_pair(std::string("sxKeyMeta"), keyId));
}
bool CWalletDB::WriteStealthAddress(const CStealthAddress& sxAddr)
{
nWalletDBUpdated++;
return Write(std::make_pair(std::string("sxAddr"), sxAddr.scan_pubkey), sxAddr, true);
}
bool CWalletDB::ReadStealthAddress(CStealthAddress& sxAddr)
{
// -- set scan_pubkey before reading
return Read(std::make_pair(std::string("sxAddr"), sxAddr.scan_pubkey), sxAddr);
}
bool CWalletDB::WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, const CKeyMetadata& keyMeta)
{
nWalletDBUpdated++;
if (!Write(std::make_pair(std::string("keymeta"), vchPubKey),
keyMeta, false))
return false;
// hash pubkey/privkey to accelerate wallet load
std::vector<unsigned char> vchKey;
vchKey.reserve(vchPubKey.size() + vchPrivKey.size());
vchKey.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end());
vchKey.insert(vchKey.end(), vchPrivKey.begin(), vchPrivKey.end());
return Write(std::make_pair(std::string("key"), vchPubKey), std::make_pair(vchPrivKey, Hash(vchKey.begin(), vchKey.end())), false);
}
bool CWalletDB::WriteCryptedKey(const CPubKey& vchPubKey,
const std::vector<unsigned char>& vchCryptedSecret,
const CKeyMetadata &keyMeta)
{
const bool fEraseUnencryptedKey = true;
nWalletDBUpdated++;
if (!Write(std::make_pair(std::string("keymeta"), vchPubKey),
keyMeta))
return false;
if (!Write(std::make_pair(std::string("ckey"), vchPubKey), vchCryptedSecret, false))
return false;
if (fEraseUnencryptedKey)
{
Erase(std::make_pair(std::string("key"), vchPubKey));
Erase(std::make_pair(std::string("wkey"), vchPubKey));
}
return true;
}
bool CWalletDB::WriteMasterKey(unsigned int nID, const CMasterKey& kMasterKey)
{
nWalletDBUpdated++;
return Write(std::make_pair(std::string("mkey"), nID), kMasterKey, true);
}
bool CWalletDB::WriteCScript(const uint160& hash, const CScript& redeemScript)
{
nWalletDBUpdated++;
return Write(std::make_pair(std::string("cscript"), hash), redeemScript, false);
}
bool CWalletDB::WriteWatchOnly(const CScript &dest)
{
nWalletDBUpdated++;
return Write(std::make_pair(std::string("watchs"), dest), '1');
}
bool CWalletDB::EraseWatchOnly(const CScript &dest)
{
nWalletDBUpdated++;
return Erase(std::make_pair(std::string("watchs"), dest));
}
bool CWalletDB::WriteBestBlock(const CBlockLocator& locator)
{
nWalletDBUpdated++;
return Write(std::string("bestblock"), locator);
}
bool CWalletDB::ReadBestBlock(CBlockLocator& locator)
{
return Read(std::string("bestblock"), locator);
}
bool CWalletDB::WriteOrderPosNext(int64_t nOrderPosNext)
{
nWalletDBUpdated++;
return Write(std::string("orderposnext"), nOrderPosNext);
}
bool CWalletDB::WriteDefaultKey(const CPubKey& vchPubKey)
{
nWalletDBUpdated++;
return Write(std::string("defaultkey"), vchPubKey);
}
bool CWalletDB::ReadPool(int64_t nPool, CKeyPool& keypool)
{
return Read(std::make_pair(std::string("pool"), nPool), keypool);
}
bool CWalletDB::WritePool(int64_t nPool, const CKeyPool& keypool)
{
nWalletDBUpdated++;
return Write(std::make_pair(std::string("pool"), nPool), keypool);
}
bool CWalletDB::ErasePool(int64_t nPool)
{
nWalletDBUpdated++;
return Erase(std::make_pair(std::string("pool"), nPool));
}
bool CWalletDB::WriteMinVersion(int nVersion)
{
return Write(std::string("minversion"), nVersion);
}
bool CWalletDB::ReadAccount(const string& strAccount, CAccount& account)
{
account.SetNull();
return Read(make_pair(string("acc"), strAccount), account);
}
bool CWalletDB::WriteAccount(const string& strAccount, const CAccount& account)
{
return Write(make_pair(string("acc"), strAccount), account);
}
bool CWalletDB::WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccountingEntry& acentry)
{
return Write(boost::make_tuple(string("acentry"), acentry.strAccount, nAccEntryNum), acentry);
}
bool CWalletDB::WriteAccountingEntry_Backend(const CAccountingEntry& acentry)
{
return WriteAccountingEntry(++nAccountingEntryNumber, acentry);
}
int64_t CWalletDB::GetAccountCreditDebit(const string& strAccount)
{
list<CAccountingEntry> entries;
ListAccountCreditDebit(strAccount, entries);
int64_t nCreditDebit = 0;
BOOST_FOREACH (const CAccountingEntry& entry, entries)
nCreditDebit += entry.nCreditDebit;
return nCreditDebit;
}
void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountingEntry>& entries)
{
bool fAllAccounts = (strAccount == "*");
Dbc* pcursor = GetCursor();
if (!pcursor)
throw runtime_error("CWalletDB::ListAccountCreditDebit() : cannot create DB cursor");
unsigned int fFlags = DB_SET_RANGE;
while (true)
{
// Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
if (fFlags == DB_SET_RANGE)
ssKey << boost::make_tuple(string("acentry"), (fAllAccounts? string("") : strAccount), uint64_t(0));
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
int ret = ReadAtCursor(pcursor, ssKey, ssValue, fFlags);
fFlags = DB_NEXT;
if (ret == DB_NOTFOUND)
break;
else if (ret != 0)
{
pcursor->close();
throw runtime_error("CWalletDB::ListAccountCreditDebit() : error scanning DB");
}
// Unserialize
string strType;
ssKey >> strType;
if (strType != "acentry")
break;
CAccountingEntry acentry;
ssKey >> acentry.strAccount;
if (!fAllAccounts && acentry.strAccount != strAccount)
break;
ssValue >> acentry;
ssKey >> acentry.nEntryNo;
entries.push_back(acentry);
}
pcursor->close();
}
DBErrors
CWalletDB::ReorderTransactions(CWallet* pwallet)
{
LOCK(pwallet->cs_wallet);
// Old wallets didn't have any defined order for transactions
// Probably a bad idea to change the output of this
// First: get all CWalletTx and CAccountingEntry into a sorted-by-time multimap.
typedef pair<CWalletTx*, CAccountingEntry*> TxPair;
typedef multimap<int64_t, TxPair > TxItems;
TxItems txByTime;
for (map<uint256, CWalletTx>::iterator it = pwallet->mapWallet.begin(); it != pwallet->mapWallet.end(); ++it)
{
CWalletTx* wtx = &((*it).second);
txByTime.insert(make_pair(wtx->nTimeReceived, TxPair(wtx, (CAccountingEntry*)0)));
}
list<CAccountingEntry> acentries;
ListAccountCreditDebit("", acentries);
BOOST_FOREACH(CAccountingEntry& entry, acentries)
{
txByTime.insert(make_pair(entry.nTime, TxPair((CWalletTx*)0, &entry)));
}
int64_t& nOrderPosNext = pwallet->nOrderPosNext;
nOrderPosNext = 0;
std::vector<int64_t> nOrderPosOffsets;
for (TxItems::iterator it = txByTime.begin(); it != txByTime.end(); ++it)
{
CWalletTx *const pwtx = (*it).second.first;
CAccountingEntry *const pacentry = (*it).second.second;
int64_t& nOrderPos = (pwtx != 0) ? pwtx->nOrderPos : pacentry->nOrderPos;
if (nOrderPos == -1)
{
nOrderPos = nOrderPosNext++;
nOrderPosOffsets.push_back(nOrderPos);
if (pwtx)
{
if (!WriteTx(pwtx->GetHash(), *pwtx))
return DB_LOAD_FAIL;
}
else
if (!WriteAccountingEntry(pacentry->nEntryNo, *pacentry))
return DB_LOAD_FAIL;
}
else
{
int64_t nOrderPosOff = 0;
BOOST_FOREACH(const int64_t& nOffsetStart, nOrderPosOffsets)
{
if (nOrderPos >= nOffsetStart)
++nOrderPosOff;
}
nOrderPos += nOrderPosOff;
nOrderPosNext = std::max(nOrderPosNext, nOrderPos + 1);
if (!nOrderPosOff)
continue;
// Since we're changing the order, write it back
if (pwtx)
{
if (!WriteTx(pwtx->GetHash(), *pwtx))
return DB_LOAD_FAIL;
}
else
if (!WriteAccountingEntry(pacentry->nEntryNo, *pacentry))
return DB_LOAD_FAIL;
}
}
WriteOrderPosNext(nOrderPosNext);
return DB_LOAD_OK;
}
class CWalletScanState {
public:
unsigned int nKeys;
unsigned int nCKeys;
unsigned int nKeyMeta;
bool fIsEncrypted;
bool fAnyUnordered;
int nFileVersion;
vector<uint256> vWalletUpgrade;
CWalletScanState() {
nKeys = nCKeys = nKeyMeta = 0;
fIsEncrypted = false;
fAnyUnordered = false;
nFileVersion = 0;
}
};
bool
ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
CWalletScanState &wss, string& strType, string& strErr)
{
try {
// Unserialize
// Taking advantage of the fact that pair serialization
// is just the two items serialized one after the other
ssKey >> strType;
if (strType == "name")
{
string strAddress;
ssKey >> strAddress;
ssValue >> pwallet->mapAddressBook[CBitholdcoinAddress(strAddress).Get()];
}
else if (strType == "tx")
{
uint256 hash;
ssKey >> hash;
CWalletTx& wtx = pwallet->mapWallet[hash];
ssValue >> wtx;
if (!(wtx.CheckTransaction() && (wtx.GetHash() == hash)))
return false;
// Undo serialize changes in 31600
if (31404 <= wtx.fTimeReceivedIsTxTime && wtx.fTimeReceivedIsTxTime <= 31703)
{
if (!ssValue.empty())
{
char fTmp;
char fUnused;
ssValue >> fTmp >> fUnused >> wtx.strFromAccount;
strErr = strprintf("LoadWallet() upgrading tx ver=%d %d '%s' %s",
wtx.fTimeReceivedIsTxTime, fTmp, wtx.strFromAccount, hash.ToString());
wtx.fTimeReceivedIsTxTime = fTmp;
}
else
{
strErr = strprintf("LoadWallet() repairing tx ver=%d %s", wtx.fTimeReceivedIsTxTime, hash.ToString());
wtx.fTimeReceivedIsTxTime = 0;
}
wss.vWalletUpgrade.push_back(hash);
}
if (wtx.nOrderPos == -1)
wss.fAnyUnordered = true;
pwallet->AddToWallet(wtx, true);
//// debug print
//LogPrintf("LoadWallet %s\n", wtx.GetHash().ToString());
//LogPrintf(" %12d %s %s %s\n",
// wtx.vout[0].nValue,
// DateTimeStrFormat("%x %H:%M:%S", wtx.GetBlockTime()),
// wtx.hashBlock.ToString(),
// wtx.mapValue["message"]);
}
else if (strType == "sxAddr")
{
if (fDebug)
printf("WalletDB ReadKeyValue sxAddr\n");
CStealthAddress sxAddr;
ssValue >> sxAddr;
pwallet->stealthAddresses.insert(sxAddr);
}
else if (strType == "acentry")
{
string strAccount;
ssKey >> strAccount;
uint64_t nNumber;
ssKey >> nNumber;
if (nNumber > nAccountingEntryNumber)
nAccountingEntryNumber = nNumber;
if (!wss.fAnyUnordered)
{
CAccountingEntry acentry;
ssValue >> acentry;
if (acentry.nOrderPos == -1)
wss.fAnyUnordered = true;
}
}
else if (strType == "watchs")
{
CScript script;
ssKey >> script;
char fYes;
ssValue >> fYes;
if (fYes == '1')
pwallet->LoadWatchOnly(script);
// Watch-only addresses have no birthday information for now,
// so set the wallet birthday to the beginning of time.
pwallet->nTimeFirstKey = 1;
}
else if (strType == "key" || strType == "wkey")
{
CPubKey vchPubKey;
ssKey >> vchPubKey;
if (!vchPubKey.IsValid())
{
strErr = "Error reading wallet database: CPubKey corrupt";
return false;
}
CKey key;
CPrivKey pkey;
uint256 hash = 0;
if (strType == "key")
{
wss.nKeys++;
ssValue >> pkey;
} else {
CWalletKey wkey;
ssValue >> wkey;
pkey = wkey.vchPrivKey;
}
// Old wallets store keys as "key" [pubkey] => [privkey]
// ... which was slow for wallets with lots of keys, because the public key is re-derived from the private key
// using EC operations as a checksum.
// Newer wallets store keys as "key"[pubkey] => [privkey][hash(pubkey,privkey)], which is much faster while
// remaining backwards-compatible.
try
{
ssValue >> hash;
}
catch(...){}
bool fSkipCheck = false;
if (hash != 0)
{
// hash pubkey/privkey to accelerate wallet load
std::vector<unsigned char> vchKey;
vchKey.reserve(vchPubKey.size() + pkey.size());
vchKey.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end());
vchKey.insert(vchKey.end(), pkey.begin(), pkey.end());
if (Hash(vchKey.begin(), vchKey.end()) != hash)
{
strErr = "Error reading wallet database: CPubKey/CPrivKey corrupt";
return false;
}
fSkipCheck = true;
}
if (!key.Load(pkey, vchPubKey, fSkipCheck))
{
strErr = "Error reading wallet database: CPrivKey corrupt";
return false;
}
if (!pwallet->LoadKey(key, vchPubKey))
{
strErr = "Error reading wallet database: LoadKey failed";
return false;
}
}
else if (strType == "mkey")
{
unsigned int nID;
ssKey >> nID;
CMasterKey kMasterKey;
ssValue >> kMasterKey;
if(pwallet->mapMasterKeys.count(nID) != 0)
{
strErr = strprintf("Error reading wallet database: duplicate CMasterKey id %u", nID);
return false;
}
pwallet->mapMasterKeys[nID] = kMasterKey;
if (pwallet->nMasterKeyMaxID < nID)
pwallet->nMasterKeyMaxID = nID;
}
else if (strType == "ckey")
{
wss.nCKeys++;
vector<unsigned char> vchPubKey;
ssKey >> vchPubKey;
vector<unsigned char> vchPrivKey;
ssValue >> vchPrivKey;
if (!pwallet->LoadCryptedKey(vchPubKey, vchPrivKey))
{
strErr = "Error reading wallet database: LoadCryptedKey failed";
return false;
}
wss.fIsEncrypted = true;
}
else if (strType == "keymeta")
{
CPubKey vchPubKey;
ssKey >> vchPubKey;
CKeyMetadata keyMeta;
ssValue >> keyMeta;
wss.nKeyMeta++;
pwallet->LoadKeyMetadata(vchPubKey, keyMeta);
// find earliest key creation time, as wallet birthday
if (!pwallet->nTimeFirstKey ||
(keyMeta.nCreateTime < pwallet->nTimeFirstKey))
pwallet->nTimeFirstKey = keyMeta.nCreateTime;
}
else if (strType == "sxKeyMeta")
{
if (fDebug)
printf("WalletDB ReadKeyValue sxKeyMeta\n");
CKeyID keyId;
ssKey >> keyId;
CStealthKeyMetadata sxKeyMeta;
ssValue >> sxKeyMeta;
pwallet->mapStealthKeyMeta[keyId] = sxKeyMeta;
}
else if (strType == "defaultkey")
{
ssValue >> pwallet->vchDefaultKey;
}
else if (strType == "pool")
{
int64_t nIndex;
ssKey >> nIndex;
CKeyPool keypool;
ssValue >> keypool;
pwallet->setKeyPool.insert(nIndex);
// If no metadata exists yet, create a default with the pool key's
// creation time. Note that this may be overwritten by actually
// stored metadata for that key later, which is fine.
CKeyID keyid = keypool.vchPubKey.GetID();
if (pwallet->mapKeyMetadata.count(keyid) == 0)
pwallet->mapKeyMetadata[keyid] = CKeyMetadata(keypool.nTime);
}
else if (strType == "version")
{
ssValue >> wss.nFileVersion;
if (wss.nFileVersion == 10300)
wss.nFileVersion = 300;
}
else if (strType == "cscript")
{
uint160 hash;
ssKey >> hash;
CScript script;
ssValue >> script;
if (!pwallet->LoadCScript(script))
{
strErr = "Error reading wallet database: LoadCScript failed";
return false;
}
}
else if (strType == "orderposnext")
{
ssValue >> pwallet->nOrderPosNext;
}
} catch (...)
{
return false;
}
return true;
}
static bool IsKeyType(string strType)
{
return (strType== "key" || strType == "wkey" ||
strType == "mkey" || strType == "ckey");
}
DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
{
pwallet->vchDefaultKey = CPubKey();
CWalletScanState wss;
bool fNoncriticalErrors = false;
DBErrors result = DB_LOAD_OK;
try {
LOCK(pwallet->cs_wallet);
int nMinVersion = 0;
if (Read((string)"minversion", nMinVersion))
{
if (nMinVersion > CLIENT_VERSION)
return DB_TOO_NEW;
pwallet->LoadMinVersion(nMinVersion);
}
// Get cursor
Dbc* pcursor = GetCursor();
if (!pcursor)
{
LogPrintf("Error getting wallet database cursor\n");
return DB_CORRUPT;
}
while (true)
{
// Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
int ret = ReadAtCursor(pcursor, ssKey, ssValue);
if (ret == DB_NOTFOUND)
break;
else if (ret != 0)
{
LogPrintf("Error reading next record from wallet database\n");
return DB_CORRUPT;
}
// Try to be tolerant of single corrupt records:
string strType, strErr;
if (!ReadKeyValue(pwallet, ssKey, ssValue, wss, strType, strErr))
{
// losing keys is considered a catastrophic error, anything else
// we assume the user can live with:
if (IsKeyType(strType))
result = DB_CORRUPT;
else
{
// Leave other errors alone, if we try to fix them we might make things worse.
fNoncriticalErrors = true; // ... but do warn the user there is something wrong.
if (strType == "tx")
// Rescan if there is a bad transaction record:
SoftSetBoolArg("-rescan", true);
}
}
if (!strErr.empty())
LogPrintf("%s\n", strErr);
}
pcursor->close();
}
catch (boost::thread_interrupted) {
throw;
}
catch (...) {
result = DB_CORRUPT;
}
if (fNoncriticalErrors && result == DB_LOAD_OK)
result = DB_NONCRITICAL_ERROR;
// Any wallet corruption at all: skip any rewriting or
// upgrading, we don't want to make it worse.
if (result != DB_LOAD_OK)
return result;
LogPrintf("nFileVersion = %d\n", wss.nFileVersion);
LogPrintf("Keys: %u plaintext, %u encrypted, %u w/ metadata, %u total\n",
wss.nKeys, wss.nCKeys, wss.nKeyMeta, wss.nKeys + wss.nCKeys);
// nTimeFirstKey is only reliable if all keys have metadata
if ((wss.nKeys + wss.nCKeys) != wss.nKeyMeta)
pwallet->nTimeFirstKey = 1; // 0 would be considered 'no value'
BOOST_FOREACH(uint256 hash, wss.vWalletUpgrade)
WriteTx(hash, pwallet->mapWallet[hash]);
// Rewrite encrypted wallets of versions 0.4.0 and 0.5.0rc:
if (wss.fIsEncrypted && (wss.nFileVersion == 40000 || wss.nFileVersion == 50000))
return DB_NEED_REWRITE;
if (wss.nFileVersion < CLIENT_VERSION) // Update
WriteVersion(CLIENT_VERSION);
if (wss.fAnyUnordered)
result = ReorderTransactions(pwallet);
pwallet->laccentries.clear();
ListAccountCreditDebit("*", pwallet->laccentries);
BOOST_FOREACH(CAccountingEntry& entry, pwallet->laccentries) {
pwallet->wtxOrdered.insert(make_pair(entry.nOrderPos, CWallet::TxPair((CWalletTx*)0, &entry)));
}
return result;
}
void ThreadFlushWalletDB(const string& strFile)
{
// Make this thread recognisable as the wallet flushing thread
RenameThread("bithold-wallet");
static bool fOneThread;
if (fOneThread)
return;
fOneThread = true;
if (!GetBoolArg("-flushwallet", true))
return;
unsigned int nLastSeen = nWalletDBUpdated;
unsigned int nLastFlushed = nWalletDBUpdated;
int64_t nLastWalletUpdate = GetTime();
while (true)
{
MilliSleep(500);
if (nLastSeen != nWalletDBUpdated)
{
nLastSeen = nWalletDBUpdated;
nLastWalletUpdate = GetTime();
}
if (nLastFlushed != nWalletDBUpdated && GetTime() - nLastWalletUpdate >= 2)
{
TRY_LOCK(bitdb.cs_db,lockDb);
if (lockDb)
{
// Don't do this if any databases are in use
int nRefCount = 0;
map<string, int>::iterator mi = bitdb.mapFileUseCount.begin();
while (mi != bitdb.mapFileUseCount.end())
{
nRefCount += (*mi).second;
mi++;
}
if (nRefCount == 0)
{
boost::this_thread::interruption_point();
map<string, int>::iterator mi = bitdb.mapFileUseCount.find(strFile);
if (mi != bitdb.mapFileUseCount.end())
{
LogPrint("db", "Flushing wallet.dat\n");
nLastFlushed = nWalletDBUpdated;
int64_t nStart = GetTimeMillis();
// Flush wallet.dat so it's self contained
bitdb.CloseDb(strFile);
bitdb.CheckpointLSN(strFile);
bitdb.mapFileUseCount.erase(mi++);
LogPrint("db", "Flushed wallet.dat %dms\n", GetTimeMillis() - nStart);
}
}
}
}
}
}
bool BackupWallet(const CWallet& wallet, const string& strDest)
{
if (!wallet.fFileBacked)
return false;
while (true)
{
{
LOCK(bitdb.cs_db);
if (!bitdb.mapFileUseCount.count(wallet.strWalletFile) || bitdb.mapFileUseCount[wallet.strWalletFile] == 0)
{
// Flush log data to the dat file
bitdb.CloseDb(wallet.strWalletFile);
bitdb.CheckpointLSN(wallet.strWalletFile);
bitdb.mapFileUseCount.erase(wallet.strWalletFile);
// Copy wallet.dat
filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile;
filesystem::path pathDest(strDest);
if (filesystem::is_directory(pathDest))
pathDest /= wallet.strWalletFile;
try {
#if BOOST_VERSION >= 104000
filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists);
#else
filesystem::copy_file(pathSrc, pathDest);
#endif
LogPrintf("copied wallet.dat to %s\n", pathDest.string());
return true;
} catch(const filesystem::filesystem_error &e) {
LogPrintf("error copying wallet.dat to %s - %s\n", pathDest.string(), e.what());
return false;
}
}
}
MilliSleep(100);
}
return false;
}
//
// Try to (very carefully!) recover wallet.dat if there is a problem.
//
bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
{
// Recovery procedure:
// move wallet.dat to wallet.timestamp.bak
// Call Salvage with fAggressive=true to
// get as much data as possible.
// Rewrite salvaged data to wallet.dat
// Set -rescan so any missing transactions will be
// found.
int64_t now = GetTime();
std::string newFilename = strprintf("wallet.%d.bak", now);
int result = dbenv.dbenv.dbrename(NULL, filename.c_str(), NULL,
newFilename.c_str(), DB_AUTO_COMMIT);
if (result == 0)
LogPrintf("Renamed %s to %s\n", filename, newFilename);
else
{
LogPrintf("Failed to rename %s to %s\n", filename, newFilename);
return false;
}
std::vector<CDBEnv::KeyValPair> salvagedData;
bool allOK = dbenv.Salvage(newFilename, true, salvagedData);
if (salvagedData.empty())
{
LogPrintf("Salvage(aggressive) found no records in %s.\n", newFilename);
return false;
}
LogPrintf("Salvage(aggressive) found %u records\n", salvagedData.size());
bool fSuccess = allOK;
Db* pdbCopy = new Db(&dbenv.dbenv, 0);
int ret = pdbCopy->open(NULL, // Txn pointer
filename.c_str(), // Filename
"main", // Logical db name
DB_BTREE, // Database type
DB_CREATE, // Flags
0);
if (ret > 0)
{
LogPrintf("Cannot create database file %s\n", filename);
return false;
}
CWallet dummyWallet;
CWalletScanState wss;
DbTxn* ptxn = dbenv.TxnBegin();
BOOST_FOREACH(CDBEnv::KeyValPair& row, salvagedData)
{
if (fOnlyKeys)
{
CDataStream ssKey(row.first, SER_DISK, CLIENT_VERSION);
CDataStream ssValue(row.second, SER_DISK, CLIENT_VERSION);
string strType, strErr;
bool fReadOK = ReadKeyValue(&dummyWallet, ssKey, ssValue,
wss, strType, strErr);
if (!IsKeyType(strType))
continue;
if (!fReadOK)
{
LogPrintf("WARNING: CWalletDB::Recover skipping %s: %s\n", strType, strErr);
continue;
}
}
Dbt datKey(&row.first[0], row.first.size());
Dbt datValue(&row.second[0], row.second.size());
int ret2 = pdbCopy->put(ptxn, &datKey, &datValue, DB_NOOVERWRITE);
if (ret2 > 0)
fSuccess = false;
}
ptxn->commit(0);
pdbCopy->close(0);
delete pdbCopy;
return fSuccess;
}
bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename)
{
return CWalletDB::Recover(dbenv, filename, false);
}
| [
"[email protected]"
] | |
475bdf92d1868471ae8aa9a3d69057af9312d0fe | 3cc5872c4c534ccd0349d34e860ff41a8c072e90 | /hw_3/benchmarks/Cover9_20_1000000.log.cc | b71b3f12c548f4179060b5cd60b9b1b7309be11b | [] | no_license | bear24rw/EECE6086 | 253f2be5f25f06c9748384ad33936f4ad3608d01 | 3b25ed6951514fbb91fab47300c5a213fe62f555 | refs/heads/master | 2021-01-10T19:11:41.214890 | 2014-04-19T03:43:22 | 2014-04-19T03:43:22 | 17,157,280 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 893 | cc | Using algorithms: flag heur
Flags is printing complements
Number of missing covers: 0
Flags found it
Waiting for threads to join
Command being timed: "./cc -m benchmarks/Cover9_20_1000000.txt"
User time (seconds): 13.66
System time (seconds): 0.33
Percent of CPU this job got: 299%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:04.67
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 626864
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 92870
Voluntary context switches: 23
Involuntary context switches: 48
Swaps: 0
File system inputs: 0
File system outputs: 240
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
| [
"[email protected]"
] | |
b0cfc7cda54a4051b043398aa3f56f2eb24ce650 | 4469634a5205a9b6e3cca8788b78ffd4d69a50f6 | /aws-cpp-sdk-ecs/source/model/TaskField.cpp | 1f1bffb57cc42ab05b35ecba6bdaaf7998f1c4d9 | [
"MIT",
"Apache-2.0",
"JSON"
] | permissive | tnthornton/aws-sdk-cpp | 7070108f778ce9c39211d7041a537a5598f2a351 | e30ee8c5b40091a11f1019d9230bbfac1e6c5edd | refs/heads/master | 2020-04-11T04:53:19.482117 | 2018-12-12T01:33:22 | 2018-12-12T01:33:22 | 161,530,181 | 0 | 0 | Apache-2.0 | 2018-12-12T18:41:56 | 2018-12-12T18:41:55 | null | UTF-8 | C++ | false | false | 2,072 | cpp | /*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <aws/ecs/model/TaskField.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>
using namespace Aws::Utils;
namespace Aws
{
namespace ECS
{
namespace Model
{
namespace TaskFieldMapper
{
static const int TAGS_HASH = HashingUtils::HashString("TAGS");
TaskField GetTaskFieldForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == TAGS_HASH)
{
return TaskField::TAGS;
}
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
if(overflowContainer)
{
overflowContainer->StoreOverflow(hashCode, name);
return static_cast<TaskField>(hashCode);
}
return TaskField::NOT_SET;
}
Aws::String GetNameForTaskField(TaskField enumValue)
{
switch(enumValue)
{
case TaskField::TAGS:
return "TAGS";
default:
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
if(overflowContainer)
{
return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
}
return "";
}
}
} // namespace TaskFieldMapper
} // namespace Model
} // namespace ECS
} // namespace Aws
| [
"[email protected]"
] | |
c299db593058718c49c63102655238bb48164908 | 241f30fcc86988df249886448765b5a9f2d40212 | /examples/testUI/testUI.ino | 7d71c271ab9a67a7c127b8e09e95d15dc7fd4eff | [] | no_license | fjand5/VoCaUI | af1d6990a76f7204edc68fa4fab8fd1c72b16e42 | 71cd076b4ff2ab8b5eca7ce9aa860cb7b20bb047 | refs/heads/master | 2021-03-15T02:44:12.473872 | 2020-08-17T03:13:50 | 2020-08-17T03:13:50 | 246,818,176 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,393 | ino | //#define ETHERNET //Dùng cho mạng có dây (giao tiếp bằng chân D4 và spi)
#include "vocaui.h"
#include "mail.h"
void setup() {
Serial.begin(115200);
// loadConfigFile(true); // Sử dụng trong khi phát triển (sẽ xóa dữ liệu động)
loadConfigFile(false); // for using
render_init("cafe vong cat"); // Khởi tạo trang web
begin_menu("mngMail", "test giao diện", [](String val) {
LOG(val + " -- test giao diện" );
});
render_inputText("mesg", "Nội Dung", "", [](String val) {
LOG(val + " -- Nội Dung" );
});
render_range("testrange", "đây là range", 0, 100, 1, "", [](String val) {
LOG(val + " -- đây là range" );
});
render_switch("testswitch", "đây là swicth", "", [](String val) {
LOG(val + " -- đây là swicth" );
setValue("teststate", val);
});
render_state("teststate", "đây là state","");
render_TimePicker("TimePicker1", "TimePicker", "", [](String val) {
uint32_t stamp = val.toInt();
uint32_t _hour = stamp / 60;
uint32_t _min = stamp % 60;
LOG(val + " -- TimePicker1 " + _hour + " " + _min);
});
render_TimePicker("TimePicker2", "TimePicker", "", [](String val) {
uint32_t stamp = val.toInt();
uint32_t _hour = stamp / 60;
uint32_t _min = stamp % 60;
LOG(val + " -- TimePicker2 " + _hour + " " + _min);
});
render_textView("tview", "Nội Dung","");
render_button("testMail", "Gửi Thử1", "", [](String val) {
LOG("testMail");
addMail("testMailtestMail");
});
render_button("testMail2", "Gửi Thử2", "", [](String val) {
LOG("testMail2");
});
end_menu();
// chức năng hẹn giờ, chạy 1 phút 1 lần.
addTaskEvent(1, [](int dayW, int hour, int min) {
uint32_t stamp = String(getValue("TimePicker1")).toInt();
uint32_t _hour = stamp / 60;
uint32_t _min = stamp % 60;
if (_hour == hour
&& _min == min) {
LOG(String(" -- TimePicker1 chay: ") + dayW + " " + hour + " " + min);
}
});
addTaskEvent(2, [](int dayW, int hour, int min) {
uint32_t stamp = String(getValue("TimePicker2")).toInt();
uint32_t _hour = stamp / 60;
uint32_t _min = stamp % 60;
if (_hour == hour
&& _min == min) {
LOG(String(" -- TimePicker2 chay: ") + dayW + " " + hour + " " + min);
}
});
initVoCa();
}
void loop() {
voCaHandle();
}
| [
"[email protected]"
] | |
0b151fae9723f8729233d75cb672d63073b9b658 | e1cd6c8fccdc7bed50d64e9f0767c16b3f5a5038 | /week-05/day-3/Testing/MyApp_lib/apple.h | 8fc937b8b03e7fde473dc216dd2baa71b0e1fa0b | [] | no_license | green-fox-academy/laszland | 4fd2428fc95083f0a61b47c34759b392ad2990ed | 6acf9c774dc07d838b5400bb3313ed1044827b16 | refs/heads/master | 2020-07-23T12:39:16.484793 | 2020-01-29T09:29:17 | 2020-01-29T09:29:17 | 207,557,491 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 149 | h | #ifndef TESTING_APPLE_H
#define TESTING_APPLE_H
#include <string>
class apple {
public:
std::string getApple();
};
#endif //TESTING_APPLE_H
| [
"[email protected]"
] | |
fd8398e35fc116766c85d50f172fb8bcbf6da856 | cc52b3fb9b4ecbb30bd8ea89a2b3a6e601fdcd39 | /459/A[ Pashmak and Garden ].cpp | 5012fa9009fe9c8f4b214c69b69661f36aa8cccf | [] | no_license | xxqxpxx/CodeForces-Solutions | 200757f24d51fc1449d2b3eb9beb6b4a191d1f8d | 26454489da6194ffaff8656fc45565cb904bdad9 | refs/heads/master | 2016-09-05T19:16:14.930349 | 2015-11-24T02:04:36 | 2015-11-24T02:04:36 | 40,114,049 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 606 | cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int x1 , y1, x2,y2;
cin >> x1 >> y1 >> x2 >> y2 ;
if (x1 == x2)
{
int z = abs(y2-y1);
cout << x1+z << " " << y1 << " " << x1+z << " " << y2 << endl;
}
else if (y1 == y2 )
{
int z = abs(x2-x1);
cout << x1 << " " << y1+z << " " << x2 << " " << y2+z << endl;
}
else
{
if (abs(x2-x1) == abs(y2-y1))
{
cout << x1 << " " << y2 << " " << x2 << " " << y1 << endl;
}
else
cout << -1 << endl;
}
return 0;
}
| [
"[email protected]"
] | |
61bfb1b763dd870080c09d34778a73b22a7e00fc | 5fb4409abe9e4796c8dc17cc51233c779b9e24bc | /app/src/main/cpp/wechat/zxing/qrcode/decoder/datamask.hpp | 17cce88179d12356556c102a84ae0687f1b4544e | [] | no_license | BlackSuns/LearningAndroidOpenCV | 6be52f71cd9f3a1d5546da31f71c04064f0c7cac | 79dc25e383c740c73cae67f36027abf13ab17922 | refs/heads/master | 2023-07-10T02:08:10.923992 | 2021-08-09T02:09:19 | 2021-08-09T02:09:34 | 297,529,216 | 0 | 0 | null | 2021-08-09T14:06:05 | 2020-09-22T03:52:46 | C++ | UTF-8 | C++ | false | false | 1,309 | hpp | // This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Tencent is pleased to support the open source community by making WeChat QRCode available.
// Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
//
// Modified from ZXing. Copyright ZXing authors.
// Licensed under the Apache License, Version 2.0 (the "License").
#ifndef __ZXING_QRCODE_DECODER_DATAMASK_HPP__
#define __ZXING_QRCODE_DECODER_DATAMASK_HPP__
#include "../../common/array.hpp"
#include "../../common/bitmatrix.hpp"
#include "../../common/counted.hpp"
#include "../../errorhandler.hpp"
namespace zxing {
namespace qrcode {
class DataMask : public Counted {
private:
static std::vector<Ref<DataMask> > DATA_MASKS;
protected:
public:
DataMask();
virtual ~DataMask();
void unmaskBitMatrix(BitMatrix &matrix, size_t dimension);
virtual bool isMasked(size_t x, size_t y) = 0;
static DataMask &forReference(int reference, ErrorHandler &err_handler);
};
} // namespace qrcode
} // namespace zxing
#endif // __ZXING_QRCODE_DECODER_DATAMASK_HPP__
| [
"[email protected]"
] | |
529a55b35b0402641e6661e42c0eb21e63260afd | 793c8848753f530aab28076a4077deac815af5ac | /src/dskphone/ui/t48/settingui/src/cusbtimecounter.cpp | 755531d6c6d9580f473682152d00ef1753ef1ed2 | [] | no_license | Parantido/sipphone | 4c1b9b18a7a6e478514fe0aadb79335e734bc016 | f402efb088bb42900867608cc9ccf15d9b946d7d | refs/heads/master | 2021-09-10T20:12:36.553640 | 2018-03-30T12:44:13 | 2018-03-30T12:44:13 | 263,628,242 | 1 | 0 | null | 2020-05-13T12:49:19 | 2020-05-13T12:49:18 | null | UTF-8 | C++ | false | false | 829 | cpp | #include "cusbtimecounter.h"
#include "usbuicommon.h"
CUSBTimeCounter::CUSBTimeCounter()
: m_nTotalSeconds(0)
, m_nCurrentSeconds(0)
{
InitData();
}
CUSBTimeCounter::~CUSBTimeCounter()
{
}
void CUSBTimeCounter::InitData()
{
//使用TimeCounter的话需要实现OnTimeCountOut的槽
// QObject::connect(&m_timer, SIGNAL(timeout()), MyListener, SIGNAL(TimerCountOut()));
}
void CUSBTimeCounter::SetCountTime()
{
StopCountTime();
m_timer.start(1000);
}
void CUSBTimeCounter::StopCountTime()
{
if (m_timer.isActive())
{
m_timer.stop();
}
}
long CUSBTimeCounter::CalculateSeekTimePointByPercent(int nPercent)
{
return (long)((float)nPercent / USB_PROCESSBAR_TOTAL * m_nTotalSeconds);
}
long CUSBTimeCounter::CalculatePausePointByCurrentTime()
{
return m_nCurrentSeconds;
}
| [
"[email protected]"
] | |
5de0bbed45be15fe95b44d55a0892350d1377566 | 6b40e9dccf2edc767c44df3acd9b626fcd586b4d | /NT/net/tapi/skywalker/tapi3/tapiobj.cpp | e9cadcdd2d50c7ff1123ce752548aa0f54b758ad | [] | no_license | jjzhang166/WinNT5_src_20201004 | 712894fcf94fb82c49e5cd09d719da00740e0436 | b2db264153b80fbb91ef5fc9f57b387e223dbfc2 | refs/heads/Win2K3 | 2023-08-12T01:31:59.670176 | 2021-10-14T15:14:37 | 2021-10-14T15:14:37 | 586,134,273 | 1 | 0 | null | 2023-01-07T03:47:45 | 2023-01-07T03:47:44 | null | UTF-8 | C++ | false | false | 111,593 | cpp | /*++
Copyright (c) 1997 - 1999 Microsoft Corporation
Module Name:
tapiobj.cpp
Abstract:
Implementation of the TAPI object for TAPI 3.0.
The TAPI object represents the application's entry point
into TAPI - it is similar to the hLineApp / hPhoneApp.
Author:
mquinton - 4/17/97
Notes:
optional-notes
Revision History:
--*/
#include "stdafx.h"
#include "common.h"
#include "atlwin.cpp"
#include "tapievt.h"
extern "C" {
#include "..\..\inc\tapihndl.h"
}
extern CRITICAL_SECTION gcsTapiObjectArray;
extern CRITICAL_SECTION gcsGlobalInterfaceTable;
//
// handle for heap for the handle table
//
// does not need to be exported, hence static
//
static HANDLE ghTapiHeap = 0;
//
// handle table handle
//
HANDLE ghHandleTable = 0;
///////////////////////////////////////////////////////////////////////////////
//
// FreeContextCallback
//
// callback function called by the handle table when a table entry
// is removed. No need to do anything in this case.
//
VOID
CALLBACK
FreeContextCallback(
LPVOID Context,
LPVOID Context2
)
{
}
///////////////////////////////////////////////////////////////////////////////
//
// AllocateAndInitializeHandleTable
//
// this function creates heap for handle table and the handle table itself
//
// Note: this function is not thread-safe. It is only called from
// ctapi::Initialize() from ghTapiInitShutdownSerializeMutex lock
//
HRESULT AllocateAndInitializeHandleTable()
{
LOG((TL_TRACE, "AllocateAndInitializeHandleTable - entered"));
//
// heap should not exist at this point
//
_ASSERTE(NULL == ghTapiHeap);
if (NULL != ghTapiHeap)
{
LOG((TL_ERROR, "AllocateAndInitializeHandleTable() heap already exists"));
return E_UNEXPECTED;
}
//
// handle table should not exist at this point
//
_ASSERTE(NULL == ghHandleTable);
if (NULL != ghHandleTable)
{
LOG((TL_ERROR, "AllocateAndInitializeHandleTable() handle table already exists"));
return E_UNEXPECTED;
}
//
// attempt to create heap
//
if (!(ghTapiHeap = HeapCreate (0, 0x10000, 0)))
{
//
// heap creation failed, use process's heap
//
LOG((TL_WARN, "AllocateAndInitializeHandleTable() failed to allocate private heap. using process's heap"));
ghTapiHeap = GetProcessHeap();
if (NULL == ghTapiHeap)
{
LOG((TL_ERROR, "AllocateAndInitializeHandleTable failed to get process's heap"));
return E_OUTOFMEMORY;
}
} // HeapCreate()
//
// we have the heap. use it to create handle table
//
ghHandleTable = CreateHandleTable( ghTapiHeap,
FreeContextCallback,
1, // min handle value
MAX_DWORD // max handle value
);
if (NULL == ghHandleTable)
{
LOG((TL_ERROR, "AllocateAndInitializeHandleTable failed to create handle table"));
HeapDestroy (ghTapiHeap);
ghTapiHeap = NULL;
return E_OUTOFMEMORY;
}
//
// succeeded creating heap and handle table
//
LOG((TL_INFO, "AllocateAndInitializeHandleTable - succeeded"));
return S_OK;
}
///////////////////////////////////////////////////////////////////////////////
//
// ShutdownAndDeallocateHandleTable
//
// this function deletes handle table, and destroys heap on which it was
// allocated (if not process heap)
//
// Note: this function is not thread-safe. It is only called from
// ctapi::Initialize() and Shutdown() from ghTapiInitShutdownSerializeMutex lock
//
HRESULT ShutdownAndDeallocateHandleTable()
{
LOG((TL_TRACE, "ShutdownAndDeallocateHandleTable - entered"));
//
// heap should exist at this point
//
_ASSERTE(NULL != ghTapiHeap);
if (NULL == ghTapiHeap)
{
LOG((TL_ERROR, "ShutdownAndDeallocateHandleTable heap does not exist"));
return E_UNEXPECTED;
}
//
// handle table should exist at this point
//
_ASSERTE(NULL != ghHandleTable);
if (NULL == ghHandleTable)
{
LOG((TL_ERROR, "ShutdownAndDeallocateHandleTable handle table does not exist"));
return E_UNEXPECTED;
}
//
// delete handle table
//
DeleteHandleTable (ghHandleTable);
ghHandleTable = NULL;
//
// if we created heap for it, destroy it
//
if (ghTapiHeap != GetProcessHeap())
{
LOG((TL_INFO, "ShutdownAndDeallocateHandleTable destroying heap"));
HeapDestroy (ghTapiHeap);
}
else
{
LOG((TL_INFO, "ShutdownAndDeallocateHandleTable not destroyng current heap -- used process's heap"));
}
//
// in any case, loose reference to the heap.
//
ghTapiHeap = NULL;
LOG((TL_INFO, "ShutdownAndDeallocateHandleTable - succeeded"));
return S_OK;
}
IGlobalInterfaceTable * gpGIT = NULL;
LONG
WINAPI
AllocClientResources(
DWORD dwErrorClass
);
extern HRESULT mapTAPIErrorCode(long lErrorCode);
/////////////////////////////////////////////////////////////////////////////
// CTAPI
//
// Static data members
TAPIObjectArrayNR CTAPI::m_sTAPIObjectArray;
extern HANDLE ghTapiInitShutdownSerializeMutex;
extern ULONG_PTR GenerateHandleAndAddToHashTable( ULONG_PTR Element);
extern void RemoveHandleFromHashTable(ULONG_PTR dwHandle);
extern CHashTable * gpHandleHashTable;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// CTAPI::ReleaseGIT
//
// releases Global Interface Table
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
void CTAPI::ReleaseGIT()
{
EnterCriticalSection( &gcsGlobalInterfaceTable );
if ( NULL != gpGIT )
{
LOG((TL_TRACE, "Shutdown - release GIT"));
gpGIT->Release();
gpGIT = NULL;
}
LeaveCriticalSection( &gcsGlobalInterfaceTable );
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// CTAPI::AllocateInitializeAllCaches
//
// allocates and initializes cache objects (address, line, phone).
//
// returns S_OK on success or E_OUTOFMEMORY on failure
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
HRESULT CTAPI::AllocateInitializeAllCaches()
{
LOG((TL_TRACE, "AllocateInitializeAllCaches - enter"));
//
// all caches already initialized?
//
if ( (NULL != m_pAddressCapCache) &&
(NULL != m_pLineCapCache) &&
(NULL != m_pPhoneCapCache) )
{
LOG((TL_TRACE, "AllocateInitializeAllCaches - already initialized. nothing to do"));
return S_OK;
}
//
// only some caches are initialized? that's a bug!
//
if ( (NULL != m_pAddressCapCache) ||
(NULL != m_pLineCapCache) ||
(NULL != m_pPhoneCapCache) )
{
LOG((TL_ERROR, "AllocateInitializeAllCaches - already initialized"));
_ASSERTE(FALSE);
//
// we could try to complete cleanup and continue, but this would be too
// risky since we don't really know how we got here to begin with.
// simply failing is much safer.
//
return E_UNEXPECTED;
}
////////////////////////
//
// allocate address cache
//
try
{
m_pAddressCapCache = new CStructCache;
}
catch(...)
{
// Initialize critical section in the constructor most likely threw this exception
LOG((TL_ERROR, "AllocateInitializeAllCaches - m_pAddressCapCache constructor threw an exception"));
m_pAddressCapCache = NULL;
}
if (NULL == m_pAddressCapCache)
{
LOG((TL_ERROR, "AllocateInitializeAllCaches - failed to allocate m_pAddressCapCache"));
FreeAllCaches();
return E_OUTOFMEMORY;
}
//
// attempt to initialize address cache
//
HRESULT hr = m_pAddressCapCache->Initialize(5,
sizeof(LINEADDRESSCAPS) + 500,
BUFFERTYPE_ADDRCAP
);
if (FAILED(hr))
{
LOG((TL_ERROR, "AllocateInitializeAllCaches - failed to initialize m_pAddressCapCache. hr = %lx", hr));
FreeAllCaches();
return hr;
}
////////////////////////
//
// allocate line cache
//
try
{
m_pLineCapCache = new CStructCache;
}
catch(...)
{
// Initialize critical section in the constructor most likely threw this exception
LOG((TL_ERROR, "AllocateInitializeAllCaches - m_pLineCapCache constructor threw an exception"));
m_pLineCapCache = NULL;
}
if (NULL == m_pLineCapCache )
{
LOG((TL_ERROR, "AllocateInitializeAllCaches - failed to allocate m_pLineCapCache"));
FreeAllCaches();
return E_OUTOFMEMORY;
}
//
// attempt to initialize line cache
//
hr = m_pLineCapCache->Initialize(5,
sizeof(LINEDEVCAPS) + 500,
BUFFERTYPE_LINEDEVCAP
);
if (FAILED(hr))
{
LOG((TL_ERROR, "AllocateInitializeAllCaches - failed to initialize m_pLineCapCache. hr = %lx", hr));
FreeAllCaches();
return hr;
}
////////////////////////
//
// allocate phone cache
//
try
{
m_pPhoneCapCache = new CStructCache;
}
catch(...)
{
// Initialize critical section in the constructor most likely threw this exception
LOG((TL_ERROR, "AllocateInitializeAllCaches - m_pPhoneCapCache constructor threw an exception"));
m_pPhoneCapCache = NULL;
}
//
// succeeded?
//
if (NULL == m_pPhoneCapCache)
{
LOG((TL_ERROR, "AllocateInitializeAllCaches - failed to allocate m_pPhoneCapCache"));
FreeAllCaches();
return E_OUTOFMEMORY;
}
//
// initialize phone cache
//
hr = m_pPhoneCapCache->Initialize(5,
sizeof(PHONECAPS) + 500,
BUFFERTYPE_PHONECAP
);
if (FAILED(hr))
{
LOG((TL_ERROR, "AllocateInitializeAllCaches - failed to initialize m_pPhoneCapCache. hr = %lx", hr));
FreeAllCaches();
return hr;
}
LOG((TL_TRACE, "AllocateInitializeAllCaches - finish"));
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// CTAPI::FreeAllCaches
//
// shuts down and deletes all allocated cache objects (address, line, phone)
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
void CTAPI::FreeAllCaches()
{
LOG((TL_TRACE, "FreeAllCaches - enter"));
//
// Note: it is safe to shutdown a cache that failed initialization or was
// not initialized at all
//
if (NULL != m_pAddressCapCache)
{
LOG((TL_TRACE, "FreeAllCaches - freeing AddressCapCache"));
m_pAddressCapCache->Shutdown();
delete m_pAddressCapCache;
m_pAddressCapCache = NULL;
}
if (NULL != m_pLineCapCache)
{
LOG((TL_TRACE, "FreeAllCaches - freeing LineCapCache"));
m_pLineCapCache->Shutdown();
delete m_pLineCapCache;
m_pLineCapCache = NULL;
}
if (NULL != m_pPhoneCapCache)
{
LOG((TL_TRACE, "FreeAllCaches - freeing PhoneCapCache"));
m_pPhoneCapCache->Shutdown();
delete m_pPhoneCapCache;
m_pPhoneCapCache = NULL;
}
LOG((TL_TRACE, "FreeAllCaches - exit"));
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// CTAPI::Initialize
//
// Intialize the TAPI object
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
HRESULT
STDMETHODCALLTYPE
CTAPI::Initialize(
void
)
{
HRESULT hr;
int tapiObjectArraySize=0;
LOG((TL_TRACE, "Initialize[%p] enter", this ));
//Serialize the Init and Shutdown code
WaitForSingleObject( ghTapiInitShutdownSerializeMutex, INFINITE );
//
// if we're already initialized
// just return
//
Lock();
if ( m_dwFlags & TAPIFLAG_INITIALIZED )
{
LOG((TL_TRACE, "Already initialized - return S_FALSE"));
Unlock();
ReleaseMutex( ghTapiInitShutdownSerializeMutex );
return S_FALSE;
}
//
// start up TAPI if we haven't already
//
EnterCriticalSection( &gcsTapiObjectArray );
tapiObjectArraySize = m_sTAPIObjectArray.GetSize();
LeaveCriticalSection ( &gcsTapiObjectArray );
if ( 0 == tapiObjectArraySize )
{
//
// create handle table
//
hr = AllocateAndInitializeHandleTable();
if (FAILED(hr))
{
LOG((TL_ERROR, "Initialize failed to create handle table"));
Unlock();
ReleaseMutex( ghTapiInitShutdownSerializeMutex );
return hr;
}
hr = mapTAPIErrorCode( AllocClientResources (1) );
if ( 0 != hr )
{
LOG((TL_ERROR, "AllocClientResources failed - %lx", hr));
ShutdownAndDeallocateHandleTable();
Unlock();
ReleaseMutex( ghTapiInitShutdownSerializeMutex );
return hr;
}
EnterCriticalSection( &gcsGlobalInterfaceTable );
//
// get/create the global interface table
//
hr = CoCreateInstance(
CLSID_StdGlobalInterfaceTable,
NULL,
CLSCTX_INPROC_SERVER,
IID_IGlobalInterfaceTable,
(void **)&gpGIT
);
LeaveCriticalSection( &gcsGlobalInterfaceTable );
if ( !SUCCEEDED(hr) )
{
LOG((TL_ERROR, "Initialize - cocreate git failed - %lx", hr));
ShutdownAndDeallocateHandleTable();
Unlock();
ReleaseMutex( ghTapiInitShutdownSerializeMutex );
return hr;
}
}
//
// allocate and initialize all caches
//
// note: if something fails in Initialize later on, we don't really need
// to clean caches in initialize itself, because the caches will be freed
// in CTAPI::FinalRelease when the tapi object is destroyed.
//
hr = AllocateInitializeAllCaches();
if ( FAILED(hr))
{
LOG((TL_ERROR, "Initialize - failed to create and initialize caches"));
if ( 0 == tapiObjectArraySize )
{
EnterCriticalSection( &gcsGlobalInterfaceTable );
if ( NULL != gpGIT )
{
LOG((TL_TRACE, "Shutdown - release GIT"));
gpGIT->Release();
gpGIT = NULL;
}
LeaveCriticalSection( &gcsGlobalInterfaceTable );
ShutdownAndDeallocateHandleTable();
}
Unlock();
ReleaseMutex( ghTapiInitShutdownSerializeMutex );
return E_OUTOFMEMORY;
}
//
// Call LineInitialize
//
hr = NewInitialize();
if (S_OK != hr)
{
LOG((TL_ERROR, "Initialize - NewInitialize returned %lx", hr));
if ( 0 == tapiObjectArraySize )
{
EnterCriticalSection( &gcsGlobalInterfaceTable );
if ( NULL != gpGIT )
{
LOG((TL_TRACE, "Shutdown - release GIT"));
gpGIT->Release();
gpGIT = NULL;
}
LeaveCriticalSection( &gcsGlobalInterfaceTable );
ShutdownAndDeallocateHandleTable();
}
FreeAllCaches();
Unlock();
ReleaseMutex( ghTapiInitShutdownSerializeMutex );
return hr;
}
//
// create the address objects
//
hr = CreateAllAddressesOnAllLines();
if (S_OK != hr)
{
LOG((TL_INFO, "Initialize - CreateAddresses returned %lx", hr));
NewShutdown();
if ( 0 == tapiObjectArraySize )
{
EnterCriticalSection( &gcsGlobalInterfaceTable );
if ( NULL != gpGIT )
{
LOG((TL_TRACE, "Shutdown - release GIT"));
gpGIT->Release();
gpGIT = NULL;
}
LeaveCriticalSection( &gcsGlobalInterfaceTable );
ShutdownAndDeallocateHandleTable();
}
FreeAllCaches();
Unlock();
ReleaseMutex( ghTapiInitShutdownSerializeMutex );
return hr;
}
//
// create the phone objects
//
hr = CreateAllPhones();
if (S_OK != hr)
{
LOG((TL_INFO, "Initialize - CreateAllPhones returned %lx", hr));
NewShutdown();
m_AddressArray.Shutdown ();
if ( 0 == tapiObjectArraySize )
{
EnterCriticalSection( &gcsGlobalInterfaceTable );
if ( NULL != gpGIT )
{
LOG((TL_TRACE, "Shutdown - release GIT"));
gpGIT->Release();
gpGIT = NULL;
}
LeaveCriticalSection( &gcsGlobalInterfaceTable );
ShutdownAndDeallocateHandleTable();
}
FreeAllCaches();
Unlock();
ReleaseMutex( ghTapiInitShutdownSerializeMutex );
return hr;
}
//
// create the connectionpoint object
//
CComObject< CTAPIConnectionPoint > * p;
hr = CComObject< CTAPIConnectionPoint >::CreateInstance( &p );
if ( FAILED(hr) )
{
LOG((TL_ERROR, "new CTAPIConnectionPoint failed"));
NewShutdown();
m_AddressArray.Shutdown ();
m_PhoneArray.Shutdown ();
if ( 0 == tapiObjectArraySize )
{
EnterCriticalSection( &gcsGlobalInterfaceTable );
if ( NULL != gpGIT )
{
LOG((TL_TRACE, "Shutdown - release GIT"));
gpGIT->Release();
gpGIT = NULL;
}
LeaveCriticalSection( &gcsGlobalInterfaceTable );
ShutdownAndDeallocateHandleTable();
}
FreeAllCaches();
Unlock();
ReleaseMutex( ghTapiInitShutdownSerializeMutex );
return hr;
}
//
// init the connection point
//
hr = p->Initialize(
(IConnectionPointContainer *)this,
IID_ITTAPIEventNotification
);
if ( FAILED(hr) )
{
LOG((TL_ERROR, "initialize CTAPIConnectionPoint failed"));
delete p;
NewShutdown();
m_AddressArray.Shutdown ();
m_PhoneArray.Shutdown ();
if ( 0 == tapiObjectArraySize )
{
EnterCriticalSection( &gcsGlobalInterfaceTable );
if ( NULL != gpGIT )
{
LOG((TL_TRACE, "Shutdown - release GIT"));
gpGIT->Release();
gpGIT = NULL;
}
LeaveCriticalSection( &gcsGlobalInterfaceTable );
ShutdownAndDeallocateHandleTable();
}
FreeAllCaches();
Unlock();
ReleaseMutex( ghTapiInitShutdownSerializeMutex );
return hr;
}
m_pCP = p;
//
// this object is initialized
//
m_dwFlags = TAPIFLAG_INITIALIZED;
//
// save object in global list
//
CTAPI * pTapi = this;
EnterCriticalSection( &gcsTapiObjectArray );
m_sTAPIObjectArray.Add( pTapi );
// Set the event filter mask
// Always ask for
// TE_CALLSTATE,
// TE_CALLNOTIFICATION,
// TE_PHONEVENET,
// TE_CALLHUB,
// TE_CALLINFOCHANGE
// events. These events are used internally by Tapi3
ULONG64 ulMask =
EM_LINE_CALLSTATE | // TE_CALLSTATE
EM_LINE_APPNEWCALL | // TE_CALLNOTIFICATION
EM_PHONE_CLOSE | // TE_PHONEEVENT
EM_PHONE_STATE | // TE_PHONEEVENT
EM_PHONE_BUTTONMODE | // TE_PHONEEVENT
EM_PHONE_BUTTONSTATE | // TE_PHONEVENT
EM_LINE_APPNEWCALLHUB | // TE_CALLHUB
EM_LINE_CALLHUBCLOSE | // TE_CALLHUB
EM_LINE_CALLINFO | // TE_CALLINFOCHANGE
EM_LINE_CREATE | // TE_TAPIOBJECT
EM_LINE_REMOVE | // TE_TAPIOBJECT
EM_LINE_CLOSE | // TE_TAPIOBJECT
EM_PHONE_CREATE | // TE_TAPIOBJECT
EM_PHONE_REMOVE | // TE_TAPIOBJECT
EM_LINE_DEVSPECIFICEX | // TE_ADDRESSDEVSPECIFIC
EM_LINE_DEVSPECIFIC | // TE_ADDRESSDEVSPECIFIC
EM_PHONE_DEVSPECIFIC; // TE_PHONEDEVSPECIFIC
DWORD dwLineDevStateSubMasks =
LINEDEVSTATE_REINIT | // TE_TAPIOBJECT
LINEDEVSTATE_TRANSLATECHANGE ; // TE_TAPIOBJECT
tapiSetEventFilterMasks (
TAPIOBJ_NULL,
NULL,
ulMask
);
tapiSetEventFilterSubMasks (
TAPIOBJ_NULL,
NULL,
EM_LINE_LINEDEVSTATE,
dwLineDevStateSubMasks
);
LeaveCriticalSection ( &gcsTapiObjectArray );
Unlock();
ReleaseMutex( ghTapiInitShutdownSerializeMutex );
LOG((TL_TRACE, "Initialize exit - return SUCCESS"));
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// CTAPI::get_Addresses
//
// Creates & returns the collection of address objects
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
HRESULT
STDMETHODCALLTYPE
CTAPI::get_Addresses(VARIANT * pVariant)
{
LOG((TL_TRACE, "get_Addresses enter"));
LOG((TL_TRACE, " pVariant ------->%p", pVariant));
HRESULT hr;
IDispatch * pDisp;
Lock();
if (!( m_dwFlags & TAPIFLAG_INITIALIZED ) )
{
LOG((TL_ERROR, "get_Addresses - tapi object must be initialized first" ));
Unlock();
return E_INVALIDARG;
}
Unlock();
if (TAPIIsBadWritePtr( pVariant, sizeof (VARIANT) ) )
{
LOG((TL_ERROR, "get_Addresses - bad pointer"));
return E_POINTER;
}
CComObject< CTapiCollection< ITAddress > > * p;
CComObject< CTapiCollection< ITAddress > >::CreateInstance( &p );
if (NULL == p)
{
LOG((TL_ERROR, "get_Addresses - could not create collection" ));
return E_OUTOFMEMORY;
}
Lock();
// initialize
hr = p->Initialize( m_AddressArray );
Unlock();
if (S_OK != hr)
{
LOG((TL_ERROR, "get_Addresses - could not initialize collection" ));
delete p;
return hr;
}
// get the IDispatch interface
hr = p->_InternalQueryInterface( IID_IDispatch, (void **) &pDisp );
if (S_OK != hr)
{
LOG((TL_ERROR, "get_Addresses - could not get IDispatch interface" ));
delete p;
return hr;
}
// put it in the variant
VariantInit(pVariant);
pVariant->vt = VT_DISPATCH;
pVariant->pdispVal = pDisp;
LOG((TL_TRACE, "get_Addressess exit - return %lx", hr ));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// CTAPI::EnumerateAddresses
//
// Create & return an address enumerator
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
HRESULT
STDMETHODCALLTYPE
CTAPI::EnumerateAddresses(
IEnumAddress ** ppEnumAddresses
)
{
HRESULT hr = S_OK;
CComObject< CTapiEnum<IEnumAddress, ITAddress, &IID_IEnumAddress> > * pEnum;
LOG((TL_TRACE, "EnumerateAddresses enter"));
Lock();
if (!( m_dwFlags & TAPIFLAG_INITIALIZED ))
{
LOG((TL_ERROR, "EnumerateAddresses - tapi object must be initialized first" ));
Unlock();
return TAPI_E_REINIT;
}
Unlock();
if ( TAPIIsBadWritePtr( ppEnumAddresses, sizeof (IEnumAddress *) ) )
{
LOG((TL_ERROR, "EnumerateAddresses - bad pointer"));
return E_POINTER;
}
// create the object
hr = CComObject< CTapiEnum<IEnumAddress, ITAddress, &IID_IEnumAddress> >::CreateInstance( &pEnum );
if (S_OK != hr)
{
LOG((TL_ERROR, "EnumerateAddresses - could not create enum - return %lx", hr));
return hr;
}
// initialize
Lock();
hr = pEnum->Initialize( m_AddressArray );
Unlock();
if (S_OK != hr)
{
pEnum->Release();
LOG((TL_ERROR, "EnumerateAddresses - could not initialize enum - return %lx", hr));
return hr;
}
*ppEnumAddresses = pEnum;
LOG((TL_TRACE, "EnumerateAddresses exit - return %lx", hr));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// CTAPI::GetPhoneArray
//
// Fill a phone array. The array will have references to all
// of the phone objects it contains.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
HRESULT
CTAPI::GetPhoneArray(
PhoneArray *pPhoneArray
)
{
HRESULT hr = S_OK;
LOG((TL_TRACE, "GetPhoneArray enter"));
Lock();
if (!( m_dwFlags & TAPIFLAG_INITIALIZED ))
{
LOG((TL_ERROR, "GetPhoneArray - tapi object must be initialized first" ));
Unlock();
return E_INVALIDARG;
}
Unlock();
if ( IsBadReadPtr( pPhoneArray, sizeof (PhoneArray) ) )
{
LOG((TL_ERROR, "GetPhoneArray - bad pointer"));
return E_POINTER;
}
Lock();
// initialize the array
for(int iCount = 0; iCount < m_PhoneArray.GetSize(); iCount++)
{
pPhoneArray->Add(m_PhoneArray[iCount]);
}
Unlock();
LOG((TL_TRACE, "GetPhoneArray exit - return %lx", hr));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// CTAPI::RegisterCallHubNotifications
//
// This method is used to tell TAPI that the application is interested in
// receiving callhub events.
//
// RETURNS
//
// S_OK
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HRESULT
STDMETHODCALLTYPE
CTAPI::RegisterCallHubNotifications(
VARIANT_BOOL bNotify
)
{
LOG((TL_TRACE, "RegisterCallHubNotifications - enter"));
Lock();
if (!( m_dwFlags & TAPIFLAG_INITIALIZED ))
{
LOG((TL_ERROR, "RCHN - tapi object must be initialized first" ));
Unlock();
return E_INVALIDARG;
}
if ( bNotify )
{
LOG((TL_INFO, "RCHN - callhub notify on"));
m_dwFlags |= TAPIFLAG_CALLHUBNOTIFY;
}
else
{
LOG((TL_INFO, "RCHN - callhub notify off"));
m_dwFlags &= ~TAPIFLAG_CALLHUBNOTIFY;
}
Unlock();
LOG((TL_TRACE, "RegisterCallHubNotifications - exit - success"));
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// SetCallHubTracking
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HRESULT
CTAPI::SetCallHubTracking(
VARIANT pAddresses,
VARIANT_BOOL bSet
)
{
HRESULT hr = S_OK;
SAFEARRAY * pAddressArray;
LONG llBound, luBound;
int iCount;
LOG((TL_TRACE, "SetCallHubTracking - enter"));
Lock();
if (!( m_dwFlags & TAPIFLAG_INITIALIZED ))
{
LOG((TL_ERROR, "SCHT - tapi object must be initialized first" ));
Unlock();
return E_INVALIDARG;
}
Unlock();
hr = VerifyAndGetArrayBounds(
pAddresses,
&pAddressArray,
&llBound,
&luBound
);
if (!SUCCEEDED(hr))
{
LOG((TL_ERROR, "SCHT - invalid address array - return %lx", hr));
return hr;
}
//
// all addresses
//
if (NULL == pAddressArray)
{
Lock();
//
// go through all the addresses
//
for (iCount = 0; iCount < m_AddressArray.GetSize(); iCount++ )
{
CAddress * pCAddress;
//
// register
//
pCAddress = dynamic_cast<CAddress *>(m_AddressArray[iCount]);
if (NULL == pCAddress)
{
LOG((TL_ERROR, "SCHT - out of memory"));
Unlock();
return E_OUTOFMEMORY;
}
hr = (pCAddress)->SetCallHubTracking( bSet );
if (!SUCCEEDED(hr))
{
LOG((TL_WARN,
"SCHT failed %lx on address %lx",
hr,
iCount
));
}
}
m_dwFlags |= TAPIFLAG_ALLCALLHUBTRACKING;
Unlock();
return S_OK;
}
//
// if here, only registering addresses
// from array
//
// go through array
//
for ( ; llBound <=luBound; llBound++ )
{
ITAddress * pAddress;
CAddress * pCAddress;
hr = SafeArrayGetElement(
pAddressArray,
&llBound,
&pAddress
);
if ( (!SUCCEEDED(hr)) || (NULL == pAddress) )
{
continue;
}
pCAddress = dynamic_cast<CAddress *>(pAddress);
hr = pCAddress->SetCallHubTracking( bSet );
//
// safearragetelement addrefs
//
pAddress->Release();
if (!SUCCEEDED(hr))
{
LOG((
TL_WARN,
"SCHT failed %lx on address %p",
hr,
pAddress
));
return hr;
}
}
LOG((TL_TRACE, "SetCallHubTracking - exit - success"));
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// CTAPI::RegisterCallNotifications
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HRESULT
STDMETHODCALLTYPE
CTAPI::RegisterCallNotifications(
ITAddress * pAddress,
VARIANT_BOOL fMonitor,
VARIANT_BOOL fOwner,
long lMediaTypes,
long lCallbackInstance,
long * plRegister
)
{
HRESULT hr = S_OK;
PVOID pRegister;
DWORD dwMediaModes = 0, dwPrivs = 0;
REGISTERITEM * pRegisterItem;
CAddress * pCAddress;
LOG((TL_TRACE, "RegisterCallNotifications - enter"));
Lock();
if (!( m_dwFlags & TAPIFLAG_INITIALIZED ))
{
LOG((TL_ERROR, "RegisterCallNotifications - tapi object must be initialized first" ));
Unlock();
return E_INVALIDARG;
}
Unlock();
if (TAPIIsBadWritePtr( plRegister, sizeof(long) ) )
{
LOG((TL_ERROR, "RegisterCallNotifications - invalid plRegister"));
return E_POINTER;
}
try
{
pCAddress = dynamic_cast<CAddress *>(pAddress);
}
catch(...)
{
hr = E_POINTER;
}
if ( ( NULL == pCAddress ) || !SUCCEEDED(hr) )
{
LOG((TL_ERROR, "RegisterCallNotifications - bad address"));
return E_POINTER;
}
//
// determine the privileges
//
if (fOwner)
{
dwPrivs |= LINECALLPRIVILEGE_OWNER;
}
if (fMonitor)
{
dwPrivs |= LINECALLPRIVILEGE_MONITOR;
}
if ( 0 == dwPrivs )
{
LOG((TL_ERROR, "RegisterCallNotifications - fMonitor and/or fOwner must be true"));
return E_INVALIDARG;
}
if (! (pCAddress->GetMediaMode(
lMediaTypes,
&dwMediaModes
) ) )
{
LOG((TL_ERROR, "RegisterCallNotifications - bad mediamodes"));
return E_INVALIDARG;
}
Lock();
pRegisterItem = (REGISTERITEM *)ClientAlloc( sizeof(REGISTERITEM) );
if ( NULL == pRegisterItem )
{
LOG((TL_ERROR, "RegisterCallNotifications - Alloc registrationarray failed"));
Unlock();
return E_OUTOFMEMORY;
}
hr = pCAddress->AddCallNotification(
dwPrivs,
dwMediaModes,
lCallbackInstance,
&pRegister
);
if (!SUCCEEDED(hr))
{
LOG((TL_ERROR, "RegisterCallNotifications - AddCallNotification failed"));
ClientFree( pRegisterItem );
Unlock();
return hr;
}
pRegisterItem->dwType = RA_ADDRESS;
pRegisterItem->pInterface = (PVOID)pCAddress;
pRegisterItem->pRegister = pRegister;
try
{
m_RegisterItemPtrList.push_back( (PVOID)pRegisterItem );
}
catch(...)
{
hr = E_OUTOFMEMORY;
LOG((TL_ERROR, "RegisterCallNotifications- failed - because of alloc failure"));
ClientFree( pRegisterItem );
}
#if DBG
if (m_dwEventFilterMask == 0)
{
LOG((TL_WARN, "RegisterCallNotifications - no Event Mask set !!!"));
}
#endif
Unlock();
//
// return registration cookie
//
if( S_OK == hr )
{
//
// create a 32-bit handle for the RegisterItem pointer
//
DWORD dwCookie = CreateHandleTableEntry((ULONG_PTR)pRegisterItem);
if (0 == dwCookie)
{
hr = E_OUTOFMEMORY;
LOG((TL_ERROR, "RegisterCallNotifications - failed to create a handle for REGISTERITEM object %p", pRegisterItem));
}
else
{
LOG((TL_INFO,
"RegisterCallNotifications - Mapped handle %lx (to be returned as cookie) to REGISTERITEM object %p",
dwCookie, pRegisterItem ));
// register the cookie with the address object, so address can remove it if
// the address is deallocated before the call to CTAPI::UnregisterNotifications
pCAddress->RegisterNotificationCookie(dwCookie);
*plRegister = dwCookie;
}
}
LOG((TL_TRACE, "RegisterCallNotifications - return %lx", hr));
return hr;
}
STDMETHODIMP
CTAPI::UnregisterNotifications(
long ulRegister
)
{
DWORD dwType;
HRESULT hr = S_OK;
REGISTERITEM * pRegisterItem = NULL;
LOG((TL_TRACE, "UnregisterNotifications - enter. Cookie %lx", ulRegister));
Lock();
if (!( m_dwFlags & TAPIFLAG_INITIALIZED ))
{
LOG((TL_ERROR, "UnregNot - tapi object must be initialized first" ));
Unlock();
return E_INVALIDARG;
}
//
// convert cookie to registration object pointer
//
pRegisterItem = (REGISTERITEM*) GetHandleTableEntry(ulRegister);
//
// remove cookie from the table
//
DeleteHandleTableEntry(ulRegister);
Unlock();
if ( NULL != pRegisterItem )
{
LOG((TL_INFO, "UnregisterNotifications - Matched cookie %lx to REGISTERITEM object %p", ulRegister, pRegisterItem ));
if (IsBadReadPtr( pRegisterItem, sizeof(REGISTERITEM) ) )
{
LOG((TL_ERROR, "UnregNot - invalid pRegisterItem returned from the handle table search"));
return E_POINTER;
}
}
else
{
LOG((TL_WARN, "UnregisterNotifications - invalid lRegister"));
return E_INVALIDARG;
}
dwType = pRegisterItem->dwType;
//
// switch on the type of notification
//
switch ( dwType )
{
case RA_ADDRESS:
CAddress * pCAddress;
ITAddress * pAddress;
pCAddress = (CAddress *) (pRegisterItem->pInterface);
//
// try to get the address
//
try
{
hr = pCAddress->QueryInterface(
IID_ITAddress,
(void **)&pAddress
);
}
catch(...)
{
hr = E_POINTER;
}
if ( !SUCCEEDED(hr) )
{
LOG((TL_ERROR, "Invalid interface in unregisternotifications"));
return hr;
}
//
// tell the address
//
pCAddress->RemoveCallNotification( pRegisterItem->pRegister );
//
// tell the address to remove a cookie from its list
//
pCAddress->RemoveNotificationCookie(ulRegister);
pAddress->Release();
Lock();
//
// remove array from our list
//
m_RegisterItemPtrList.remove( pRegisterItem );
Unlock();
//
// free structure
//
ClientFree( pRegisterItem );
break;
case RA_CALLHUB:
break;
}
LOG((TL_TRACE, "UnregisterNotifications - exit - success"));
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP
CTAPI::get_CallHubs(
VARIANT * pVariant
)
{
LOG((TL_TRACE, "get_CallHubs enter"));
LOG((TL_TRACE, " pVariant ------->%p", pVariant));
HRESULT hr;
IDispatch * pDisp;
Lock();
if (!( m_dwFlags & TAPIFLAG_INITIALIZED ) )
{
LOG((TL_ERROR, "get_CallHubs - tapi object must be initialized first" ));
Unlock();
return E_INVALIDARG;
}
Unlock();
if ( TAPIIsBadWritePtr( pVariant, sizeof(VARIANT) ) )
{
LOG((TL_ERROR, "get_CallHubs - bad pointer"));
return E_POINTER;
}
CComObject< CTapiCollection< ITCallHub > > * p;
CComObject< CTapiCollection< ITCallHub > >::CreateInstance( &p );
if (NULL == p)
{
LOG((TL_ERROR, "get_CallHubs - could not create collection" ));
return E_OUTOFMEMORY;
}
Lock();
//
// initialize
//
hr = p->Initialize( m_CallHubArray );
Unlock();
if (S_OK != hr)
{
LOG((TL_ERROR, "get_CallHubs - could not initialize collection" ));
delete p;
return hr;
}
//
// get the IDispatch interface
//
hr = p->_InternalQueryInterface( IID_IDispatch, (void **) &pDisp );
if (S_OK != hr)
{
LOG((TL_ERROR, "get_CallHubs - could not get IDispatch interface" ));
delete p;
return hr;
}
//
// put it in the variant
//
VariantInit(pVariant);
pVariant->vt = VT_DISPATCH;
pVariant->pdispVal = pDisp;
LOG((TL_TRACE, "get_CallHubss exit - return %lx", hr ));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// EnumerateCallHubs
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP
CTAPI::EnumerateCallHubs(
IEnumCallHub ** ppEnumCallHub
)
{
HRESULT hr = S_OK;
CComObject< CTapiEnum<IEnumCallHub, ITCallHub, &IID_IEnumCallHub> > * pEnum;
LOG((TL_TRACE, "EnumerateCallHubs enter"));
Lock();
if (!( m_dwFlags & TAPIFLAG_INITIALIZED ))
{
LOG((TL_ERROR, "EnumerateCallHubs - tapi object must be initialized first" ));
Unlock();
return E_INVALIDARG;
}
Unlock();
if ( TAPIIsBadWritePtr( ppEnumCallHub, sizeof( IEnumCallHub *) ) )
{
LOG((TL_ERROR, "EnumerateCallHubs - bad pointer"));
return E_POINTER;
}
//
// create the object
//
hr = CComObject< CTapiEnum<IEnumCallHub, ITCallHub, &IID_IEnumCallHub> >::CreateInstance( &pEnum );
if (S_OK != hr)
{
LOG((TL_ERROR, "EnumerateCallHubs - could not create enum - return %lx", hr));
return hr;
}
//
// initialize
//
Lock();
hr = pEnum->Initialize( m_CallHubArray );
Unlock();
if (S_OK != hr)
{
pEnum->Release();
LOG((TL_ERROR, "EnumerateCallHubs - could not initialize enum - return %lx", hr));
return hr;
}
*ppEnumCallHub = pEnum;
LOG((TL_TRACE, "EnumerateCallHubs exit - return %lx", hr));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// CTAPI::EnumConnectionPoints
//
// Standard IConnectionPoint method
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
HRESULT
__stdcall
CTAPI::EnumConnectionPoints(
IEnumConnectionPoints **ppEnum
)
{
HRESULT hr;
LOG((TL_TRACE, "EnumConnectionPoints enter"));
hr = E_NOTIMPL;
LOG((TL_TRACE, "EnumConnectionPointer exit - return %lx", hr));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// FindConnectionPoint
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HRESULT
__stdcall
CTAPI::FindConnectionPoint(
REFIID riid,
IConnectionPoint **ppCP
)
{
LOG((TL_TRACE, "FindConnectionPoint enter"));
#if DBG
{
WCHAR guidName[100];
StringFromGUID2(riid, (LPOLESTR)&guidName, 100);
LOG((TL_INFO, "FindConnectionPoint - RIID : %S", guidName));
}
#endif
Lock();
if (!( m_dwFlags & TAPIFLAG_INITIALIZED ))
{
LOG((TL_ERROR, "FindConnectionPoint - tapi object must be initialized first" ));
Unlock();
return TAPI_E_NOT_INITIALIZED;
}
Unlock();
if ( TAPIIsBadWritePtr( ppCP, sizeof(IConnectionPoint *) ) )
{
LOG((TL_ERROR, "FindConnectionPoint - bad pointer"));
return E_POINTER;
}
//
// is this the right interface?
//
if ( (IID_ITTAPIEventNotification != riid ) && (DIID_ITTAPIDispatchEventNotification != riid ) )
{
* ppCP = NULL;
LOG((TL_ERROR, "FindConnectionPoint - do not support this riid"));
return CONNECT_E_NOCONNECTION;
}
//
// if it's the right interface, create a new connection point
// and return it
//
Lock();
*ppCP = m_pCP;
(*ppCP)->AddRef();
Unlock();
//
// success
//
LOG((TL_TRACE, "FindConnectionPoint - Success"));
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// CreateAllAddressesOnAllLines
// This is called when the first TAPI object is created.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HRESULT
CTAPI::CreateAllAddressesOnAllLines(
void
)
{
DWORD dwCount;
LOG((TL_TRACE, "CreateAllAddressesOnAllLines enter"));
Lock();
// go through all line devs
for (dwCount = 0; dwCount < m_dwLineDevs; dwCount++)
{
CreateAddressesOnSingleLine( dwCount, FALSE );
}
Unlock();
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// CreateAddressesOnSingleLine
//
// assumed called in lock!
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HRESULT
CTAPI::CreateAddressesOnSingleLine( DWORD dwDeviceID, BOOL bFireEvent )
{
DWORD dwRealAddresses = 0, dwAddress;
DWORD dwAPIVersion;
HRESULT hr;
LPLINEDEVCAPS pDevCaps = NULL;
LPLINEADDRESSCAPS pAddressCaps = NULL;
LOG((TL_TRACE, "CreateAddressesOnSingleLine: entered."));
hr = LineNegotiateAPIVersion(
(HLINEAPP)m_dwLineInitDataHandle,
dwDeviceID,
&dwAPIVersion
);
if (S_OK != hr)
{
LOG((TL_WARN, "CreateAddressesOnSingleLine: LineNegotiateAPIVersion failed on device %d", dwDeviceID));
return hr;
}
LOG((TL_INFO, "CreateAddressesOnSingleLine: LineNegotiateAPIVersion returned version %lx", dwAPIVersion));
hr = LineGetDevCapsWithAlloc(
(HLINEAPP)m_dwLineInitDataHandle,
dwDeviceID,
dwAPIVersion,
&pDevCaps
);
if (S_OK != hr)
{
LOG((TL_WARN, "CreateAddressesOnSingleLine: LineGetDevCaps failed for device %d", dwDeviceID));
if ( NULL != pDevCaps )
{
ClientFree( pDevCaps );
}
return hr;
}
if (pDevCaps->dwNumAddresses == 0)
{
LOG((TL_WARN, "CreateAddressesOnSingleLine: Device %d has no addressess - will assume 1 address", dwDeviceID));
pDevCaps->dwNumAddresses = 1;
}
LPVARSTRING pVarString;
DWORD dwProviderID;
//
// get the permanent provider ID for this line.
//
hr = LineGetID(
NULL,
dwDeviceID,
NULL,
LINECALLSELECT_DEVICEID,
&pVarString,
L"tapi/providerid"
);
if (S_OK != hr)
{
if (NULL != pVarString)
{
ClientFree( pVarString);
}
if ( NULL != pDevCaps )
{
ClientFree( pDevCaps );
}
LOG((TL_ERROR, "CreateAddressesOnSingleLine: get_ServiceProviderName - LineGetID returned %lx", hr ));
return hr;
}
//
// get the id DWORD at the end of the structure
//
dwProviderID = *((LPDWORD) (((LPBYTE) pVarString) + pVarString->dwStringOffset));
ClientFree( pVarString );
// go through all the addresses on each line, and
// create an address object.
for (dwAddress = 0; dwAddress < pDevCaps->dwNumAddresses; dwAddress++)
{
CComObject<CAddress> * pAddress;
ITAddress * pITAddress;
try
{
hr = CComObject<CAddress>::CreateInstance( &pAddress );
}
catch(...)
{
LOG((TL_ERROR, "CreateAddressesOnSingleLine: CreateInstance - Address - threw"));
continue;
}
if ( !SUCCEEDED(hr) || (NULL == pAddress) )
{
LOG((TL_ERROR, "CreateAddressesOnSingleLine: CreateInstance - Address - failed - %lx", hr));
continue;
}
//
// initialize the address
// if there are no phone devices,
// give NULL for the hPhoneApp, so the address
// doesn't think that there may be a phone device
//
hr = pAddress->Initialize(
this,
(HLINEAPP)m_dwLineInitDataHandle,
#ifdef USE_PHONEMSP
(m_dwPhoneDevs)?((HPHONEAPP)m_dwPhoneInitDataHandle):NULL,
#endif USE_PHONEMSP
dwAPIVersion,
dwDeviceID,
dwAddress,
dwProviderID,
pDevCaps,
m_dwEventFilterMask
);
if (S_OK != hr)
{
LOG((TL_ERROR, "CreateAddressesOnSingleLine: failed for device %d, address %d", dwDeviceID, dwAddress));
delete pAddress;
continue;
}
//
// add to list
//
pITAddress = dynamic_cast<ITAddress *>(pAddress);
m_AddressArray.Add( pITAddress );
pAddress->Release();
if ( bFireEvent )
{
CTapiObjectEvent::FireEvent(
this,
TE_ADDRESSCREATE,
pAddress,
0,
NULL
);
}
}
if ( NULL != pDevCaps )
{
ClientFree( pDevCaps );
}
LOG((TL_INFO, "CreateAddressesOnSingleLine: completed."));
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// CreateAllPhones
// This is called when the first TAPI object is created.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HRESULT
CTAPI::CreateAllPhones(
void
)
{
DWORD dwCount;
LOG((TL_TRACE, "CreateAllPhones enter"));
Lock();
// go through all phone devs
for (dwCount = 0; dwCount < m_dwPhoneDevs; dwCount++)
{
CreatePhone( dwCount, FALSE );
}
Unlock();
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// CreatePhone
//
// assumed called in lock!
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HRESULT
CTAPI::CreatePhone( DWORD dwDeviceID, BOOL bFireEvent )
{
DWORD dwAPIVersion;
HRESULT hr;
hr = PhoneNegotiateAPIVersion(
(HPHONEAPP)m_dwPhoneInitDataHandle,
dwDeviceID,
&dwAPIVersion
);
if (S_OK != hr)
{
LOG((TL_WARN, "CreatePhone - phoneNegotiateAPIVersion failed on device %d", dwDeviceID));
return hr;
}
LOG((TL_INFO, "CreatePhone - phoneNegotiateAPIVersion returned version %lx", dwAPIVersion));
// create a phone object.
CComObject<CPhone> * pPhone;
ITPhone * pITPhone;
__try
{
hr = CComObject<CPhone>::CreateInstance( &pPhone );
}
__except( (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) ?
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH )
{
LOG((TL_ERROR, "CreatePhone - CreateInstancefailed - because of alloc failure"));
return hr;
}
if ( !SUCCEEDED(hr) || (NULL == pPhone) )
{
LOG((TL_ERROR, "CreatePhone - CreateInstance failed - %lx", hr));
return hr;
}
//
// initialize the phone
//
hr = pPhone->Initialize(
this,
(HLINEAPP)m_dwPhoneInitDataHandle,
dwAPIVersion,
dwDeviceID
);
if ( FAILED(hr) )
{
LOG((TL_ERROR, "CreatePhone failed for device %d", dwDeviceID));
delete pPhone;
return hr;
}
//
// add to list
//
pITPhone = dynamic_cast<ITPhone *>(pPhone);
m_PhoneArray.Add( pITPhone );
pPhone->Release();
if ( bFireEvent )
{
CTapiObjectEvent::FireEvent(this,
TE_PHONECREATE,
NULL,
0,
pITPhone
);
}
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// Shutdown
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
HRESULT
STDMETHODCALLTYPE
CTAPI::Shutdown()
{
PtrList::iterator iter, end;
int iCount;
DWORD dwSignalled;
int tapiObjectArraySize=0;
CTAPI *pTapi;
LOG((TL_TRACE, "Shutdown[%p] - enter", this));
LOG((TL_TRACE, "Shutdown - enter"));
CoWaitForMultipleHandles (0,
INFINITE,
1,
&ghTapiInitShutdownSerializeMutex,
&dwSignalled
);
Lock();
if ( (!( m_dwFlags & TAPIFLAG_INITIALIZED )) &&
(!( m_dwFlags & TAPIFLAG_REINIT)))
{
LOG((TL_WARN, "Shutdown - already shutdown - return S_FALSE"));
Unlock();
ReleaseMutex( ghTapiInitShutdownSerializeMutex );
return S_FALSE;
}
m_dwFlags &= ~TAPIFLAG_INITIALIZED;
m_dwFlags &= ~TAPIFLAG_REINIT;
pTapi = this;
//
// close all the phones
//
for(iCount = 0; iCount < m_PhoneArray.GetSize(); iCount++)
{
CPhone *pCPhone = NULL;
try
{
pCPhone = dynamic_cast<CPhone *>(m_PhoneArray[iCount]);
}
catch(...)
{
LOG((TL_ERROR, "Shutdown - phone array contains a bad phone pointer"));
pCPhone = NULL;
}
if (NULL != pCPhone)
{
pCPhone->ForceClose();
}
}
EnterCriticalSection( &gcsTapiObjectArray );
m_sTAPIObjectArray.Remove ( pTapi );
tapiObjectArraySize = m_sTAPIObjectArray.GetSize();
LeaveCriticalSection ( &gcsTapiObjectArray );
m_AgentHandlerArray.Shutdown();
gpLineHashTable->Flush(this);
gpCallHashTable->Flush(this);
gpCallHubHashTable->Flush(this);
gpPhoneHashTable->Flush(this);
//
// tell each address in the array that it is time to toss all
// the cookies
//
int nAddressArraySize = m_AddressArray.GetSize();
for (int i = 0; i < nAddressArraySize; i++)
{
//
// we need a pointer to CAddress to unregister cookies
//
CAddress *pAddress = NULL;
//
// in case address array contains a pointer to nonreadable memory,
// do dynamic cast inside try/catch
//
try
{
pAddress = dynamic_cast<CAddress*>(m_AddressArray[i]);
}
catch(...)
{
LOG((TL_ERROR, "Shutdown - address array contains a bad address pointer"));
pAddress = NULL;
}
//
// attempt to unregister address' notifications
//
if (NULL != pAddress)
{
//
// unregister all notification cookies
//
pAddress->UnregisterAllCookies();
//
// notify address that tapi is being shutdown, so it can do
// whatever clean up is necessary
//
pAddress->AddressOnTapiShutdown();
}
else
{
//
// we have an address that is not an address. debug!
//
LOG((TL_ERROR,
"Shutdown - address array contains a bad address pointer."));
_ASSERTE(FALSE);
}
}
m_AddressArray.Shutdown();
m_PhoneArray.Shutdown();
m_CallHubArray.Shutdown();
Unlock();
NewShutdown();
Lock();
if ( NULL != m_pCP )
{
m_pCP->Release();
m_pCP = NULL;
}
iter = m_RegisterItemPtrList.begin();
end = m_RegisterItemPtrList.end();
while (iter != end)
{
ClientFree( *iter );
iter ++;
}
m_RegisterItemPtrList.clear();
Unlock();
if ( 0 == tapiObjectArraySize )
{
FinalTapiCleanup();
EnterCriticalSection( &gcsGlobalInterfaceTable );
ReleaseGIT();
LeaveCriticalSection( &gcsGlobalInterfaceTable );
//
// no longer need handle table.
//
ShutdownAndDeallocateHandleTable();
}
ReleaseMutex( ghTapiInitShutdownSerializeMutex );
LOG((TL_TRACE, "Shutdown - exit"));
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// finalrelease of tapi object
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
void
CTAPI::FinalRelease()
{
LOG((TL_TRACE, "FinalRelease - enter"));
Lock();
FreeAllCaches();
Unlock();
LOG((TL_TRACE, "FinalRelease - exit"));
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// VerifyAndGetArrayBounds
//
// Helper function for variant/safearrays
//
// Array
// IN Variant that contains a safearray
//
// ppsa
// OUT safearray returned here
//
// pllBound
// OUT array lower bound returned here
//
// pluBound
// OUT array upper boudn returned here
//
// RETURNS
//
// verifies that Array contains an array, and returns the array, upper
// and lower bounds.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HRESULT
VerifyAndGetArrayBounds(
VARIANT Array,
SAFEARRAY ** ppsa,
long * pllBound,
long * pluBound
)
{
UINT uDims;
HRESULT hr = S_OK;
//
// see if the variant & safearray are valid
//
try
{
if (!(V_ISARRAY(&Array)))
{
if ( VT_NULL ==Array.vt )
{
//
// null is usually valid
//
*ppsa = NULL;
LOG((TL_INFO, "Returning NULL array"));
return S_FALSE;
}
LOG((TL_ERROR, "Array - not an array"));
return E_INVALIDARG;
}
if ( NULL == Array.parray )
{
//
// null is usually valide
//
*ppsa = NULL;
LOG((TL_INFO, "Returning NULL array"));
return S_FALSE;
}
*ppsa = V_ARRAY(&Array);
uDims = SafeArrayGetDim( *ppsa );
}
catch(...)
{
hr = E_POINTER;
}
if (!SUCCEEDED(hr))
{
LOG((TL_ERROR, "Array - invalid array"));
return hr;
}
//
// verify array
//
if (1 != uDims)
{
if (0 == uDims)
{
LOG((TL_ERROR, "Array - has 0 dim"));
return E_INVALIDARG;
}
else
{
LOG((TL_WARN, "Array - has > 1 dim - will only use 1"));
}
}
//
// Get array bounds
//
SafeArrayGetUBound(
*ppsa,
1,
pluBound
);
SafeArrayGetLBound(
*ppsa,
1,
pllBound
);
return S_OK;
}
BOOL QueueCallbackEvent(CTAPI * pTapi, TAPI_EVENT te, IDispatch * pEvent);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
HRESULT
CTAPI::Event(
TAPI_EVENT te,
IDispatch * pEvent
)
{
HRESULT hr = S_OK;
DWORD dwEventFilterMask;
LOG((TL_TRACE, "Event[%p] - enter. Event[0x%x]", this, te));
Lock();
dwEventFilterMask = m_dwEventFilterMask;
Unlock();
if( (te != TE_ADDRESS) &&
(te != TE_CALLHUB) &&
(te != TE_CALLINFOCHANGE) &&
(te != TE_CALLMEDIA) &&
(te != TE_CALLNOTIFICATION) &&
(te != TE_CALLSTATE) &&
(te != TE_FILETERMINAL) &&
(te != TE_PRIVATE) &&
(te != TE_QOSEVENT) &&
(te != TE_TAPIOBJECT) &&
(te != TE_ADDRESSDEVSPECIFIC) &&
(te != TE_PHONEDEVSPECIFIC) )
{
if( (te & dwEventFilterMask) == 0)
{
//
// Don't fire the event
//
hr = S_FALSE;
LOG((TL_INFO, "Event - This Event not Enabled %x", te));
return hr;
}
}
//
// It's an event from the event filtering mechanism
// TE_ADDRESS, TE_CALLHUB, TE_CALLINFOCHANGE, TE_CALLMEDIA,
// TE_CALLNOTIFICATION, TE_CALLSTATE, TE_FILETERMINAL,
// TE_PRIVATE, TE_QOSEVENT, TE_TAPIOBJECT
//
AddRef();
pEvent->AddRef();
if(QueueCallbackEvent(this, te, pEvent) == TRUE)
{
LOG((TL_INFO, "Event queued"));
}
else
{
Release();
pEvent->Release();
LOG((TL_INFO, "Event queuing Failed"));
}
LOG((TL_TRACE, "Event - exit"));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
HRESULT
CTAPI::EventFire(
TAPI_EVENT te,
IDispatch * pEvent
)
{
ITTAPIEventNotification * pCallback = NULL;
IDispatch * pDispatch = NULL;
HRESULT hr = S_OK;
CTAPIConnectionPoint * pCP;
LOG((TL_TRACE, "EventFire - enter"));
Lock();
if( NULL != m_pCP )
{
m_pCP->AddRef();
}
pCP = m_pCP;
Unlock();
if ( NULL != pCP )
{
pDispatch = (IDispatch *)pCP->GrabEventCallback();
if ( NULL != pDispatch )
{
hr = pDispatch->QueryInterface(IID_ITTAPIEventNotification,
(void **)&pCallback
);
if (SUCCEEDED(hr) )
{
if ( NULL != pCallback )
{
LOG((TL_TRACE, "EventFire - fire on ITTAPIEventNotification"));
pCallback->Event( te, pEvent );
pCallback->Release();
}
#if DBG
else
{
LOG((TL_WARN, "EventFire - can't fire event on ITTAPIEventNotification - no callback"));
}
#endif
}
else
{
CComVariant varResult;
CComVariant* pvars = new CComVariant[2];
LOG((TL_TRACE, "EventFire - fire on IDispatch"));
VariantClear(&varResult);
pvars[1] = te;
pvars[0] = pEvent;
DISPPARAMS disp = { pvars, NULL, 2, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
delete[] pvars;
hr = varResult.scode;
}
pDispatch->Release();
}
#if DBG
else
{
LOG((TL_WARN, "Event - can't fire event on IDispatch - no callback"));
}
#endif
}
#if DBG
else
{
LOG((TL_WARN, "Event - can't fire event - no m_pCP"));
}
#endif
if(NULL != pCP)
{
pCP->Release();
}
pEvent->Release();
LOG((TL_TRACE, "EventFire - exit"));
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// AddCallHub
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
void
CTAPI::AddCallHub( CCallHub * pCallHub )
{
ITCallHub * pITCallHub;
Lock();
pITCallHub = dynamic_cast<ITCallHub *>(pCallHub);
m_CallHubArray.Add( pITCallHub );
Unlock();
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// RemoveCallHub
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
void
CTAPI::RemoveCallHub( CCallHub * pCallHub )
{
ITCallHub * pITCallHub;
Lock();
pITCallHub = dynamic_cast<ITCallHub *>(pCallHub);
m_CallHubArray.Remove( pITCallHub );
Unlock();
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP
CTAPI::get_PrivateTAPIObjects(VARIANT*)
{
LOG((TL_TRACE, "get_PrivateTAPIObjects - enter"));
LOG((TL_ERROR, "get_PrivateTAPIObjects - exit E_NOTIMPL"));
return E_NOTIMPL;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// former EnumeratePrivateTAPIObjects
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP
CTAPI::EnumeratePrivateTAPIObjects(IEnumUnknown**)
{
LOG((TL_TRACE, "EnumeratePrivateTAPIObjects - enter"));
LOG((TL_ERROR, "EnumeratePrivateTAPIObjects - return E_NOTIMPL"));
return E_NOTIMPL;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// RegisterRequestRecipient
//
// simply call LineRegisterRequestRecipient - registers as assisted
// telephony application
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP
CTAPI::RegisterRequestRecipient(
long lRegistrationInstance,
long lRequestMode,
#ifdef NEWREQUEST
long lAddressTypes,
#endif
VARIANT_BOOL fEnable
)
{
HRESULT hr;
LOG((TL_TRACE, "RegisterRequestRecipient - enter"));
Lock();
if (!( m_dwFlags & TAPIFLAG_INITIALIZED ))
{
LOG((TL_ERROR, "RegisterRequestRecipient - tapi object must be initialized first" ));
Unlock();
return E_INVALIDARG;
}
Unlock();
hr = LineRegisterRequestRecipient(
(HLINEAPP)m_dwLineInitDataHandle,
lRegistrationInstance,
lRequestMode,
#ifdef NEWREQUEST
lAddressTypes,
#endif
fEnable?TRUE : FALSE
);
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// SetAssistedTelephonyPriority
//
// set the app priority for assisted telephony
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP
CTAPI::SetAssistedTelephonyPriority(
BSTR pAppFilename,
VARIANT_BOOL fPriority
)
{
HRESULT hr;
LOG((TL_TRACE, "SetAssistedTelephonyPriority - enter"));
hr = LineSetAppPriority(
pAppFilename,
0,
LINEREQUESTMODE_MAKECALL,
fPriority?1:0
);
LOG((TL_TRACE, "SetAssistedTelephonyPriority - exit - return %lx", hr));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// SetApplicationPriority
//
// sets the app priority for incoming calls and handoff.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP
CTAPI::SetApplicationPriority(
BSTR pAppFilename,
long lMediaType,
VARIANT_BOOL fPriority
)
{
HRESULT hr;
LOG((TL_TRACE, "SetApplicationPriority - enter"));
hr = LineSetAppPriority(
pAppFilename,
lMediaType,
0,
fPriority?1:0
);
LOG((TL_TRACE, "SetApplicationPriority - exit - return %lx", hr));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// put_EventFilter
//
// sets the Event filter mask
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP
CTAPI::put_EventFilter(long lFilterMask)
{
HRESULT hr = S_OK;
DWORD dwOldFilterMask;
ULONG64 ulEventMasks;
DWORD dwLineDevStateSubMasks;
DWORD dwAddrStateSubMasks;
LOG((TL_TRACE, "put_EventFilter - enter"));
if (~ALL_EVENT_FILTER_MASK & lFilterMask)
{
LOG((TL_ERROR, "put_EventFilter - Unknown Event type in mask %x", lFilterMask ));
hr = E_INVALIDARG;
}
else
{
Lock();
//
// Event Filtering, we should pass the mask
// to all addresses
//
HRESULT hr = E_FAIL;
hr = SetEventFilterToAddresses( lFilterMask );
if( FAILED(hr) )
{
Unlock();
LOG((TL_ERROR, "put_EventFilter - exit"
"CopyEventFilterMaskToAddresses failed. Returns 0x%08x", hr));
return hr;
}
//
// Set the event filter
//
dwOldFilterMask = m_dwEventFilterMask;
m_dwEventFilterMask = lFilterMask;
Unlock();
// Convert lFilterMask to server side 64 bit masks
// we alway should receive:
// TE_CALLSTATE,
// TE_CALLNOTIFICATION,
// TE_PHONEEVENT
// TE_CALLHUB
// TE_CALLINFOCHANGE
// TE_TAPIOBJECT
// events because these events are used internally
// by Tapi3 objets
ulEventMasks = EM_LINE_CALLSTATE // TE_CALLSTATE
| EM_LINE_APPNEWCALL // TE_CALLNOTIFICATION
| EM_PHONE_CLOSE // TE_PHONEEVENT
| EM_PHONE_STATE // TE_PHONEEVENT
| EM_PHONE_BUTTONMODE // TE_PHONEEVENT
| EM_PHONE_BUTTONSTATE // TE_PHONEVENT
| EM_LINE_APPNEWCALLHUB // TE_CALLHUB
| EM_LINE_CALLHUBCLOSE // TE_CALLHUB
| EM_LINE_CALLINFO // TE_CALLINFOCHANGE
| EM_LINE_CREATE // TE_TAPIOBJECT
| EM_LINE_REMOVE // TE_TAPIOBJECT
| EM_LINE_CLOSE // TE_TAPIOBJECT
| EM_PHONE_CREATE // TE_TAPIOBJECT
| EM_PHONE_REMOVE // TE_TAPIOBJECT
;
dwLineDevStateSubMasks = LINEDEVSTATE_REINIT // TE_TAPIOBJECT
| LINEDEVSTATE_TRANSLATECHANGE; // TE_TAPIOBJECT
dwAddrStateSubMasks = 0;
if (lFilterMask & TE_ADDRESS)
{
// AE_STATE
dwLineDevStateSubMasks |=
LINEDEVSTATE_CONNECTED |
LINEDEVSTATE_INSERVICE |
LINEDEVSTATE_OUTOFSERVICE |
LINEDEVSTATE_MAINTENANCE |
LINEDEVSTATE_REMOVED |
LINEDEVSTATE_DISCONNECTED |
LINEDEVSTATE_LOCK;
// AE_MSGWAITON, AAE_MSGWAITOFF
dwLineDevStateSubMasks |=
LINEDEVSTATE_MSGWAITON |
LINEDEVSTATE_MSGWAITOFF ;
// AE_CAPSCHANGE
dwAddrStateSubMasks |=
LINEADDRESSSTATE_CAPSCHANGE;
dwLineDevStateSubMasks |=
LINEDEVSTATE_CAPSCHANGE;
dwLineDevStateSubMasks |=
LINEDEVSTATE_RINGING | // AE_RINGING
LINEDEVSTATE_CONFIGCHANGE; // AE_CONFIGCHANGE
dwAddrStateSubMasks |=
LINEADDRESSSTATE_FORWARD; // AE_FORWARD
// AE_NEWTERMINAL : ignore private MSP events
// AE_REMOVETERMINAL : ignore private MSP events
}
if (lFilterMask & TE_CALLMEDIA)
{
// Skil media event
}
if (lFilterMask & TE_PRIVATE)
{
// skip MSP private event
}
if (lFilterMask & TE_REQUEST)
{
// LINE_REQUEST is not masked by the server
}
if (lFilterMask & TE_AGENT)
{
ulEventMasks |= EM_LINE_AGENTSTATUSEX | EM_LINE_AGENTSTATUS;
}
if (lFilterMask & TE_AGENTSESSION)
{
ulEventMasks |= EM_LINE_AGENTSESSIONSTATUS;
}
if (lFilterMask & TE_QOSEVENT)
{
ulEventMasks |= EM_LINE_QOSINFO;
}
if (lFilterMask & TE_AGENTHANDLER)
{
// TAPI 3 client side only?
}
if (lFilterMask & TE_ACDGROUP)
{
ulEventMasks |= EM_LINE_GROUPSTATUS;
}
if (lFilterMask & TE_QUEUE)
{
ulEventMasks |= EM_LINE_QUEUESTATUS;
}
if (lFilterMask & TE_DIGITEVENT)
{
// LINE_MONITORDIGITS not controled by event filtering
}
if (lFilterMask & TE_GENERATEEVENT)
{
// LINE_GENERATE not controled by event filtering
}
if (lFilterMask & TE_TONEEVENT)
{
// LINE_MONITORTONE not controled by event filtering
}
if (lFilterMask & TE_GATHERDIGITS)
{
// LINE_GATHERDIGITS not controled by event filtering
}
if (lFilterMask & TE_ADDRESSDEVSPECIFIC)
{
ulEventMasks |= EM_LINE_DEVSPECIFICEX | EM_LINE_DEVSPECIFIC;
}
if (lFilterMask & TE_PHONEDEVSPECIFIC)
{
ulEventMasks |= EM_PHONE_DEVSPECIFIC;
}
hr = tapiSetEventFilterMasks (
TAPIOBJ_NULL,
NULL,
ulEventMasks
);
if (hr == 0)
{
hr = tapiSetEventFilterSubMasks (
TAPIOBJ_NULL,
NULL,
EM_LINE_LINEDEVSTATE,
dwLineDevStateSubMasks
);
}
if (hr == 0)
{
hr = tapiSetEventFilterSubMasks (
TAPIOBJ_NULL,
NULL,
EM_LINE_ADDRESSSTATE,
dwAddrStateSubMasks
);
}
if (hr != 0)
{
hr = mapTAPIErrorCode(hr);
}
LOG((TL_INFO, "put_EventFilter - mask changed %x to %x", dwOldFilterMask, lFilterMask ));
}
LOG((TL_TRACE,hr, "put_EventFilter - exit "));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// get_EventFilter
//
// gets the Event filter mask
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP
CTAPI::get_EventFilter(long * plFilterMask)
{
HRESULT hr = S_OK;
LOG((TL_TRACE, "get_EventFilter - enter"));
if ( TAPIIsBadWritePtr( plFilterMask, sizeof(long) ) )
{
LOG((TL_ERROR, "get_EventFilter - bad plFilterMask pointer"));
hr = E_POINTER;
}
else
{
Lock();
*plFilterMask = m_dwEventFilterMask;
Unlock();
}
LOG((TL_TRACE, hr, "get_EventFilter - exit "));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Interface : ITTAPI2
// Method : get_Phones
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HRESULT
CTAPI::get_Phones(
VARIANT * pPhones
)
{
HRESULT hr;
IDispatch * pDisp;
LOG((TL_TRACE, "get_Phones enter"));
Lock();
if (!( m_dwFlags & TAPIFLAG_INITIALIZED ) )
{
LOG((TL_ERROR, "get_Phones - tapi object must be initialized first" ));
Unlock();
return TAPI_E_NOT_INITIALIZED;
}
Unlock();
if ( TAPIIsBadWritePtr( pPhones, sizeof( VARIANT ) ) )
{
LOG((TL_ERROR, "get_Phones - bad pointer"));
return E_POINTER;
}
CComObject< CTapiCollection< ITPhone > > * p;
CComObject< CTapiCollection< ITPhone > >::CreateInstance( &p );
if (NULL == p)
{
LOG((TL_ERROR, "get_Phones - could not create collection" ));
return E_OUTOFMEMORY;
}
// get the IDispatch interface
hr = p->_InternalQueryInterface( IID_IDispatch, (void **) &pDisp );
if (S_OK != hr)
{
LOG((TL_ERROR, "get_Phones - could not get IDispatch interface" ));
delete p;
return hr;
}
Lock();
// initialize
hr = p->Initialize( m_PhoneArray );
Unlock();
if (S_OK != hr)
{
LOG((TL_ERROR, "get_Phones - could not initialize collection" ));
pDisp->Release();
return hr;
}
// put it in the variant
VariantInit(pPhones);
pPhones->vt = VT_DISPATCH;
pPhones->pdispVal = pDisp;
LOG((TL_TRACE, "get_Phones - exit - return %lx", hr ));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Interface : ITTAPI2
// Method : EnumeratePhones
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HRESULT
CTAPI::EnumeratePhones(
IEnumPhone ** ppEnumPhone
)
{
HRESULT hr;
LOG((TL_TRACE, "EnumeratePhones - enter"));
LOG((TL_TRACE, " ppEnumPhone----->%p", ppEnumPhone ));
Lock();
if (!( m_dwFlags & TAPIFLAG_INITIALIZED ) )
{
LOG((TL_ERROR, "EnumeratePhones - tapi object must be initialized first" ));
Unlock();
return TAPI_E_NOT_INITIALIZED;
}
Unlock();
if ( TAPIIsBadWritePtr( ppEnumPhone, sizeof( IEnumPhone * ) ) )
{
LOG((TL_ERROR, "EnumeratePhones - bad pointer"));
return E_POINTER;
}
//
// create the enumerator
//
CComObject< CTapiEnum< IEnumPhone, ITPhone, &IID_IEnumPhone > > * p;
hr = CComObject< CTapiEnum< IEnumPhone, ITPhone, &IID_IEnumPhone > >
::CreateInstance( &p );
if (S_OK != hr)
{
LOG((TL_ERROR, "EnumeratePhones - could not create enum" ));
return hr;
}
Lock();
// initialize it with our phone list, initialize adds a reference to p
p->Initialize( m_PhoneArray );
Unlock();
//
// return it
//
*ppEnumPhone = p;
LOG((TL_TRACE, "EnumeratePhones - exit - return %lx", hr ));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
// Interface : ITTAPI2
// Method : CreateEmptyCollectionObject
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP
CTAPI::CreateEmptyCollectionObject(
ITCollection2 ** ppCollection
)
{
HRESULT hr;
LOG((TL_TRACE, "CreateEmptyCollectionObject enter"));
if ( TAPIIsBadWritePtr( ppCollection, sizeof( ITCollection2 * ) ) )
{
LOG((TL_ERROR, "CreateEmptyCollectionObject - bad pointer"));
return E_POINTER;
}
// Initialize the return value in case we fail
*ppCollection = NULL;
CComObject< CTapiCollection< IDispatch > > * p;
hr = CComObject< CTapiCollection< IDispatch > >::CreateInstance( &p );
if ( S_OK != hr )
{
LOG((TL_ERROR, "CreateEmptyCollectionObject - could not create CTapiCollection" ));
return E_OUTOFMEMORY;
}
// get the ITCollection2 interface
hr = p->QueryInterface( IID_ITCollection2, (void **) ppCollection );
if ( FAILED(hr) )
{
LOG((TL_ERROR, "CreateEmptyCollectionObject - could not get ITCollection2 interface" ));
delete p;
return hr;
}
LOG((TL_TRACE, "CreateEmptyCollectionObject - exit - return %lx", hr ));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// DoLineCreate
//
// handles line_create message. basically, creates a new
// address object
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
void
CTAPI::DoLineCreate( DWORD dwDeviceID )
{
HRESULT hr;
Lock();
CreateAddressesOnSingleLine( dwDeviceID, TRUE );
Unlock();
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// DoLineRemove( DWORD dwDeviceID )
//
// tapisrv has sent a LINE_REMOVE message. find the corresponding
// address object(s), remove them from our list, and send a
// message to the app
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
void
CTAPI::DoLineRemove( DWORD dwDeviceID )
{
HRESULT hr;
ITAddress * pAddress;
CAddress * pCAddress;
int iCount;
#if DBG
BOOL bFound = FALSE;
#endif
LOG((TL_TRACE, "DoLineRemove - enter - dwDeviceID %d", dwDeviceID));
Lock();
//
// go through the addresses
//
for(iCount = 0; iCount < m_AddressArray.GetSize(); iCount++)
{
pAddress = m_AddressArray[iCount];
pCAddress = dynamic_cast<CAddress *>(pAddress);
if (pCAddress != NULL)
{
//
// does the device ID match?
//
if ( dwDeviceID == pCAddress->GetDeviceID() )
{
LOG((TL_INFO, "DoLineRemove - found matching address - %p", pAddress));
//
// make sure the address is in the correct state
//
pCAddress->OutOfService(LINEDEVSTATE_REMOVED);
//
// fire event
//
CTapiObjectEvent::FireEvent(
this,
TE_ADDRESSREMOVE,
pAddress,
0,
NULL
);
//
// remove from our list
//
LOG((TL_INFO, "DoLineRemove - removing address %p", pAddress));
m_AddressArray.RemoveAt(iCount);
iCount--;
#if DBG
bFound = TRUE;
#endif
}
}
}
#if DBG
if ( !bFound )
{
LOG((TL_WARN, "Receive LINE_REMOVE but couldn't find address object"));
}
#endif
LOG((TL_TRACE, "DoLineRemove - exiting"));
Unlock();
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// DoPhoneCreate
//
// handles PHONE_CREATE message. basically, creates a new
// phone object
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
void
CTAPI::DoPhoneCreate( DWORD dwDeviceID )
{
HRESULT hr;
Lock();
CreatePhone( dwDeviceID, TRUE );
Unlock();
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// DoPhoneRemove( DWORD dwDeviceID )
//
// tapisrv has sent a PHONE_REMOVE message. find the corresponding
// phone object(s), remove them from our list, and send a
// message to the app
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
void
CTAPI::DoPhoneRemove( DWORD dwDeviceID )
{
HRESULT hr;
ITPhone * pPhone;
CPhone * pCPhone;
int iPhoneCount;
int iAddressCount;
#if DBG
BOOL bFound;
#endif
LOG((TL_TRACE, "DoPhoneRemove - enter - dwDeviceID %d", dwDeviceID));
Lock();
//
// go through the phones
//
for(iPhoneCount = 0; iPhoneCount < m_PhoneArray.GetSize(); iPhoneCount++)
{
pPhone = m_PhoneArray[iPhoneCount];
pCPhone = dynamic_cast<CPhone *>(pPhone);
if (NULL == pCPhone)
{
//
// something went terribly wrong
//
LOG((TL_ERROR, "DoPhoneRemove - failed to cast ptr %p to a phone object", pPhone));
_ASSERTE(FALSE);
continue;
}
//
// does the device ID match?
//
if ( dwDeviceID == pCPhone->GetDeviceID() )
{
LOG((TL_INFO, "DoPhoneRemove - found matching phone - %p", pPhone));
//
// fire event
//
CTapiObjectEvent::FireEvent(this,
TE_PHONEREMOVE,
NULL,
0,
pPhone
);
//
// remove from our list
//
LOG((TL_INFO, "DoPhoneRemove - removing phone %p", pPhone));
m_PhoneArray.RemoveAt(iPhoneCount);
iPhoneCount--;
#if DBG
bFound = TRUE;
#endif
}
}
#if DBG
if ( !bFound )
{
LOG((TL_WARN, "Receive PHONE_REMOVE but couldn't find phone object"));
}
#endif
LOG((TL_TRACE, "DoPhoneRemove - exiting"));
Unlock();
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
BOOL
CTAPI::FindTapiObject( CTAPI * pTapi )
{
PtrList::iterator iter, end;
BOOL bFound = FALSE;
int iReturn = -1;
EnterCriticalSection( &gcsTapiObjectArray );
//
// go through the list
//
iReturn = m_sTAPIObjectArray.Find( pTapi );
if (iReturn != -1)
{
pTapi->AddRef();
bFound = TRUE;
}
LeaveCriticalSection ( &gcsTapiObjectArray );
return bFound;
}
////////////////////////////////////////////////////////////////////////////
//
// GetTapiObjectFromAsyncEventMSG
//
// this method attempts to get tapi object pointer from PASYNCEVENTMSG
//
// it returns NULL on failure or addref'ed tapi object on success
//
////////////////////////////////////////////////////////////////////////////
CTAPI *GetTapiObjectFromAsyncEventMSG(PASYNCEVENTMSG pParams)
{
LOG((TL_TRACE, "GetTapiObjectFromAsyncEventMSG - entered"));
//
// get pInitData from the structure we have
//
PT3INIT_DATA pInitData = (PT3INIT_DATA) GetHandleTableEntry(pParams->InitContext);
if (IsBadReadPtr(pInitData, sizeof(T3INIT_DATA)))
{
LOG((TL_WARN, "GetTapiObjectFromAsyncEventMSG - could not recover pInitData"));
return NULL;
}
//
// get tapi object from pInitData
//
CTAPI *pTapi = pInitData->pTAPI;
//
// is it any good?
//
if (IsBadReadPtr(pTapi, sizeof(CTAPI)))
{
LOG((TL_WARN,
"GetTapiObjectFromAsyncEventMSG - tapi pointer [%p] does not point to readable memory",
pTapi));
return NULL;
}
//
// double check that this is a known tapi object...
//
if (!CTAPI::FindTapiObject(pTapi))
{
//
// the object is not in the list of tapi objects
//
LOG((TL_WARN,
"GetTapiObjectFromAsyncEventMSG - CTAPI::FindTapiObject did not find the tapi object [%p]",
pTapi));
return NULL;
}
LOG((TL_TRACE, "GetTapiObjectFromAsyncEventMSG - exit. pTapi %p", pTapi));
return pTapi;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
void
HandleLineCreate( PASYNCEVENTMSG pParams )
{
LOG((TL_TRACE, "HandleLineCreate - enter"));
//
// get tapi object
//
CTAPI *pTapi = GetTapiObjectFromAsyncEventMSG(pParams);
if (NULL == pTapi)
{
LOG((TL_WARN,
"HandleLineCreate - tapi object not present [%p]",
pTapi));
return;
}
//
// we have tapi object, do what we have to do.
//
pTapi->DoLineCreate( pParams->Param1 );
//
// GetTapiObjectFromAsyncEventMSG returned a addref'ed tapi object. release
//
pTapi->Release();
pTapi = NULL;
LOG((TL_TRACE, "HandleLineCreate - exit"));
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
void
HandleLineRemove( PASYNCEVENTMSG pParams )
{
LOG((TL_TRACE, "HandleLineRemove - enter"));
//
// get tapi object
//
CTAPI *pTapi = GetTapiObjectFromAsyncEventMSG(pParams);
if (NULL == pTapi)
{
LOG((TL_WARN,
"HandleLineRemove - tapi object not present [%p]",
pTapi));
return;
}
//
// we have tapi object, do what we have to do.
//
pTapi->DoLineRemove( pParams->Param1 );
//
// GetTapiObjectFromAsyncEventMSG returned a addref'ed tapi object. release
//
pTapi->Release();
pTapi = NULL;
LOG((TL_TRACE, "HandleLineRemove - exit"));
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
void
HandlePhoneCreate( PASYNCEVENTMSG pParams )
{
LOG((TL_TRACE, "HandlePhoneCreate - enter"));
//
// get tapi object
//
CTAPI *pTapi = GetTapiObjectFromAsyncEventMSG(pParams);
if (NULL == pTapi)
{
LOG((TL_WARN,
"HandlePhoneCreate - tapi object not present [%p]",
pTapi));
return;
}
//
// we have tapi object, do what we have to do.
//
pTapi->DoPhoneCreate( pParams->Param1 );
//
// GetTapiObjectFromAsyncEventMSG returned a addref'ed tapi object. release
//
pTapi->Release();
pTapi = NULL;
LOG((TL_TRACE, "HandlePhoneCreate - exit"));
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
void
HandlePhoneRemove( PASYNCEVENTMSG pParams )
{
LOG((TL_TRACE, "HandlePhoneRemove - enter"));
//
// get tapi object
//
CTAPI *pTapi = GetTapiObjectFromAsyncEventMSG(pParams);
if (NULL == pTapi)
{
LOG((TL_WARN,
"HandlePhoneRemove - tapi object not present [%p]",
pTapi));
return;
}
//
// we have tapi object, do what we have to do.
//
pTapi->DoPhoneRemove(pParams->Param1);
//
// GetTapiObjectFromAsyncEventMSG returned a addref'ed tapi object. release
//
pTapi->Release();
pTapi = NULL;
LOG((TL_TRACE, "HandlePhoneRemove - exit"));
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
HRESULT
CTapiObjectEvent::FireEvent(
CTAPI * pTapi,
TAPIOBJECT_EVENT Event,
ITAddress * pAddress,
long lCallbackInstance,
ITPhone * pPhone
)
{
HRESULT hr = S_OK;
CComObject<CTapiObjectEvent> * p;
IDispatch * pDisp;
//
// Check the event filter mask
// This event is not filtered by TapiSrv because is
// related with TE_TAPIOBJECT, a specific TAPI3 event.
//
DWORD dwEventFilterMask = Event;
long nTapiEventFilter = 0;
pTapi->get_EventFilter( &nTapiEventFilter );
STATICLOG((TL_INFO, " TapiObjectEventMask ---> %ld", dwEventFilterMask ));
if( !( nTapiEventFilter & TE_TAPIOBJECT))
{
STATICLOG((TL_WARN, "FireEvent - filtering out this event [%lx]", Event));
return S_OK;
}
//
// create event
//
hr = CComObject<CTapiObjectEvent>::CreateInstance( &p );
if ( !SUCCEEDED(hr) )
{
STATICLOG((TL_ERROR, "Could not create TapiObjectEvent object - %lx", hr));
return hr;
}
//
// initialize
//
p->m_Event = Event;
p->m_pTapi = dynamic_cast<ITTAPI *>(pTapi);
p->m_pTapi->AddRef();
p->m_pAddress = pAddress;
p->m_lCallbackInstance = lCallbackInstance;
p->m_pPhone = pPhone;
if ( NULL != pAddress )
{
pAddress->AddRef();
}
if ( NULL != pPhone )
{
pPhone->AddRef();
}
#if DBG
p->m_pDebug = (PWSTR) ClientAlloc( 1 );
#endif
//
// get idisp interface
//
hr = p->QueryInterface(
IID_IDispatch,
(void **)&pDisp
);
if ( !SUCCEEDED(hr) )
{
STATICLOG((TL_ERROR, "Could not get disp interface of TapiObjectEvent object %lx", hr));
delete p;
return hr;
}
//
// fire event
//
pTapi->Event(
TE_TAPIOBJECT,
pDisp
);
//
// release stuff
//
pDisp->Release();
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
void
CTapiObjectEvent::FinalRelease(void)
{
m_pTapi->Release();
if ( NULL != m_pAddress )
{
m_pAddress->Release();
}
if ( NULL != m_pPhone )
{
m_pPhone->Release();
}
#if DBG
ClientFree( m_pDebug );
#endif
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP
CTapiObjectEvent::get_TAPIObject( ITTAPI ** ppTapi )
{
if ( TAPIIsBadWritePtr( ppTapi, sizeof( ITTAPI *) ) )
{
return E_POINTER;
}
*ppTapi = m_pTapi;
(*ppTapi)->AddRef();
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP
CTapiObjectEvent::get_Event( TAPIOBJECT_EVENT * pEvent )
{
if ( TAPIIsBadWritePtr( pEvent, sizeof( TAPIOBJECT_EVENT ) ) )
{
return E_POINTER;
}
*pEvent = m_Event;
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP
CTapiObjectEvent::get_Address( ITAddress ** ppAddress )
{
if ( TAPIIsBadWritePtr( ppAddress, sizeof( ITAddress *) ) )
{
return E_POINTER;
}
if ((m_Event != TE_ADDRESSCREATE) && (m_Event != TE_ADDRESSREMOVE) &&
(m_Event != TE_ADDRESSCLOSE))
{
return TAPI_E_WRONGEVENT;
}
*ppAddress = m_pAddress;
if ( NULL != m_pAddress )
{
m_pAddress->AddRef();
}
return S_OK;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP
CTapiObjectEvent::get_CallbackInstance( long * plCallbackInstance )
{
if ( TAPIIsBadWritePtr( plCallbackInstance, sizeof( long ) ) )
{
return E_POINTER;
}
*plCallbackInstance = m_lCallbackInstance;
return S_OK;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// get_Phone
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
STDMETHODIMP
CTapiObjectEvent::get_Phone(
ITPhone ** ppPhone
)
{
if ( TAPIIsBadWritePtr( ppPhone , sizeof(ITPhone *) ) )
{
return E_POINTER;
}
if ((m_Event != TE_PHONECREATE) && (m_Event != TE_PHONEREMOVE))
{
return TAPI_E_WRONGEVENT;
}
*ppPhone = m_pPhone;
if ( NULL != m_pPhone )
{
m_pPhone->AddRef();
}
return S_OK;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// HandleReinit
//
// we got a reinit message, so go through all the tapi objects, and
// fire the event
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void
CTAPI::HandleReinit()
{
LOG((TL_TRACE, "HandleReinit - enter"));
//
// Fire the event
//
CTapiObjectEvent::FireEvent(
this,
TE_REINIT,
NULL,
0,
NULL
);
Lock();
m_dwFlags |= TAPIFLAG_REINIT;
Unlock();
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
HRESULT
CTAPI::GetBuffer(
DWORD dwType,
UINT_PTR pObject,
LPVOID * ppBuffer
)
{
switch (dwType)
{
case BUFFERTYPE_ADDRCAP:
return m_pAddressCapCache->GetBuffer(
pObject,
ppBuffer
);
break;
case BUFFERTYPE_LINEDEVCAP:
return m_pLineCapCache->GetBuffer(
pObject,
ppBuffer
);
break;
case BUFFERTYPE_PHONECAP:
return m_pPhoneCapCache->GetBuffer(
pObject,
ppBuffer
);
break;
default:
return E_FAIL;
}
return E_UNEXPECTED;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
HRESULT
CTAPI::SetBuffer(
DWORD dwType,
UINT_PTR pObject,
LPVOID pBuffer
)
{
switch (dwType)
{
case BUFFERTYPE_ADDRCAP:
return m_pAddressCapCache->SetBuffer(
pObject,
pBuffer
);
break;
case BUFFERTYPE_LINEDEVCAP:
return m_pLineCapCache->SetBuffer(
pObject,
pBuffer
);
break;
case BUFFERTYPE_PHONECAP:
return m_pPhoneCapCache->SetBuffer(
pObject,
pBuffer
);
break;
default:
return E_FAIL;
}
return E_UNEXPECTED;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
//
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
HRESULT
CTAPI::InvalidateBuffer(
DWORD dwType,
UINT_PTR pObject
)
{
switch (dwType)
{
case BUFFERTYPE_ADDRCAP:
return m_pAddressCapCache->InvalidateBuffer(
pObject
);
break;
case BUFFERTYPE_LINEDEVCAP:
return m_pLineCapCache->InvalidateBuffer(
pObject
);
break;
case BUFFERTYPE_PHONECAP:
return m_pPhoneCapCache->InvalidateBuffer(
pObject
);
break;
default:
return E_FAIL;
}
return E_UNEXPECTED;
}
BOOL
CTAPI::FindRegistration( PVOID pRegistration )
{
PtrList::iterator iter, end;
Lock();
iter = m_RegisterItemPtrList.begin();
end = m_RegisterItemPtrList.end();
for ( ; iter != end; iter++ )
{
REGISTERITEM * pItem;
pItem = (REGISTERITEM *)(*iter);
if ( pRegistration == pItem->pRegister )
{
Unlock();
return TRUE;
}
}
Unlock();
return FALSE;
}
/////////////////////////////////////////////////////////////////////////////
// IDispatch implementation
//
typedef IDispatchImpl<ITapi2Vtbl<CTAPI>, &IID_ITTAPI2, &LIBID_TAPI3Lib> TapiType;
typedef IDispatchImpl<ICallCenterVtbl<CTAPI>, &IID_ITTAPICallCenter, &LIBID_TAPI3Lib> CallCenterType;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// CTAPI::GetIDsOfNames
//
// Overide if IDispatch method
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP CTAPI::GetIDsOfNames(REFIID riid,
LPOLESTR* rgszNames,
UINT cNames,
LCID lcid,
DISPID* rgdispid
)
{
HRESULT hr = DISP_E_UNKNOWNNAME;
// See if the requsted method belongs to the default interface
hr = TapiType::GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid);
if (SUCCEEDED(hr))
{
LOG((TL_INFO, "GetIDsOfNames - found %S on ITTAPI", *rgszNames));
rgdispid[0] |= IDISPTAPI;
return hr;
}
// If not, then try the Call Center interface
hr = CallCenterType::GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid);
if (SUCCEEDED(hr))
{
LOG((TL_TRACE, "GetIDsOfNames - found %S on ITTAPICallCenter", *rgszNames));
Lock();
if (!( m_dwFlags & TAPIFLAG_CALLCENTER_INITIALIZED ) )
{
LOG((TL_INFO, "GetIDsOfNames - Call Center not initialized" ));
UpdateAgentHandlerArray();
m_dwFlags |= TAPIFLAG_CALLCENTER_INITIALIZED;
LOG((TL_INFO, "GetIDsOfNames - Call Center initialized" ));
}
Unlock();
rgdispid[0] |= IDISPTAPICALLCENTER;
return hr;
}
LOG((TL_INFO, "GetIDsOfNames - Didn't find %S on our iterfaces", *rgszNames));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// CTAPI::Invoke
//
// Overide if IDispatch method
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
STDMETHODIMP CTAPI::Invoke(DISPID dispidMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS* pdispparams,
VARIANT* pvarResult,
EXCEPINFO* pexcepinfo,
UINT* puArgErr
)
{
HRESULT hr = DISP_E_MEMBERNOTFOUND;
DWORD dwInterface = (dispidMember & INTERFACEMASK);
LOG((TL_TRACE, "Invoke - dispidMember %X", dispidMember));
// Call invoke for the required interface
switch (dwInterface)
{
case IDISPTAPI:
{
hr = TapiType::Invoke(dispidMember,
riid,
lcid,
wFlags,
pdispparams,
pvarResult,
pexcepinfo,
puArgErr
);
break;
}
case IDISPTAPICALLCENTER:
{
hr = CallCenterType::Invoke(dispidMember,
riid,
lcid,
wFlags,
pdispparams,
pvarResult,
pexcepinfo,
puArgErr
);
break;
}
} // end switch (dwInterface)
LOG((TL_TRACE, hr, "Invoke - exit" ));
return hr;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
//
// CTAPI::SetEventFilterToAddresses
//
// Copy the event filter down to all addresses
// It's called by put_EventFilter() method
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
HRESULT CTAPI::SetEventFilterToAddresses(
DWORD dwEventFilterMask
)
{
LOG((TL_TRACE, "CopyEventFilterMaskToAddresses enter"));
CAddress* pAddress = NULL;
HRESULT hr = S_OK;
//
// Enumerate the addresses
//
for ( int iAddress = 0; iAddress < m_AddressArray.GetSize(); iAddress++ )
{
pAddress = dynamic_cast<CAddress *>(m_AddressArray[iAddress]);
if( pAddress != NULL )
{
hr = pAddress->SetEventFilterMask(
dwEventFilterMask
);
if( FAILED(hr) )
{
break;
}
}
}
LOG((TL_TRACE, "CopyEventFilterMaskToAddresses exit 0x%08x", hr));
return hr;
}
///////////////////////////////////////////////////////////////////////////////
//
// CTAPI::IsValidTapiObject
//
// a helper static function that checks if it was passed a valid tapi object
//
// if the object is valid, the function addrefs it and returns TRUE
// if the object is not valid, the function returns true
//
// static
BOOL CTAPI::IsValidTapiObject(CTAPI *pTapiObject)
{
STATICLOG((TL_TRACE, "CTAPI::IsValidTapiObject enter[%p]", pTapiObject));
//
// before we go into trouble of checking tapi object array see if the ptr
// is readable at all
//
if ( IsBadReadPtr(pTapiObject, sizeof(CTAPI) ) )
{
STATICLOG((TL_WARN, "CTAPI::IsValidTapiObject - object not readabe"));
return FALSE;
}
//
// see if this object is in the array of tapi objects
//
EnterCriticalSection( &gcsTapiObjectArray );
if (-1 == m_sTAPIObjectArray.Find(pTapiObject) )
{
LeaveCriticalSection ( &gcsTapiObjectArray );
STATICLOG((TL_WARN, "CTAPI::IsValidTapiObject - object not in the array"));
return FALSE;
}
//
// the object is in the array, so it must be valid, addref it
//
try
{
//
// inside try, in case something else went bad
//
pTapiObject->AddRef();
}
catch(...)
{
//
// the object is in the array, but we had problems addrefing.
// something's not kosher.
//
STATICLOG((TL_ERROR,
"CTAPI::IsValidTapiObject - object in in the array but addref threw"));
LeaveCriticalSection ( &gcsTapiObjectArray );
_ASSERTE(FALSE);
return FALSE;
}
LeaveCriticalSection ( &gcsTapiObjectArray );
STATICLOG((TL_TRACE, "CTAPI::IsValidTapiObject -- finish. the object is valid"));
return TRUE;
}
| [
"[email protected]"
] | |
a9ffd1306d9e385340d95feb6189fed12c6417df | 8e1faa9fca023ba67f91903178c7ad9b371b8b33 | /Game - copy/Game/Search.cpp | 7b9993c60cd999cc16adc7dfd753046e5dcbc020 | [] | no_license | 3Hoo/G_gameDev_Cpp | dd36130d74f97e3d9936fbb121c7f56b38091e70 | e16acc22e0a9d156e6d0a656615ea22c74b463c0 | refs/heads/master | 2023-09-02T07:34:01.411043 | 2021-11-18T06:31:22 | 2021-11-18T06:31:22 | 429,319,806 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 11,292 | cpp | #include <vector>
#include <unordered_map>
#include <queue>
/* 기본 그래프 */
struct GraphNode
{
// 각 노드는 인접 노드의 포인터를 가지고 있다
std::vector<GraphNode*> mAdjacent;
};
struct Graph
{
// 그래프는 노드들을 포함한다
std::vector<GraphNode*> mNodes;
};
/* 가중치 그래프 */
struct WeightedEdge
{
// 이 에지에 어떤 노드들이 연결되어 있는가?
struct WeightedGraphNode* mFrom;
struct WeightedGraphNode* mTo;
// 이 에지의 가중치
float mWeight;
};
struct WeightedGraphNode
{
// 외부로 향하는 에지들을 저장한다
std::vector<WeightedEdge*> mEdges;
};
struct WeightedGraph
{
// 가중 그래프는 가중치 노드들을 포함한다
std::vector<const WeightedGraphNode*> mNodes;
};
/* BFS 알고리즘 */
using NodeToParentMap = std::unordered_map<const GraphNode*, const GraphNode*>;
bool BFS(const Graph& graph, const GraphNode* start, const GraphNode* goal, NodeToParentMap& outMap)
{
// 경로를 찾았는지를 알 수 있는 플래그
bool pathFound = false;
// 고려해야 할 노드
std::queue<const GraphNode*> q;
// 시작 노드를 큐에 넣는다
q.emplace(start);
while (!q.empty())
{
const GraphNode* current = q.front();
q.pop();
if (current == goal)
{
pathFound = true;
break;
}
// 큐에는 없는 인접 노드를 꺼낸다
for (const GraphNode* node : current->mAdjacent)
{
// 시작 노드를 제외하고, 부모가 null이면 큐에 넣지 않았던 노드이다
const GraphNode* parent = outMap[node];
if (parent == nullptr && node != start)
{
// 이 노드의 부모 노드를 설정하고 큐에 넣는다
outMap[node] = current;
q.emplace(node);
}
}
}
return pathFound;
}
/* GBFS 알고리즘 */
struct GBFSScratch
{
const WeightedEdge* mParentEdge = nullptr;
float mHeuristic = 0.0f;
bool mInOpenSet = false;
bool mInClosedSet = false;
};
using GBFSMap = std::unordered_map<const WeightedGraphNode*, GBFSScratch>;
float ComputeHeuristic(const WeightedGraphNode* a, const WeightedGraphNode* goal)
{
// 원래는 a노드와 goal노드의 실제 유클리드 거리를 리턴한다
return 0.0f;
}
bool GBFS(const WeightedGraph& graph, const WeightedGraphNode* start, const WeightedGraphNode* goal, GBFSMap& outMap)
{
std::vector<const WeightedGraphNode*> openSet;
const WeightedGraphNode* current = start;
outMap[current].mInClosedSet = true;
do
{
// 인접 노드들을 열린 집합에 추가한다
for (const WeightedEdge* edge : current->mEdges)
{
const WeightedGraphNode* neighbor = edge->mTo;
// 인접 노드들에 대한 추가 데이터를 확보한다
GBFSScratch& data = outMap[neighbor];
// 이 노드가 닫힌 집합에 없다면, 추가한다
if (!data.mInClosedSet)
{
// 인접 노드의 부모 에지를 설정한다
data.mParentEdge = edge;
if (!data.mInOpenSet)
{
// 이 노드의 휴리스틱을 계산하고 열린 집합에 추가한다
data.mHeuristic = ComputeHeuristic(neighbor, goal);
data.mInOpenSet = true;
openSet.emplace_back(neighbor);
}
}
}
if (openSet.empty())
{
break;
}
// 열린 집합에서 가장 비용이 낮은 노드를 찾자
auto iter = std::min_element(openSet.begin(), openSet.end(),
[&outMap](const WeightedGraphNode* a, const WeightedGraphNode* b)
{
return outMap[a].mHeuristic < outMap[b].mHeuristic;
});
// 현재 노드를 설정하고 이 노드를 열린 집합에서 닫힌 집합으로 이동시킨다
current = *iter;
openSet.erase(iter);
outMap[current].mInOpenSet = false;
outMap[current].mInClosedSet = true;
} while (current != goal);
return (current == goal) ? true : false;
}
/* A* 알고리즘 */
struct AStarScratch
{
const WeightedEdge* mParentEdge = nullptr;
float mHeuristic = 0.0f;
float mActualFromStart = 0.0f;
bool mInOpenSet = false;
bool mInClosedSet = false;
};
using AStarMap = std::unordered_map<const WeightedGraphNode*, AStarScratch>;
bool AStar(const WeightedGraph& graph, const WeightedGraphNode* start, const WeightedGraphNode* goal, AStarMap& outMap)
{
std::vector< const WeightedGraphNode*> openSet;
// 시작점을 설정한다
const WeightedGraphNode* current = start;
outMap[current].mInClosedSet = true;
do
{
for (const WeightedEdge* edge : current->mEdges)
{
// 이웃 노드
const WeightedGraphNode* neighbor = edge->mTo;
// 이웃 노드의 AStar 정보
AStarScratch& data = outMap[neighbor];
if (!data.mInClosedSet)
{
if (!data.mInOpenSet)
{
data.mParentEdge = edge;
data.mHeuristic = ComputeHeuristic(neighbor, goal);
data.mActualFromStart = outMap[current].mActualFromStart + edge->mWeight;
data.mInOpenSet = true;
openSet.emplace_back(neighbor);
}
else
{
float newActual = outMap[current].mActualFromStart + edge->mWeight;
if (newActual < data.mActualFromStart)
{
data.mActualFromStart = newActual;
data.mParentEdge = edge;
}
}
}
}
if (openSet.empty())
{
break;
}
// 현재 노드에서 이웃 노드들(openset에 있는) 중 가장 작은 f(x) 값을 가진 노드에게 current를 넘겨준다
auto iter = std::min_element(openSet.begin(), openSet.end(),
[&outMap](const WeightedGraphNode* a, const WeightedGraphNode* b)
{
return (outMap[a].mActualFromStart + outMap[a].mHeuristic) < (outMap[b].mActualFromStart + outMap[b].mHeuristic);
});
current = *iter;
outMap[*iter].mInClosedSet = true;
outMap[*iter].mInOpenSet = false;
openSet.erase(iter);
} while (current != goal);
return (current == goal) ? true : false;
}
/* 틱텍토 게임 트리 */
struct GameState
{
enum SquareState {Empty, X, O};
SquareState mBoard[3][3];
};
struct GTNode
{
// 자식 노드
std::vector<GTNode*> mChildren;
// 이 노드의 게임 상태
GameState mState;
};
/* Minplayer, Maxplayer */
float GetScore(const GameState& state)
{
// 행 빙고를 이루었는가?
for (int i = 0; i < 3; i++)
{
bool same = true;
GameState::SquareState v = state.mBoard[i][0];
for (int j = 1; j < 3; j++)
{
if (state.mBoard[i][j] != v)
{
same = false;
}
}
if (same)
{
if (v == GameState::X)
{
return 1.0f;
}
else
{
return -1.0f;
}
}
}
// 열 빙고를 이루었는가?
for (int i = 0; i < 3; i++)
{
bool same = true;
GameState::SquareState v = state.mBoard[0][i];
for (int j = 1; j < 3; j++)
{
if (state.mBoard[j][i] != v)
{
same = false;
}
}
if (same)
{
if (v == GameState::X)
{
return 1.0f;
}
else
{
return -1.0f;
}
}
}
// 대각선 빙고를 이루었는가?
if ((state.mBoard[0][0] == state.mBoard[1][1] == state.mBoard[2][2]) || (state.mBoard[0][2] == state.mBoard[1][1] == state.mBoard[2][0]))
{
if (state.mBoard[1][1] == GameState::X)
return 1.0f;
else
return -1.0f;
}
// 무승부
return 0.0f;
}
float MinPlayer(const GTNode* node);
float MaxPlayer(const GTNode* node)
{
// 리프 노드라면 점수를 리턴한다
if (node->mChildren.empty())
{
return GetScore(node->mState);
}
// 최댓값을 가지는 하위 트리를 찾는다
float maxValue = -std::numeric_limits<float>::infinity();
for (const GTNode* child : node->mChildren)
{
maxValue = std::max(maxValue, MinPlayer(child));
}
return maxValue;
}
float MinPlayer(const GTNode* node)
{
// 리프 노드라면 점수를 리턴
if (node->mChildren.empty())
{
return GetScore(node->mState);
}
// 최솟값을 가지는 하위 트리를 찾는다
float minValue = std::numeric_limits<float>::infinity();
for (const GTNode* child : node->mChildren)
{
minValue = std::min(minValue, MaxPlayer(child));
}
return minValue;
}
const GTNode* MinimaxDecide(const GTNode* root)
{
// 최댓값을 가진 하위 트리를 찾고 해당 선택을 저장한다
const GTNode* choice = nullptr;
float maxValue = -std::numeric_limits<float>::infinity();
for (const GTNode* child : root->mChildren)
{
float v = MinPlayer(child);
if (v > maxValue)
{
maxValue = v;
choice = child;
}
}
return choice;
}
struct newGameState
{
public:
const bool IsTerminal() const { return true; } // 상태가 종료 상태면 true를 리턴
const float GetScore() const { return 0.0f; } // 종료되지 않은 상태의 휴리스틱 값을 리턴하거나, 종료 상태의 점수를 반환
const std::vector<newGameState*> GetPossibleMoves() const { std::vector<newGameState*> a; return a; }; // 현재 상태 이후에 움직일 수 있는 이동에 대한 게임 상태 백터를 리턴
};
float MinPlayerLimit(const newGameState* state, int depth);
float MaxPlayerLimit(const newGameState* state, int depth)
{
// depth가 0이거나, 상태가 terminal이면 최대 깊이에 도달했다는 의미
if (depth == 0 || state->IsTerminal())
{
return state->GetScore();
}
// 최댓값을 가진 하위 트리를 찾는다
float maxValue = -std::numeric_limits<float>::infinity();
for (const newGameState* child : state->GetPossibleMoves())
{
maxValue = std::max(maxValue, MinPlayerLimit(child, depth - 1));
}
return maxValue;
}
float MinPlayerLimit(const newGameState* state, int depth)
{
// depth가 0이거나, 상태가 terminal이면 최대 깊이에 도달했다는 의미
if (depth == 0 || state->IsTerminal())
{
return state->GetScore();
}
// 최댓값을 가진 하위 트리를 찾는다
float minValue = std::numeric_limits<float>::infinity();
for (const newGameState* child : state->GetPossibleMoves())
{
minValue = std::min(minValue, MaxPlayerLimit(child, depth - 1));
}
return minValue;
}
/* 알파 베타 가지치기 */
float AlphaBetaMin(const newGameState* node, int depth, float alpha, float beta);
const newGameState* AlphaBetaDecide(const newGameState* root, int maxDepth)
{
const newGameState* choice = nullptr;
// 알파는 음의 무한대, 베타는 양의 무한대에서 시작한다
float maxValue = -std::numeric_limits<float>::infinity();
float beta = std::numeric_limits<float>::infinity();
for (const newGameState* child : root->GetPossibleMoves())
{
float v = AlphaBetaMin(child, maxDepth - 1, maxValue, beta);
if (v > maxValue)
{
maxValue = v;
choice = child;
}
}
return choice;
}
float AlphaBetaMax(const newGameState* node, int depth, float alpha, float beta)
{
if (depth == 0 || node->IsTerminal())
{
return node->GetScore();
}
float maxValue = -std::numeric_limits<float>::infinity();
for (const newGameState* child : node->GetPossibleMoves())
{
maxValue = std::max(maxValue, AlphaBetaMin(child, depth - 1, alpha, beta));
if (maxValue >= beta)
{
return maxValue;
}
alpha = std::max(maxValue, alpha);
}
return maxValue;
}
float AlphaBetaMin(const newGameState* node, int depth, float alpha, float beta)
{
if (depth == 0 || node->IsTerminal())
{
return node->GetScore();
}
float minValue = std::numeric_limits<float>::infinity();
for (const newGameState* child : node->GetPossibleMoves())
{
minValue = std::min(minValue, AlphaBetaMax(child, depth - 1, alpha, beta));
if (minValue <= alpha)
{
return minValue;
}
beta = std::min(minValue, beta);
}
return minValue;
} | [
"[email protected]"
] | |
b2c0163f5ab96a73565934873818c3f76549c0c7 | c7ec870ad42a8ef1b4721e83f636d4533717d8a6 | /src/atlas-tx.cpp | 850126fd616d379fef4a3dfd4f7e05502c8fb2ae | [
"MIT"
] | permissive | TheRinger/Atlascoin | dcdab93e74e151d62e1efc8f4bb35f3e7b2d72ac | 21f6f2372e841fd3ba89e91086cbd5add3e4ef9b | refs/heads/master | 2020-04-06T22:16:48.957176 | 2018-11-16T07:43:21 | 2018-11-16T07:43:21 | 157,830,789 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 29,851 | cpp | // Copyright (c) 2009-2016 The Bitcoin Core developers
// Copyright (c) 2017 The Atlas Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include "config/atlas-config.h"
#endif
#include "base58.h"
#include "clientversion.h"
#include "coins.h"
#include "consensus/consensus.h"
#include "core_io.h"
#include "keystore.h"
#include "policy/policy.h"
#include "policy/rbf.h"
#include "primitives/transaction.h"
#include "script/script.h"
#include "script/sign.h"
#include <univalue.h>
#include "util.h"
#include "utilmoneystr.h"
#include "utilstrencodings.h"
#include <stdio.h>
#include <boost/algorithm/string.hpp>
static bool fCreateBlank;
static std::map<std::string,UniValue> registers;
static const int CONTINUE_EXECUTION=-1;
//
// This function returns either one of EXIT_ codes when it's expected to stop the process or
// CONTINUE_EXECUTION when it's expected to continue further.
//
static int AppInitRawTx(int argc, char* argv[])
{
//
// Parameters
//
gArgs.ParseParameters(argc, argv);
// Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
try {
SelectParams(ChainNameFromCommandLine());
} catch (const std::exception& e) {
fprintf(stderr, "Error: %s\n", e.what());
return EXIT_FAILURE;
}
fCreateBlank = gArgs.GetBoolArg("-create", false);
if (argc<2 || gArgs.IsArgSet("-?") || gArgs.IsArgSet("-h") || gArgs.IsArgSet("-help"))
{
// First part of help message is specific to this utility
std::string strUsage = strprintf(_("%s atlas-tx utility version"), _(PACKAGE_NAME)) + " " + FormatFullVersion() + "\n\n" +
_("Usage:") + "\n" +
" atlas-tx [options] <hex-tx> [commands] " + _("Update hex-encoded atlas transaction") + "\n" +
" atlas-tx [options] -create [commands] " + _("Create hex-encoded atlas transaction") + "\n" +
"\n";
fprintf(stdout, "%s", strUsage.c_str());
strUsage = HelpMessageGroup(_("Options:"));
strUsage += HelpMessageOpt("-?", _("This help message"));
strUsage += HelpMessageOpt("-create", _("Create new, empty TX."));
strUsage += HelpMessageOpt("-json", _("Select JSON output"));
strUsage += HelpMessageOpt("-txid", _("Output only the hex-encoded transaction id of the resultant transaction."));
AppendParamsHelpMessages(strUsage);
fprintf(stdout, "%s", strUsage.c_str());
strUsage = HelpMessageGroup(_("Commands:"));
strUsage += HelpMessageOpt("delin=N", _("Delete input N from TX"));
strUsage += HelpMessageOpt("delout=N", _("Delete output N from TX"));
strUsage += HelpMessageOpt("in=TXID:VOUT(:SEQUENCE_NUMBER)", _("Add input to TX"));
strUsage += HelpMessageOpt("locktime=N", _("Set TX lock time to N"));
strUsage += HelpMessageOpt("nversion=N", _("Set TX version to N"));
strUsage += HelpMessageOpt("replaceable(=N)", _("Set RBF opt-in sequence number for input N (if not provided, opt-in all available inputs)"));
strUsage += HelpMessageOpt("outaddr=VALUE:ADDRESS", _("Add address-based output to TX"));
strUsage += HelpMessageOpt("outpubkey=VALUE:PUBKEY[:FLAGS]", _("Add pay-to-pubkey output to TX") + ". " +
_("Optionally add the \"W\" flag to produce a pay-to-witness-pubkey-hash output") + ". " +
_("Optionally add the \"S\" flag to wrap the output in a pay-to-script-hash."));
strUsage += HelpMessageOpt("outdata=[VALUE:]DATA", _("Add data-based output to TX"));
strUsage += HelpMessageOpt("outscript=VALUE:SCRIPT[:FLAGS]", _("Add raw script output to TX") + ". " +
_("Optionally add the \"W\" flag to produce a pay-to-witness-script-hash output") + ". " +
_("Optionally add the \"S\" flag to wrap the output in a pay-to-script-hash."));
strUsage += HelpMessageOpt("outmultisig=VALUE:REQUIRED:PUBKEYS:PUBKEY1:PUBKEY2:....[:FLAGS]", _("Add Pay To n-of-m Multi-sig output to TX. n = REQUIRED, m = PUBKEYS") + ". " +
_("Optionally add the \"W\" flag to produce a pay-to-witness-script-hash output") + ". " +
_("Optionally add the \"S\" flag to wrap the output in a pay-to-script-hash."));
strUsage += HelpMessageOpt("sign=SIGHASH-FLAGS", _("Add zero or more signatures to transaction") + ". " +
_("This command requires JSON registers:") +
_("prevtxs=JSON object") + ", " +
_("privatekeys=JSON object") + ". " +
_("See signrawtransaction docs for format of sighash flags, JSON objects."));
fprintf(stdout, "%s", strUsage.c_str());
strUsage = HelpMessageGroup(_("Register Commands:"));
strUsage += HelpMessageOpt("load=NAME:FILENAME", _("Load JSON file FILENAME into register NAME"));
strUsage += HelpMessageOpt("set=NAME:JSON-STRING", _("Set register NAME to given JSON-STRING"));
fprintf(stdout, "%s", strUsage.c_str());
if (argc < 2) {
fprintf(stderr, "Error: too few parameters\n");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
return CONTINUE_EXECUTION;
}
static void RegisterSetJson(const std::string& key, const std::string& rawJson)
{
UniValue val;
if (!val.read(rawJson)) {
std::string strErr = "Cannot parse JSON for key " + key;
throw std::runtime_error(strErr);
}
registers[key] = val;
}
static void RegisterSet(const std::string& strInput)
{
// separate NAME:VALUE in string
size_t pos = strInput.find(':');
if ((pos == std::string::npos) ||
(pos == 0) ||
(pos == (strInput.size() - 1)))
throw std::runtime_error("Register input requires NAME:VALUE");
std::string key = strInput.substr(0, pos);
std::string valStr = strInput.substr(pos + 1, std::string::npos);
RegisterSetJson(key, valStr);
}
static void RegisterLoad(const std::string& strInput)
{
// separate NAME:FILENAME in string
size_t pos = strInput.find(':');
if ((pos == std::string::npos) ||
(pos == 0) ||
(pos == (strInput.size() - 1)))
throw std::runtime_error("Register load requires NAME:FILENAME");
std::string key = strInput.substr(0, pos);
std::string filename = strInput.substr(pos + 1, std::string::npos);
FILE *f = fopen(filename.c_str(), "r");
if (!f) {
std::string strErr = "Cannot open file " + filename;
throw std::runtime_error(strErr);
}
// load file chunks into one big buffer
std::string valStr;
while ((!feof(f)) && (!ferror(f))) {
char buf[4096];
int bread = fread(buf, 1, sizeof(buf), f);
if (bread <= 0)
break;
valStr.insert(valStr.size(), buf, bread);
}
int error = ferror(f);
fclose(f);
if (error) {
std::string strErr = "Error reading file " + filename;
throw std::runtime_error(strErr);
}
// evaluate as JSON buffer register
RegisterSetJson(key, valStr);
}
static CAmount ExtractAndValidateValue(const std::string& strValue)
{
CAmount value;
if (!ParseMoney(strValue, value))
throw std::runtime_error("invalid TX output value");
return value;
}
static void MutateTxVersion(CMutableTransaction& tx, const std::string& cmdVal)
{
int64_t newVersion = atoi64(cmdVal);
if (newVersion < 1 || newVersion > CTransaction::MAX_STANDARD_VERSION)
throw std::runtime_error("Invalid TX version requested");
tx.nVersion = (int) newVersion;
}
static void MutateTxLocktime(CMutableTransaction& tx, const std::string& cmdVal)
{
int64_t newLocktime = atoi64(cmdVal);
if (newLocktime < 0LL || newLocktime > 0xffffffffLL)
throw std::runtime_error("Invalid TX locktime requested");
tx.nLockTime = (unsigned int) newLocktime;
}
static void MutateTxRBFOptIn(CMutableTransaction& tx, const std::string& strInIdx)
{
// parse requested index
int inIdx = atoi(strInIdx);
if (inIdx < 0 || inIdx >= (int)tx.vin.size()) {
throw std::runtime_error("Invalid TX input index '" + strInIdx + "'");
}
// set the nSequence to MAX_INT - 2 (= RBF opt in flag)
int cnt = 0;
for (CTxIn& txin : tx.vin) {
if (strInIdx == "" || cnt == inIdx) {
if (txin.nSequence > MAX_BIP125_RBF_SEQUENCE) {
txin.nSequence = MAX_BIP125_RBF_SEQUENCE;
}
}
++cnt;
}
}
static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInput)
{
std::vector<std::string> vStrInputParts;
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
// separate TXID:VOUT in string
if (vStrInputParts.size()<2)
throw std::runtime_error("TX input missing separator");
// extract and validate TXID
std::string strTxid = vStrInputParts[0];
if ((strTxid.size() != 64) || !IsHex(strTxid))
throw std::runtime_error("invalid TX input txid");
uint256 txid(uint256S(strTxid));
static const unsigned int minTxOutSz = 9;
// Deprecated with RIP2 implementation
// static const unsigned int maxVout = MAX_BLOCK_WEIGHT / (WITNESS_SCALE_FACTOR * minTxOutSz);
unsigned int maxVout = 0;
if (fAssetsIsActive) {
maxVout = MAX_BLOCK_WEIGHT_RIP2 / (WITNESS_SCALE_FACTOR * minTxOutSz);
} else {
maxVout = MAX_BLOCK_WEIGHT / (WITNESS_SCALE_FACTOR * minTxOutSz);
}
// extract and validate vout
std::string strVout = vStrInputParts[1];
int vout = atoi(strVout);
if ((vout < 0) || (vout > (int)maxVout))
throw std::runtime_error("invalid TX input vout");
// extract the optional sequence number
uint32_t nSequenceIn=std::numeric_limits<unsigned int>::max();
if (vStrInputParts.size() > 2)
nSequenceIn = std::stoul(vStrInputParts[2]);
// append to transaction input list
CTxIn txin(txid, vout, CScript(), nSequenceIn);
tx.vin.push_back(txin);
}
static void MutateTxAddOutAddr(CMutableTransaction& tx, const std::string& strInput)
{
// Separate into VALUE:ADDRESS
std::vector<std::string> vStrInputParts;
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
if (vStrInputParts.size() != 2)
throw std::runtime_error("TX output missing or too many separators");
// Extract and validate VALUE
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
// extract and validate ADDRESS
std::string strAddr = vStrInputParts[1];
CTxDestination destination = DecodeDestination(strAddr);
if (!IsValidDestination(destination)) {
throw std::runtime_error("invalid TX output address");
}
CScript scriptPubKey = GetScriptForDestination(destination);
// construct TxOut, append to transaction output list
CTxOut txout(value, scriptPubKey);
tx.vout.push_back(txout);
}
static void MutateTxAddOutPubKey(CMutableTransaction& tx, const std::string& strInput)
{
// Separate into VALUE:PUBKEY[:FLAGS]
std::vector<std::string> vStrInputParts;
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
if (vStrInputParts.size() < 2 || vStrInputParts.size() > 3)
throw std::runtime_error("TX output missing or too many separators");
// Extract and validate VALUE
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
// Extract and validate PUBKEY
CPubKey pubkey(ParseHex(vStrInputParts[1]));
if (!pubkey.IsFullyValid())
throw std::runtime_error("invalid TX output pubkey");
CScript scriptPubKey = GetScriptForRawPubKey(pubkey);
// Extract and validate FLAGS
bool bSegWit = false;
bool bScriptHash = false;
if (vStrInputParts.size() == 3) {
std::string flags = vStrInputParts[2];
bSegWit = (flags.find("W") != std::string::npos);
bScriptHash = (flags.find("S") != std::string::npos);
}
if (bSegWit) {
if (!pubkey.IsCompressed()) {
throw std::runtime_error("Uncompressed pubkeys are not useable for SegWit outputs");
}
// Call GetScriptForWitness() to build a P2WSH scriptPubKey
scriptPubKey = GetScriptForWitness(scriptPubKey);
}
if (bScriptHash) {
// Get the ID for the script, and then construct a P2SH destination for it.
scriptPubKey = GetScriptForDestination(CScriptID(scriptPubKey));
}
// construct TxOut, append to transaction output list
CTxOut txout(value, scriptPubKey);
tx.vout.push_back(txout);
}
static void MutateTxAddOutMultiSig(CMutableTransaction& tx, const std::string& strInput)
{
// Separate into VALUE:REQUIRED:NUMKEYS:PUBKEY1:PUBKEY2:....[:FLAGS]
std::vector<std::string> vStrInputParts;
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
// Check that there are enough parameters
if (vStrInputParts.size()<3)
throw std::runtime_error("Not enough multisig parameters");
// Extract and validate VALUE
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
// Extract REQUIRED
uint32_t required = stoul(vStrInputParts[1]);
// Extract NUMKEYS
uint32_t numkeys = stoul(vStrInputParts[2]);
// Validate there are the correct number of pubkeys
if (vStrInputParts.size() < numkeys + 3)
throw std::runtime_error("incorrect number of multisig pubkeys");
if (required < 1 || required > 20 || numkeys < 1 || numkeys > 20 || numkeys < required)
throw std::runtime_error("multisig parameter mismatch. Required " \
+ std::to_string(required) + " of " + std::to_string(numkeys) + "signatures.");
// extract and validate PUBKEYs
std::vector<CPubKey> pubkeys;
for(int pos = 1; pos <= int(numkeys); pos++) {
CPubKey pubkey(ParseHex(vStrInputParts[pos + 2]));
if (!pubkey.IsFullyValid())
throw std::runtime_error("invalid TX output pubkey");
pubkeys.push_back(pubkey);
}
// Extract FLAGS
bool bSegWit = false;
bool bScriptHash = false;
if (vStrInputParts.size() == numkeys + 4) {
std::string flags = vStrInputParts.back();
bSegWit = (flags.find("W") != std::string::npos);
bScriptHash = (flags.find("S") != std::string::npos);
}
else if (vStrInputParts.size() > numkeys + 4) {
// Validate that there were no more parameters passed
throw std::runtime_error("Too many parameters");
}
CScript scriptPubKey = GetScriptForMultisig(required, pubkeys);
if (bSegWit) {
for (CPubKey& pubkey : pubkeys) {
if (!pubkey.IsCompressed()) {
throw std::runtime_error("Uncompressed pubkeys are not useable for SegWit outputs");
}
}
// Call GetScriptForWitness() to build a P2WSH scriptPubKey
scriptPubKey = GetScriptForWitness(scriptPubKey);
}
if (bScriptHash) {
// Get the ID for the script, and then construct a P2SH destination for it.
scriptPubKey = GetScriptForDestination(CScriptID(scriptPubKey));
}
// construct TxOut, append to transaction output list
CTxOut txout(value, scriptPubKey);
tx.vout.push_back(txout);
}
static void MutateTxAddOutData(CMutableTransaction& tx, const std::string& strInput)
{
CAmount value = 0;
// separate [VALUE:]DATA in string
size_t pos = strInput.find(':');
if (pos==0)
throw std::runtime_error("TX output value not specified");
if (pos != std::string::npos) {
// Extract and validate VALUE
value = ExtractAndValidateValue(strInput.substr(0, pos));
}
// extract and validate DATA
std::string strData = strInput.substr(pos + 1, std::string::npos);
if (!IsHex(strData))
throw std::runtime_error("invalid TX output data");
std::vector<unsigned char> data = ParseHex(strData);
CTxOut txout(value, CScript() << OP_RETURN << data);
tx.vout.push_back(txout);
}
static void MutateTxAddOutScript(CMutableTransaction& tx, const std::string& strInput)
{
// separate VALUE:SCRIPT[:FLAGS]
std::vector<std::string> vStrInputParts;
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
if (vStrInputParts.size() < 2)
throw std::runtime_error("TX output missing separator");
// Extract and validate VALUE
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
// extract and validate script
std::string strScript = vStrInputParts[1];
CScript scriptPubKey = ParseScript(strScript);
// Extract FLAGS
bool bSegWit = false;
bool bScriptHash = false;
if (vStrInputParts.size() == 3) {
std::string flags = vStrInputParts.back();
bSegWit = (flags.find("W") != std::string::npos);
bScriptHash = (flags.find("S") != std::string::npos);
}
if (bSegWit) {
scriptPubKey = GetScriptForWitness(scriptPubKey);
}
if (bScriptHash) {
scriptPubKey = GetScriptForDestination(CScriptID(scriptPubKey));
}
// construct TxOut, append to transaction output list
CTxOut txout(value, scriptPubKey);
tx.vout.push_back(txout);
}
static void MutateTxDelInput(CMutableTransaction& tx, const std::string& strInIdx)
{
// parse requested deletion index
int inIdx = atoi(strInIdx);
if (inIdx < 0 || inIdx >= (int)tx.vin.size()) {
std::string strErr = "Invalid TX input index '" + strInIdx + "'";
throw std::runtime_error(strErr.c_str());
}
// delete input from transaction
tx.vin.erase(tx.vin.begin() + inIdx);
}
static void MutateTxDelOutput(CMutableTransaction& tx, const std::string& strOutIdx)
{
// parse requested deletion index
int outIdx = atoi(strOutIdx);
if (outIdx < 0 || outIdx >= (int)tx.vout.size()) {
std::string strErr = "Invalid TX output index '" + strOutIdx + "'";
throw std::runtime_error(strErr.c_str());
}
// delete output from transaction
tx.vout.erase(tx.vout.begin() + outIdx);
}
static const unsigned int N_SIGHASH_OPTS = 6;
static const struct {
const char *flagStr;
int flags;
} sighashOptions[N_SIGHASH_OPTS] = {
{"ALL", SIGHASH_ALL},
{"NONE", SIGHASH_NONE},
{"SINGLE", SIGHASH_SINGLE},
{"ALL|ANYONECANPAY", SIGHASH_ALL|SIGHASH_ANYONECANPAY},
{"NONE|ANYONECANPAY", SIGHASH_NONE|SIGHASH_ANYONECANPAY},
{"SINGLE|ANYONECANPAY", SIGHASH_SINGLE|SIGHASH_ANYONECANPAY},
};
static bool findSighashFlags(int& flags, const std::string& flagStr)
{
flags = 0;
for (unsigned int i = 0; i < N_SIGHASH_OPTS; i++) {
if (flagStr == sighashOptions[i].flagStr) {
flags = sighashOptions[i].flags;
return true;
}
}
return false;
}
static CAmount AmountFromValue(const UniValue& value)
{
if (!value.isNum() && !value.isStr())
throw std::runtime_error("Amount is not a number or string");
CAmount amount;
if (!ParseFixedPoint(value.getValStr(), 8, &amount))
throw std::runtime_error("Invalid amount");
if (!MoneyRange(amount))
throw std::runtime_error("Amount out of range");
return amount;
}
static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr)
{
int nHashType = SIGHASH_ALL;
if (flagStr.size() > 0)
if (!findSighashFlags(nHashType, flagStr))
throw std::runtime_error("unknown sighash flag/sign option");
std::vector<CTransaction> txVariants;
txVariants.push_back(tx);
// mergedTx will end up with all the signatures; it
// starts as a clone of the raw tx:
CMutableTransaction mergedTx(txVariants[0]);
bool fComplete = true;
CCoinsView viewDummy;
CCoinsViewCache view(&viewDummy);
if (!registers.count("privatekeys"))
throw std::runtime_error("privatekeys register variable must be set.");
CBasicKeyStore tempKeystore;
UniValue keysObj = registers["privatekeys"];
for (unsigned int kidx = 0; kidx < keysObj.size(); kidx++) {
if (!keysObj[kidx].isStr())
throw std::runtime_error("privatekey not a std::string");
CAtlasSecret vchSecret;
bool fGood = vchSecret.SetString(keysObj[kidx].getValStr());
if (!fGood)
throw std::runtime_error("privatekey not valid");
CKey key = vchSecret.GetKey();
tempKeystore.AddKey(key);
}
// Add previous txouts given in the RPC call:
if (!registers.count("prevtxs"))
throw std::runtime_error("prevtxs register variable must be set.");
UniValue prevtxsObj = registers["prevtxs"];
{
for (unsigned int previdx = 0; previdx < prevtxsObj.size(); previdx++) {
UniValue prevOut = prevtxsObj[previdx];
if (!prevOut.isObject())
throw std::runtime_error("expected prevtxs internal object");
std::map<std::string, UniValue::VType> types = {
{"txid", UniValue::VSTR},
{"vout", UniValue::VNUM},
{"scriptPubKey", UniValue::VSTR},
};
if (!prevOut.checkObject(types))
throw std::runtime_error("prevtxs internal object typecheck fail");
uint256 txid = ParseHashUV(prevOut["txid"], "txid");
int nOut = atoi(prevOut["vout"].getValStr());
if (nOut < 0)
throw std::runtime_error("vout must be positive");
COutPoint out(txid, nOut);
std::vector<unsigned char> pkData(ParseHexUV(prevOut["scriptPubKey"], "scriptPubKey"));
CScript scriptPubKey(pkData.begin(), pkData.end());
{
const Coin& coin = view.AccessCoin(out);
if (!coin.IsSpent() && coin.out.scriptPubKey != scriptPubKey) {
std::string err("Previous output scriptPubKey mismatch:\n");
err = err + ScriptToAsmStr(coin.out.scriptPubKey) + "\nvs:\n"+
ScriptToAsmStr(scriptPubKey);
throw std::runtime_error(err);
}
Coin newcoin;
newcoin.out.scriptPubKey = scriptPubKey;
newcoin.out.nValue = 0;
if (prevOut.exists("amount")) {
newcoin.out.nValue = AmountFromValue(prevOut["amount"]);
}
newcoin.nHeight = 1;
view.AddCoin(out, std::move(newcoin), true);
}
// if redeemScript given and private keys given,
// add redeemScript to the tempKeystore so it can be signed:
if ((scriptPubKey.IsPayToScriptHash() || scriptPubKey.IsPayToWitnessScriptHash()) &&
prevOut.exists("redeemScript")) {
UniValue v = prevOut["redeemScript"];
std::vector<unsigned char> rsData(ParseHexUV(v, "redeemScript"));
CScript redeemScript(rsData.begin(), rsData.end());
tempKeystore.AddCScript(redeemScript);
}
}
}
const CKeyStore& keystore = tempKeystore;
bool fHashSingle = ((nHashType & ~SIGHASH_ANYONECANPAY) == SIGHASH_SINGLE);
// Sign what we can:
for (unsigned int i = 0; i < mergedTx.vin.size(); i++) {
CTxIn& txin = mergedTx.vin[i];
const Coin& coin = view.AccessCoin(txin.prevout);
if (coin.IsSpent()) {
fComplete = false;
continue;
}
const CScript& prevPubKey = coin.out.scriptPubKey;
const CAmount& amount = coin.out.nValue;
SignatureData sigdata;
// Only sign SIGHASH_SINGLE if there's a corresponding output:
if (!fHashSingle || (i < mergedTx.vout.size()))
ProduceSignature(MutableTransactionSignatureCreator(&keystore, &mergedTx, i, amount, nHashType), prevPubKey, sigdata);
// ... and merge in other signatures:
for (const CTransaction& txv : txVariants)
sigdata = CombineSignatures(prevPubKey, MutableTransactionSignatureChecker(&mergedTx, i, amount), sigdata, DataFromTransaction(txv, i));
UpdateTransaction(mergedTx, i, sigdata);
if (!VerifyScript(txin.scriptSig, prevPubKey, &txin.scriptWitness, STANDARD_SCRIPT_VERIFY_FLAGS, MutableTransactionSignatureChecker(&mergedTx, i, amount)))
fComplete = false;
}
if (fComplete) {
// do nothing... for now
// perhaps store this for later optional JSON output
}
tx = mergedTx;
}
class Secp256k1Init
{
ECCVerifyHandle globalVerifyHandle;
public:
Secp256k1Init() {
ECC_Start();
}
~Secp256k1Init() {
ECC_Stop();
}
};
static void MutateTx(CMutableTransaction& tx, const std::string& command,
const std::string& commandVal)
{
std::unique_ptr<Secp256k1Init> ecc;
if (command == "nversion")
MutateTxVersion(tx, commandVal);
else if (command == "locktime")
MutateTxLocktime(tx, commandVal);
else if (command == "replaceable") {
MutateTxRBFOptIn(tx, commandVal);
}
else if (command == "delin")
MutateTxDelInput(tx, commandVal);
else if (command == "in")
MutateTxAddInput(tx, commandVal);
else if (command == "delout")
MutateTxDelOutput(tx, commandVal);
else if (command == "outaddr")
MutateTxAddOutAddr(tx, commandVal);
else if (command == "outpubkey") {
ecc.reset(new Secp256k1Init());
MutateTxAddOutPubKey(tx, commandVal);
} else if (command == "outmultisig") {
ecc.reset(new Secp256k1Init());
MutateTxAddOutMultiSig(tx, commandVal);
} else if (command == "outscript")
MutateTxAddOutScript(tx, commandVal);
else if (command == "outdata")
MutateTxAddOutData(tx, commandVal);
else if (command == "sign") {
ecc.reset(new Secp256k1Init());
MutateTxSign(tx, commandVal);
}
else if (command == "load")
RegisterLoad(commandVal);
else if (command == "set")
RegisterSet(commandVal);
else
throw std::runtime_error("unknown command");
}
static void OutputTxJSON(const CTransaction& tx)
{
UniValue entry(UniValue::VOBJ);
TxToUniv(tx, uint256(), entry);
std::string jsonOutput = entry.write(4);
fprintf(stdout, "%s\n", jsonOutput.c_str());
}
static void OutputTxHash(const CTransaction& tx)
{
std::string strHexHash = tx.GetHash().GetHex(); // the hex-encoded transaction hash (aka the transaction id)
fprintf(stdout, "%s\n", strHexHash.c_str());
}
static void OutputTxHex(const CTransaction& tx)
{
std::string strHex = EncodeHexTx(tx);
fprintf(stdout, "%s\n", strHex.c_str());
}
static void OutputTx(const CTransaction& tx)
{
if (gArgs.GetBoolArg("-json", false))
OutputTxJSON(tx);
else if (gArgs.GetBoolArg("-txid", false))
OutputTxHash(tx);
else
OutputTxHex(tx);
}
static std::string readStdin()
{
char buf[4096];
std::string ret;
while (!feof(stdin)) {
size_t bread = fread(buf, 1, sizeof(buf), stdin);
ret.append(buf, bread);
if (bread < sizeof(buf))
break;
}
if (ferror(stdin))
throw std::runtime_error("error reading stdin");
boost::algorithm::trim_right(ret);
return ret;
}
static int CommandLineRawTx(int argc, char* argv[])
{
std::string strPrint;
int nRet = 0;
try {
// Skip switches; Permit common stdin convention "-"
while (argc > 1 && IsSwitchChar(argv[1][0]) &&
(argv[1][1] != 0)) {
argc--;
argv++;
}
CMutableTransaction tx;
int startArg;
if (!fCreateBlank) {
// require at least one param
if (argc < 2)
throw std::runtime_error("too few parameters");
// param: hex-encoded atlas transaction
std::string strHexTx(argv[1]);
if (strHexTx == "-") // "-" implies standard input
strHexTx = readStdin();
if (!DecodeHexTx(tx, strHexTx, true))
throw std::runtime_error("invalid transaction encoding");
startArg = 2;
} else
startArg = 1;
for (int i = startArg; i < argc; i++) {
std::string arg = argv[i];
std::string key, value;
size_t eqpos = arg.find('=');
if (eqpos == std::string::npos)
key = arg;
else {
key = arg.substr(0, eqpos);
value = arg.substr(eqpos + 1);
}
MutateTx(tx, key, value);
}
OutputTx(tx);
}
catch (const boost::thread_interrupted&) {
throw;
}
catch (const std::exception& e) {
strPrint = std::string("error: ") + e.what();
nRet = EXIT_FAILURE;
}
catch (...) {
PrintExceptionContinue(nullptr, "CommandLineRawTx()");
throw;
}
if (strPrint != "") {
fprintf((nRet == 0 ? stdout : stderr), "%s\n", strPrint.c_str());
}
return nRet;
}
int main(int argc, char* argv[])
{
SetupEnvironment();
try {
int ret = AppInitRawTx(argc, argv);
if (ret != CONTINUE_EXECUTION)
return ret;
}
catch (const std::exception& e) {
PrintExceptionContinue(&e, "AppInitRawTx()");
return EXIT_FAILURE;
} catch (...) {
PrintExceptionContinue(nullptr, "AppInitRawTx()");
return EXIT_FAILURE;
}
int ret = EXIT_FAILURE;
try {
ret = CommandLineRawTx(argc, argv);
}
catch (const std::exception& e) {
PrintExceptionContinue(&e, "CommandLineRawTx()");
} catch (...) {
PrintExceptionContinue(nullptr, "CommandLineRawTx()");
}
return ret;
}
| [
"[email protected]"
] | |
d72899f55df7539da783cd9298e11017edebd213 | 90394b562845fca99c32b46297b35920bc39f851 | /include/base/atomicops.h | de85efd9ac088eaabc66b3d75dc756e53fa8de33 | [] | no_license | xuyuandong/libmf | 03139eb0d8e677cfe704ba5bcbba28ccf039ec5b | a9622d5c6bca2ebb577dc249525c79693d5f5f12 | refs/heads/master | 2016-08-02T23:38:51.103607 | 2013-12-10T11:25:58 | 2013-12-10T11:25:58 | 15,075,188 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,589 | h | // Copyright (c) 2006-2008 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.
// For atomic operations on reference counts, see atomic_refcount.h.
// For atomic operations on sequence numbers, see atomic_sequence_num.h.
// The routines exported by this module are subtle. If you use them, even if
// you get the code right, it will depend on careful reasoning about atomicity
// and memory ordering; it will be less readable, and harder to maintain. If
// you plan to use these routines, you should have a good reason, such as solid
// evidence that performance would otherwise suffer, or there being no
// alternative. You should assume only properties explicitly guaranteed by the
// specifications in this file. You are almost certainly _not_ writing code
// just for the x86; if you assume x86 semantics, x86 hardware bugs and
// implementations on other archtectures will cause your code to break. If you
// do not know what you are doing, avoid these routines, and use a Mutex.
//
// It is incorrect to make direct assignments to/from an atomic variable.
// You should use one of the Load or Store routines. The NoBarrier
// versions are provided when no barriers are needed:
// NoBarrier_Store()
// NoBarrier_Load()
// Although there are currently no compiler enforcement, you are encouraged
// to use these.
//
#ifndef BASE_ATOMICOPS_H_
#define BASE_ATOMICOPS_H_
#include "base/basictypes.h"
#include "base/port.h"
namespace base {
namespace subtle {
typedef int32 Atomic32;
// We need to be able to go between Atomic64 and AtomicWord implicitly. This
// means Atomic64 and AtomicWord should be the same type on 64-bit.
typedef intptr_t Atomic64;
// Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or
// Atomic64 routines below, depending on your architecture.
typedef intptr_t AtomicWord;
// Atomically execute:
// result = *ptr;
// if (*ptr == old_value)
// *ptr = new_value;
// return result;
//
// I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value".
// Always return the old value of "*ptr"
//
// This routine implies no memory barriers.
Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value);
// Atomically store new_value into *ptr, returning the previous value held in
// *ptr. This routine implies no memory barriers.
Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, Atomic32 new_value);
// Atomically increment *ptr by "increment". Returns the new value of
// *ptr with the increment applied. This routine implies no memory barriers.
Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment);
Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
Atomic32 increment);
// These following lower-level operations are typically useful only to people
// implementing higher-level synchronization operations like spinlocks,
// mutexes, and condition-variables. They combine CompareAndSwap(), a load, or
// a store with appropriate memory-ordering instructions. "Acquire" operations
// ensure that no later memory access can be reordered ahead of the operation.
// "Release" operations ensure that no previous memory access can be reordered
// after the operation. "Barrier" operations have both "Acquire" and "Release"
// semantics. A MemoryBarrier() has "Barrier" semantics, but does no memory
// access.
Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value);
Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value);
void MemoryBarrier();
void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value);
void Acquire_Store(volatile Atomic32* ptr, Atomic32 value);
void Release_Store(volatile Atomic32* ptr, Atomic32 value);
Atomic32 NoBarrier_Load(volatile const Atomic32* ptr);
Atomic32 Acquire_Load(volatile const Atomic32* ptr);
Atomic32 Release_Load(volatile const Atomic32* ptr);
// 64-bit atomic operations (only available on 64-bit processors).
Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
Atomic64 old_value,
Atomic64 new_value);
Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, Atomic64 new_value);
Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment);
Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment);
Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
Atomic64 old_value,
Atomic64 new_value);
Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
Atomic64 old_value,
Atomic64 new_value);
void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value);
void Acquire_Store(volatile Atomic64* ptr, Atomic64 value);
void Release_Store(volatile Atomic64* ptr, Atomic64 value);
Atomic64 NoBarrier_Load(volatile const Atomic64* ptr);
Atomic64 Acquire_Load(volatile const Atomic64* ptr);
Atomic64 Release_Load(volatile const Atomic64* ptr);
} // namespace base::subtle
} // namespace base
// Include our platform specific implementation.
#include "base/atomicops_internals_x86_gcc.h"
#endif // BASE_ATOMICOPS_H_
| [
"[email protected]"
] | |
4ef2ea0e0968f2b17ff0b73db43d950e200a20cc | 43788b330ade2fb8f785cbf59e9d90ef6153d6fc | /Lecture_QT/Snapshots/snapshot_lecture4/chapter5/example5_20/ellipsis.cpp | 587146c683fff7ef4687cd927ee7ce4f60e50c83 | [] | no_license | bowei437/Applied-Software-Design--ECE-3574 | c1c07c43ea74d9ec6d8e162e0a08bb66ca60ef81 | cfdd5156bf71efe4f1112fb80d1f2122825ccd5c | refs/heads/master | 2021-09-11T12:34:54.461844 | 2018-04-06T22:37:15 | 2018-04-06T22:37:15 | 82,984,674 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 397 | cpp | #include <cstdarg>
#include <iostream>
using namespace std;
double mean (int n ...) {
va_list ap;
double sum(0);
int count(n);
va_start(ap, n);
for (int i =0; i < count; ++i) {
sum += va_arg(ap, double);
}
va_end(ap);
return (sum/count);
}
int main() {
cout << mean(4, 11.3, 22.5, 33.7, 44.9) << endl;
cout << mean(5, 13.4, 22.5, 123.45, 421.33, 2525.353) << endl;
}
| [
"[email protected]"
] | |
e0233a7078396bb7a33287c4572391403f25a89d | d95be5b2343e61228186c6a34a27c3e35a7bfbe9 | /mvIMPACT_acquire-arm-2.5.4/Toolkits/expat/include/ExpatImpl.h | e854405fdbbe85d3db5da5ecba0fd228a5097e1b | [] | no_license | loiannog/odroid_camera | 43ede30e1f4a17e0bbbfb20b4053b67c5b865f9a | db1f36f5d18644d42ec282c30f779188d35f9c72 | refs/heads/master | 2021-01-23T11:07:21.218810 | 2013-12-20T18:57:55 | 2013-12-20T18:57:55 | 15,052,567 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,639 | h | #ifndef DSSI_EXPATIMPL_H
#define DSSI_EXPATIMPL_H
//-----------------------------------------------------------------------------
//
// @doc
//
// @module ExpatImpl.h - Expat class container |
//
// This module contains the definition of the expat class container.
//
// Copyright (c) 1994-2002 - Descartes Systems Sciences, Inc.
//
// @end
//
// $History: ExpatImpl.h $
//
// ***************** Version 1 *****************
// User: Tim Smith Date: 1/29/02 Time: 1:57p
// Created in $/Omni_V2/_ToolLib
// 1. String.h now replaced with StringCode.h.
// 2. StringRsrc.h modified to use new string class.
// 3. Added tons of new classes from the wedge work.
//
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//
// Required include files
//
//-----------------------------------------------------------------------------
#include <assert.h>
#include "expat.h"
//-----------------------------------------------------------------------------
//
// Forward definitions
//
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//
// Template class definition
//
//-----------------------------------------------------------------------------
template <class _T>
class CExpatImpl
{
// @access Constructors and destructors
public:
// @cmember General constructor
CExpatImpl() : m_p(0) {}
// @cmember Destructor
virtual ~CExpatImpl ()
{
Destroy ();
}
// @access Parser creation and deletion methods
public:
// @cmember Create a parser
bool Create (const XML_Char *pszEncoding = NULL,
const XML_Char *pszSep = NULL)
{
//
// Destroy the old parser
//
Destroy ();
//
// If the encoding or seperator are empty, then NULL
//
if (pszEncoding != NULL && pszEncoding [0] == 0)
pszEncoding = NULL;
if (pszSep != NULL && pszSep [0] == 0)
pszSep = NULL;
//
// Create the new one
//
m_p = XML_ParserCreate_MM (pszEncoding, NULL, pszSep);
if (m_p == NULL)
return false;
//
// Invoke the post create routine
//
_T *pThis = static_cast <_T *> (this);
pThis ->OnPostCreate ();
//
// Set the user data used in callbacks
//
XML_SetUserData (m_p, (void *) this);
return true;
}
// @cmember Destroy the parser
void Destroy ()
{
if (m_p != NULL)
XML_ParserFree (m_p);
m_p = NULL;
}
// @access Parser parse methods
public:
// @cmember Parse a block of data
bool Parse (const char *pszBuffer, int nLength = -1, bool fIsFinal = true)
{
//
// Validate
//
assert (m_p != NULL);
//
// Get the length if not specified
//
if (nLength < 0)
nLength = static_cast<int>(strlen( pszBuffer ));
//
// Invoke the parser
//
return XML_Parse (m_p, pszBuffer, nLength, fIsFinal) != 0;
}
// @cmember Parse a block of data
#ifdef WCHAR
bool Parse (const WCHAR *pszBuffer, int nLength = -1, bool fIsFinal = true)
{
//
// Validate
//
assert (m_p != NULL);
//
// Get the length if not specified
//
if (nLength < 0)
nLength = wcslen (pszBuffer) * 2;
//
// Invoke the parser
//
return XML_Parse (m_p, pszBuffer, nLength, fIsFinal) != 0;
}
#endif
// @cmember Parse internal buffer
bool ParseBuffer (int nLength, bool fIsFinal = true)
{
assert (m_p != NULL);
return XML_ParseBuffer (m_p, nLength, fIsFinal) != 0;
}
// @cmember Get the internal buffer
void *GetBuffer (int nLength)
{
assert (m_p != NULL);
return XML_GetBuffer (m_p, nLength);
}
// @access Parser callback enable/disable methods
public:
// @cmember Enable/Disable the start element handler
void EnableStartElementHandler (bool fEnable = true)
{
assert (m_p != NULL);
XML_SetStartElementHandler (m_p, fEnable ? StartElementHandler : NULL);
}
// @cmember Enable/Disable the end element handler
void EnableEndElementHandler (bool fEnable = true)
{
assert (m_p != NULL);
XML_SetEndElementHandler (m_p, fEnable ? EndElementHandler : NULL);
}
// @cmember Enable/Disable the element handlers
void EnableElementHandler (bool fEnable = true)
{
assert (m_p != NULL);
EnableStartElementHandler (fEnable);
EnableEndElementHandler (fEnable);
}
// @cmember Enable/Disable the character data handler
void EnableCharacterDataHandler (bool fEnable = true)
{
assert (m_p != NULL);
XML_SetCharacterDataHandler (m_p,
fEnable ? CharacterDataHandler : NULL);
}
// @cmember Enable/Disable the processing instruction handler
void EnableProcessingInstructionHandler (bool fEnable = true)
{
assert (m_p != NULL);
XML_SetProcessingInstructionHandler (m_p,
fEnable ? ProcessingInstructionHandler : NULL);
}
// @cmember Enable/Disable the comment handler
void EnableCommentHandler (bool fEnable = true)
{
assert (m_p != NULL);
XML_SetCommentHandler (m_p, fEnable ? CommentHandler : NULL);
}
// @cmember Enable/Disable the start CDATA section handler
void EnableStartCdataSectionHandler (bool fEnable = true)
{
assert (m_p != NULL);
XML_SetStartCdataSectionHandler (m_p,
fEnable ? StartCdataSectionHandler : NULL);
}
// @cmember Enable/Disable the end CDATA section handler
void EnableEndCdataSectionHandler (bool fEnable = true)
{
assert (m_p != NULL);
XML_SetEndCdataSectionHandler (m_p,
fEnable ? EndCdataSectionHandler : NULL);
}
// @cmember Enable/Disable the CDATA section handlers
void EnableCdataSectionHandler (bool fEnable = true)
{
assert (m_p != NULL);
EnableStartCdataSectionHandler (fEnable);
EnableEndCdataSectionHandler (fEnable);
}
// @cmember Enable/Disable default handler
void EnableDefaultHandler (bool fEnable = true, bool fExpand = true)
{
assert (m_p != NULL);
if (fExpand)
{
XML_SetDefaultHandlerExpand (m_p,
fEnable ? DefaultHandler : NULL);
}
else
XML_SetDefaultHandler (m_p, fEnable ? DefaultHandler : NULL);
}
// @cmember Enable/Disable external entity ref handler
void EnableExternalEntityRefHandler (bool fEnable = true)
{
assert (m_p != NULL);
XML_SetExternalEntityRefHandler (m_p,
fEnable ? ExternalEntityRefHandler : NULL);
}
// @cmember Enable/Disable unknown encoding handler
void EnableUnknownEncodingHandler (bool fEnable = true)
{
assert (m_p != NULL);
XML_SetUnknownEncodingHandler (m_p,
fEnable ? UnknownEncodingHandler : NULL);
}
// @cmember Enable/Disable start namespace handler
void EnableStartNamespaceDeclHandler (bool fEnable = true)
{
assert (m_p != NULL);
XML_SetStartNamespaceDeclHandler (m_p,
fEnable ? StartNamespaceDeclHandler : NULL);
}
// @cmember Enable/Disable end namespace handler
void EnableEndNamespaceDeclHandler (bool fEnable = true)
{
assert (m_p != NULL);
XML_SetEndNamespaceDeclHandler (m_p,
fEnable ? EndNamespaceDeclHandler : NULL);
}
// @cmember Enable/Disable namespace handlers
void EnableNamespaceDeclHandler (bool fEnable = true)
{
EnableStartNamespaceDeclHandler (fEnable);
EnableEndNamespaceDeclHandler (fEnable);
}
// @cmember Enable/Disable the XML declaration handler
void EnableXmlDeclHandler (bool fEnable = true)
{
assert (m_p != NULL);
XML_SetXmlDeclHandler (m_p, fEnable ? XmlDeclHandler : NULL);
}
// @cmember Enable/Disable the start DOCTYPE declaration handler
void EnableStartDoctypeDeclHandler (bool fEnable = true)
{
assert (m_p != NULL);
XML_SetStartDoctypeDeclHandler (m_p,
fEnable ? StartDoctypeDeclHandler : NULL);
}
// @cmember Enable/Disable the end DOCTYPE declaration handler
void EnableEndDoctypeDeclHandler (bool fEnable = true)
{
assert (m_p != NULL);
XML_SetEndDoctypeDeclHandler (m_p,
fEnable ? EndDoctypeDeclHandler : NULL);
}
// @cmember Enable/Disable the DOCTYPE declaration handler
void EnableDoctypeDeclHandler (bool fEnable = true)
{
assert (m_p != NULL);
EnableStartDoctypeDeclHandler (fEnable);
EnableEndDoctypeDeclHandler (fEnable);
}
// @access Parser error reporting methods
public:
// @cmember Get last error
enum XML_Error GetErrorCode ()
{
assert (m_p != NULL);
return XML_GetErrorCode (m_p);
}
// @cmember Get the current byte index
long GetCurrentByteIndex ()
{
assert (m_p != NULL);
return XML_GetCurrentByteIndex (m_p);
}
// @cmember Get the current line number
int GetCurrentLineNumber ()
{
assert (m_p != NULL);
return XML_GetCurrentLineNumber (m_p);
}
// @cmember Get the current column number
int GetCurrentColumnNumber ()
{
assert (m_p != NULL);
return XML_GetCurrentColumnNumber (m_p);
}
// @cmember Get the current byte count
int GetCurrentByteCount ()
{
assert (m_p != NULL);
return XML_GetCurrentByteCount (m_p);
}
// @cmember Get the input context
const char *GetInputContext (int *pnOffset, int *pnSize)
{
assert (m_p != NULL);
return XML_GetInputContext (m_p, pnOffset, pnSize);
}
// @cmember Get last error string
const XML_LChar *GetErrorString ()
{
return XML_ErrorString (GetErrorCode ());
}
// @access Parser other methods
public:
// @cmember Return the version string
static const XML_LChar *GetExpatVersion ()
{
return XML_ExpatVersion ();
}
// @cmember Get the version information
static void GetExpatVersion (int *pnMajor, int *pnMinor, int *pnMicro)
{
XML_Expat_Version v = XML_ExpatVersionInfo ();
if (pnMajor)
*pnMajor = v .major;
if (pnMinor)
*pnMinor = v .minor;
if (pnMicro)
*pnMicro = v .micro;
}
// @cmember Get last error string
static const XML_LChar *GetErrorString (enum XML_Error nError)
{
return XML_ErrorString (nError);
}
// @access Public handler methods
public:
// @cmember Start element handler
virtual void OnStartElement (const XML_Char* /*pszName*/, const XML_Char** /*papszAttrs*/)
{
return;
}
// @cmember End element handler
virtual void OnEndElement (const XML_Char* /*pszName*/)
{
return;
}
// @cmember Character data handler
virtual void OnCharacterData (const XML_Char* /*pszData*/, int /*nLength*/)
{
return;
}
// @cmember Processing instruction handler
void OnProcessingInstruction (const XML_Char* pszTarget,
const XML_Char *pszData)
{
return;
}
// @cmember Comment handler
void OnComment (const XML_Char* pszData)
{
return;
}
// @cmember Start CDATA section handler
void OnStartCdataSection ()
{
return;
}
// @cmember End CDATA section handler
void OnEndCdataSection ()
{
return;
}
// @cmember Default handler
void OnDefault (const XML_Char* pszData, int nLength)
{
return;
}
// @cmember External entity ref handler
bool OnExternalEntityRef (const XML_Char *pszContext,
const XML_Char *pszBase, const XML_Char *pszSystemID,
const XML_Char *pszPublicID)
{
return false;
}
// @cmember Unknown encoding handler
bool OnUnknownEncoding (const XML_Char *pszName, XML_Encoding *pInfo)
{
return false;
}
// @cmember Start namespace declaration handler
void OnStartNamespaceDecl (const XML_Char *pszPrefix,
const XML_Char *pszURI)
{
return;
}
// @cmember End namespace declaration handler
void OnEndNamespaceDecl (const XML_Char *pszPrefix)
{
return;
}
// @cmember XML declaration handler
void OnXmlDecl (const XML_Char *pszVersion, const XML_Char *pszEncoding,
bool fStandalone)
{
return;
}
// @cmember Start DOCTYPE declaration handler
void OnStartDoctypeDecl (const XML_Char *pszDoctypeName,
const XML_Char *pszSysID, const XML_Char *pszPubID,
bool fHasInternalSubset)
{
return;
}
// @cmember End DOCTYPE declaration handler
void OnEndDoctypeDecl ()
{
return;
}
// @access Protected methods
protected:
// @cmember Handle any post creation
void OnPostCreate ()
{
return;
}
// @access Protected static methods
protected:
// @cmember Start element handler wrapper
static void XMLCALL StartElementHandler (void *pUserData,
const XML_Char *pszName, const XML_Char **papszAttrs)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
pThis ->OnStartElement (pszName, papszAttrs);
}
// @cmember End element handler wrapper
static void XMLCALL EndElementHandler (void *pUserData,
const XML_Char *pszName)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
pThis ->OnEndElement (pszName);
}
// @cmember Character data handler wrapper
static void XMLCALL CharacterDataHandler (void *pUserData,
const XML_Char *pszData, int nLength)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
pThis ->OnCharacterData (pszData, nLength);
}
// @cmember Processing instruction handler wrapper
static void XMLCALL ProcessingInstructionHandler (void *pUserData,
const XML_Char *pszTarget, const XML_Char *pszData)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
pThis ->OnProcessingInstruction (pszTarget, pszData);
}
// @cmember Comment handler wrapper
static void XMLCALL CommentHandler (void *pUserData,
const XML_Char *pszData)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
pThis ->OnComment (pszData);
}
// @cmember Start CDATA section wrapper
static void XMLCALL StartCdataSectionHandler (void *pUserData)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
pThis ->OnStartCdataSection ();
}
// @cmember End CDATA section wrapper
static void XMLCALL EndCdataSectionHandler (void *pUserData)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
pThis ->OnEndCdataSection ();
}
// @cmember Default wrapper
static void XMLCALL DefaultHandler (void *pUserData,
const XML_Char *pszData, int nLength)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
pThis ->OnDefault (pszData, nLength);
}
// @cmember External entity ref wrapper
static int XMLCALL ExternalEntityRefHandler (void *pUserData,
const XML_Char *pszContext, const XML_Char *pszBase,
const XML_Char *pszSystemID, const XML_Char *pszPublicID)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
return pThis ->OnExternalEntityRef (pszContext,
pszBase, pszSystemID, pszPublicID) ? 1 : 0;
}
// @cmember Unknown encoding wrapper
static int XMLCALL UnknownEncodingHandler (void *pUserData,
const XML_Char *pszName, XML_Encoding *pInfo)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
return pThis ->OnUnknownEncoding (pszName, pInfo) ? 1 : 0;
}
// @cmember Start namespace decl wrapper
static void XMLCALL StartNamespaceDeclHandler (void *pUserData,
const XML_Char *pszPrefix, const XML_Char *pszURI)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
pThis ->OnStartNamespaceDecl (pszPrefix, pszURI);
}
// @cmember End namespace decl wrapper
static void XMLCALL EndNamespaceDeclHandler (void *pUserData,
const XML_Char *pszPrefix)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
pThis ->OnEndNamespaceDecl (pszPrefix);
}
// @cmember XML declaration wrapper
static void XMLCALL XmlDeclHandler (void *pUserData,
const XML_Char *pszVersion, const XML_Char *pszEncoding,
int nStandalone)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
pThis ->OnXmlDecl (pszVersion, pszEncoding, nStandalone != 0);
}
// @cmember Start Doctype declaration wrapper
static void XMLCALL StartDoctypeDeclHandler (void *pUserData,
const XML_Char *pszDoctypeName, const XML_Char *pszSysID,
const XML_Char *pszPubID, int nHasInternalSubset)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
pThis ->OnStartDoctypeDecl (pszDoctypeName, pszSysID,
pszPubID, nHasInternalSubset != 0);
}
// @cmember End Doctype declaration wrapper
static void XMLCALL EndDoctypeDeclHandler (void *pUserData)
{
_T *pThis = static_cast <_T *> ((CExpatImpl <_T> *) pUserData);
pThis ->OnEndDoctypeDecl ();
}
// @access Protected members
protected:
XML_Parser m_p;
private:
CExpatImpl( const CExpatImpl& ); // do not allow copy constructor, if needed this must be implemented correctly
CExpatImpl& operator=( const CExpatImpl& ); // do not allow assignments, if needed this must be implemented correctly
};
//-----------------------------------------------------------------------------
//
// Virtual method class definition
//
//-----------------------------------------------------------------------------
class CExpat : public CExpatImpl <CExpat>
{
// @access Constructors and destructors
public:
CExpat ()
{
}
// @access Public handler methods
public:
// @cmember Start element handler
virtual void OnStartElement (const XML_Char* /*pszName*/,
const XML_Char** /*papszAttrs*/)
{
return;
}
// @cmember End element handler
virtual void OnEndElement (const XML_Char* /*pszName*/)
{
return;
}
// @cmember Character data handler
virtual void OnCharacterData (const XML_Char* /*pszData*/, int /*nLength*/)
{
return;
}
// @cmember Processing instruction handler
virtual void OnProcessingInstruction (const XML_Char* /*pszTarget*/,
const XML_Char* /*pszData*/)
{
return;
}
// @cmember Comment handler
virtual void OnComment (const XML_Char* /*pszData*/)
{
return;
}
// @cmember Start CDATA section handler
virtual void OnStartCdataSection ()
{
return;
}
// @cmember End CDATA section handler
virtual void OnEndCdataSection ()
{
return;
}
// @cmember Default handler
virtual void OnDefault (const XML_Char* /*pszData*/, int /*nLength*/)
{
return;
}
// @cmember External entity ref handler
virtual bool OnExternalEntityRef (const XML_Char* /*pszContext*/,
const XML_Char* /*pszBase*/, const XML_Char* /*pszSystemID*/,
const XML_Char* /*pszPublicID*/)
{
return false;
}
// @cmember Unknown encoding handler
virtual bool OnUnknownEncoding (const XML_Char* /*pszName*/, XML_Encoding* /*pInfo*/)
{
return false;
}
// @cmember Start namespace declaration handler
virtual void OnStartNamespaceDecl (const XML_Char* /*pszPrefix*/,
const XML_Char* /*pszURI*/)
{
return;
}
// @cmember End namespace declaration handler
virtual void OnEndNamespaceDecl (const XML_Char* /*pszPrefix*/)
{
return;
}
// @cmember XML declaration handler
virtual void OnXmlDecl (const XML_Char* /*pszVersion*/,
const XML_Char* /*pszEncoding*/, bool /*fStandalone*/)
{
return;
}
// @cmember Start DOCTYPE declaration handler
virtual void OnStartDoctypeDecl (const XML_Char* /*pszDoctypeName*/,
const XML_Char* /*pszSysID*/, const XML_Char* /*pszPubID*/,
bool /*fHasInternalSubset*/)
{
return;
}
// @cmember End DOCTYPE declaration handler
virtual void OnEndDoctypeDecl ()
{
return;
}
};
#endif // DSSI_EXPATIMPL_H
| [
"[email protected]"
] | |
aba3fdfa32e7f46a789763bb637c0bdb07ca050a | 65c42b99dc30a14f4e69107ceac469040360262b | /usaco/ch3/spin.cpp | 4f73b70804cce1e3a08045e57c24703902a9273b | [] | no_license | jeffriesd/competitive-programming | 4bee021ce6c33863160abb75613f92bf3db96d80 | 4381f49fa96fcc029ed5af417660ffc57366edd5 | refs/heads/master | 2023-08-11T03:50:35.510865 | 2021-09-20T00:16:35 | 2021-09-20T00:16:35 | 404,136,105 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,271 | cpp | /*
ID: jeffrie1
LANG: C++
TASK: spin
*/
#include<bits/stdc++.h>
using namespace std;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vb = vector<bool>;
using si = set<int>;
// problem: given five circles rotating at different speeds
// and up to 5 'wedges' on each circle,
// compute the earliest time (integer number of seconds) at which
// all 5 circles have at least one of their wedges overlapping
// some section (some interval of degrees)
//
// solution: after 360 seconds, all circles will have rotated
// 360*s_i degrees, so they will all be in their initial position
//
// so simply check for t = 0s ... 360s,
// for degree = 0 ... 360,
// do all wheels include a wedge that covers degree d
// at time t?
//
// represent wheels as vectors of pairs
// indicating their wedges
bool covers(int start, int size, int d) {
if (d == start) return true;
while (d < start)
d += 360;
return d <= start + size;
}
int main() {
ofstream fout ("spin.out");
ifstream fin ("spin.in");
vector<vector<pi>> wheels;
vi speeds;
int s, n, x, y;
for (int i = 0; i < 5; i++) {
vector<pi> wheel;
fin >> s >> n;
speeds.push_back(s);
for (int j = 0; j < n; j++) {
fin >> x >> y;
// x = start, y = number of degrees covered
wheel.push_back({x , y});
}
wheels.push_back(wheel);
}
for (int t = 0; t <= 360; t++) {
for (int d = 0; d < 360; d++) {
// check if d is covered by each wheel
// at time t
bool allCovered = true;
for (int wi = 0; wi < 5; wi++) {
bool covered = false;
// check each wedge
for (pi &p : wheels[wi]) {
tie(x, y) = p;
// compute shift for this interval
x = (x + ((speeds[wi] * t) % 360)) % 360;
// if a single wedge contains d, stop
if (covers(x, y, d)) {
covered = true;
break;
}
}
// if no wedges contained d, stop
// checking d
if (! covered) {
allCovered = false;
break;
}
// check next wheel
}
if (allCovered) {
fout << t << endl;
return 0;
}
}
}
fout << "none" << endl;
return 0;
}
| [
"[email protected]"
] | |
5bde711319ff7bf376a59a49eb49a465393f93d5 | 9cfb5af2bad4a976872ff26508b42580313cefae | /src/FreyaOutput.h | ca7e53357b67a5e7e406edbc5780569f55848e3a | [] | no_license | mirsfang/Freya | e299b977402b41165113dd8229367c731f56278a | 5bcc1a708b01aec3b6f3f65e7c185ed81cb0c9d8 | refs/heads/master | 2021-01-05T06:44:14.837914 | 2020-02-20T09:18:00 | 2020-02-20T09:18:00 | 240,919,176 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,806 | h | /**
* Copyright (c) 2020, MirsFang
* All rights reserved.
*
* @file FreyaOutput.h
* @author Mirs([email protected])
* @date 2020/02/16 23:35
*
* @brief 输出基类
* @note
*
*/
#ifndef FREYA_OUTPUT
#define FREYA_OUTPUT
#include <functional>
#include <memory>
#include <vector>
#include <mutex>
#include "Freya.h"
#include "FreyaContext.h"
#include "FreyaFrameBuffer.h"
#include "extend/FreyaQueue.h"
namespace FREYA {
class FreyaImage;
class FreyaInput;
/// 任务对象
typedef std::function<void(void)> FreyaRunnable;
/**
* @author Mirs([email protected])
* @date 2020/02/18 15:35
* @class FreyaImageOrientation
* @brief 方向枚举
* @note 无
*/
enum class FreyaImageOrientation
{
FreyaImageOrientationUp, /// default orientation
FreyaImageOrientationDown, /// 180 deg rotation
FreyaImageOrientationLeft, /// 90 deg CCW
FreyaImageOrientationRight, /// 90 deg CW
FreyaImageOrientationUpMirrored, /// as above but image mirrored along other axis. horizontal flip
FreyaImageOrientationDownMirrored, /// horizontal flip
FreyaImageOrientationLeftMirrored, /// vertical flip
FreyaImageOrientationRightMirrored /// vertical flip
};
/**
* @date 2020/02/18 15:36
* @brief 输出基类
* @param[in]
* @param[out]
* @return
**/
class FreyaOutput
{
public:
FreyaOutput();
~FreyaOutput();
public:
bool shuouldSmoothlyScaleOutput;
bool shouldIgnoreUpdatesToThisTarget;
std::shared_ptr<FreyaInput> targetToIgnoreForUpdates;
// 帧处理完成回调
void(*_frameProcessingCompletionBlock) (std::shared_ptr<FreyaOutput>,uint64_t timeNN);
bool enable;
std::shared_ptr<FreyaTextureOptions> outputTextureOptions;
protected:
// 运行在渲染线程的队列
std::shared_ptr<FreyaQueue<FreyaRunnable>> mRunOnDrawQueue;
/// 输出的fbo
std::shared_ptr<FreyaFrameBuffer> outputFramebuffer;
/// 目标输入
std::vector<std::shared_ptr<FreyaInput>> targets;
/// 目标纹理
std::vector<int> targetTextureIndices;
/// 输入目标纹理的大小
std::shared_ptr<FreyaSize> inputTextureSize;
std::shared_ptr<FreyaSize> cacheMaximumOutpuSize;
std::shared_ptr<FreyaSize> forcedMaximumSize;
bool overrideInputSize;
bool allTargetsWantMonochromeData;
bool usingNextFrameForImageCapture;
std::mutex _lock;
public:
void setInputFramebufferForTarget(std::shared_ptr<FreyaInput> target,uint32_t inputTextureIndex);
std::shared_ptr<FreyaFrameBuffer> framebufferForOutput();
void removeOutputFramebuffer();
void notifyTargetsAboutNewOutputTexture();
std::vector<std::shared_ptr<FreyaInput>> getTargets();
void addTarget(std::shared_ptr<FreyaInput> newTarget);
void addTarget(std::shared_ptr<FreyaInput> newTarget,uint32_t textureLocation);
void removeTarget(std::shared_ptr<FreyaInput> targetToRemove);
void removeAllTargets();
void forceProcessingAtSize(std::shared_ptr<FreyaSize> frameSize);
void forceProcessingAtSizeRespectingAspectRatio(std::shared_ptr<FreyaSize> frameSize);
void useNextFrameForImageCapture();
std::shared_ptr<FreyaImage> newCGImageFromCurrentlyProcessedOutput();
std::shared_ptr<FreyaImage> newCGImageByFilteringCGImage(std::shared_ptr<FreyaImage> imageToFilter);
bool providesMonochromeOutput();
protected:
/**
* @date 2020/02/19 16:15
* @brief 执行渲染队列内的所有Runnable
**/
void runPendingOnDrawTasks();
/**
* @date 2020/02/19 16:16
* @brief 渲染队列是否为空
**/
bool isOnDrawTasksEmpty();
/**
* @date 2020/02/19 16:17
* @brief 添加到渲染队列
**/
void runOnDraw(FreyaRunnable runnable);
};
};
#endif // FREYA_OUTPUT | [
"[email protected]"
] | |
5b110c2f95fe084c69ce59e3bd5868513298b2bb | 886c7d084b75c1642d6fa903cc2a430f44cc5731 | /ApocalypseEngine/Camera2D.cpp | ead870cdd950ba27fa08c81e180ee095de7032c9 | [] | no_license | ConnorShore/Game | 623c1087b035cbec9864c5b221204d891f629fc8 | aa1f4a54a7f5a84112d04309680e7b6fcd5e811b | refs/heads/master | 2021-01-21T21:43:19.930617 | 2016-05-23T00:44:32 | 2016-05-23T00:44:32 | 38,175,842 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,072 | cpp | #include "Camera2D.h"
Camera2D::Camera2D() : _matrixUpdate(true), _scale(1.0), _screenWidth(1280), _screenHeight(720),
_position(0.0f, 0.0f), _cameraMatrix(1.0f), _orthoMatrix(1.0f)
{
}
void Camera2D::init(int screenWidth, int screenHeight)
{
_screenWidth = screenWidth;
_screenHeight = screenHeight;
_orthoMatrix = glm::ortho(0.0f, (float)_screenWidth, 0.0f, (float)_screenHeight);
}
void Camera2D::update()
{
if (_matrixUpdate) {
glm::vec3 translate(-_position.x + _screenWidth / 2, -_position.y + _screenHeight / 2, 0.0f);
_cameraMatrix = glm::translate(_orthoMatrix, translate);
glm::vec3 scale(_scale, _scale, 0.0f);
_cameraMatrix = glm::scale(glm::mat4(1.0f), scale) * _cameraMatrix;
_matrixUpdate = false;
}
}
glm::vec2 Camera2D::convertToWorldCoords(glm::vec2 screenCoords)
{
//Make 0 the center
screenCoords -= glm::vec2(_screenWidth / 2, _screenHeight / 2);
//Scale coords
screenCoords /= _scale;
//Translate with camera pos
screenCoords += glm::vec2(_position.x, -_position.y);
return screenCoords;
}
Camera2D::~Camera2D()
{
}
| [
"[email protected]"
] | |
d03d962430562f8c326b3cb9daeded918bd8b469 | 23b8b57057b3b758f01dcdfde33cc03becb4caf6 | /llvm/projects/compiler-rt/test/meds/TestCases/ASan/Posix/asprintf.cc | 99105c28f396307bd4573845ce3a4ec06aa398d8 | [
"NCSA",
"MIT"
] | permissive | purdue-secomp-lab/MEDS | 0ab642a86dabe0af36f236043e9ea82dfac54174 | f05ef7da40fa6214000e51c908ab26e16a21c512 | refs/heads/master | 2022-06-09T19:01:48.875018 | 2022-06-01T14:18:15 | 2022-06-01T14:18:15 | 117,601,008 | 38 | 14 | null | 2022-06-01T14:18:17 | 2018-01-15T22:13:57 | C++ | UTF-8 | C++ | false | false | 433 | cc | // RUN: %clangxx_meds -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_meds -O3 %s -o %t && %run %t 2>&1 | FileCheck %s
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
char *p;
int res = asprintf(&p, "%d", argc);
fprintf(stderr, "x%d %sx\n", res, p);
// CHECK: x1 1x
free(p);
fprintf(stderr, "DONE\n");
// CHECK: DONE
return 0;
}
| [
"[email protected]"
] | |
c39feec658df6db007dc2b9ee0a2d42de2c57370 | 826f5c4ccbdb52b8ba065f9ed8af2b3d2ca9d35b | /asteroids/Shop.cpp | c9a58abd37e0587cdc95a83d48602d9fb0c1482e | [] | no_license | JonelleLawler/Asteroids | aab7ff495e6e63a60a73a9fdbc2b8d5569e6c440 | ccf29f33d230f38ab51411df8ece3beea419b24c | refs/heads/master | 2020-04-09T18:53:39.192042 | 2018-12-05T14:11:23 | 2018-12-05T14:11:23 | 160,527,074 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,757 | cpp | #pragma once
#include "Game.h"
#include "Globals.h"
#include "Shop.h"
// @author Jonelle Lawler, David Whiteford
Shop::Shop()
{
loadContent();
shopSprite.setTexture(shopTexture);
shopSprite.setPosition(0, 0);
playerSpeed = 0;
upgradeCost = 0;
newCurrency = 0;
newBulletSpeed = 0;
}
Shop::~Shop()
{
}
void Shop::loadContent()
{
if (!shopTexture.loadFromFile("ASSETS//IMAGES//shop.png"))
{
std::cout << "Error loading splash screen shop" << std::endl;
}
if (!font.loadFromFile("ASSETS/FONTS/ariblk.ttf"))
{
std::cout << "error with font file file";
}
// set up the message string score
currencyMsg.setFont(font); // set the font for the text
currencyMsg.setCharacterSize(48); // set the text size
currencyMsg.setFillColor(sf::Color::Red); // set the text colour
currencyMsg.setPosition(20, 520); // its position on the screen
}
void Shop::render(sf::RenderWindow &m_window, int newMoney)
{
currencyMsg.setString(" Money : " + std::to_string(newMoney));
m_window.draw(shopSprite);
m_window.draw(currencyMsg);
m_window.draw(lackOfMoneyMsg);
}
void Shop::update(float speed , int currency , int bulletSpeed )
{
if (sf::Keyboard::isKeyPressed(sf::Keyboard::BackSpace))
{
Game::currentState = gameModes::mainMenu;
}
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Num1))
{
newCurrency = currency - 100;
playerSpeed = speed + 0.3;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Num2))
{
newBulletSpeed = bulletSpeed + 1;
newCurrency = currency - 100;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Num3))
{
}
}
//returns new player speed
float Shop::getSpeed()
{
return playerSpeed;
}
int Shop::getCurrency()
{
return newCurrency;
}
int Shop::getBulletSpeed()
{
return newBulletSpeed;
} | [
"[email protected]"
] | |
5a455ea16119c5233dc5d4c8217b3142ab5dde5b | 2aea549a86cb48d545f1d1273dc770e9ee5cc845 | /Engine/Code/Engine/Math/LineSegment2.cpp | cbe1479bf279eaae67dfbcd7d75acb3f090003cc | [] | no_license | soxymo/EphanovBox | 00dbda3a38f46138fc4ec6471854acf883fb144c | 473c7f01408959f7b9b2981412a019389a790050 | refs/heads/master | 2021-01-22T04:54:20.395695 | 2017-03-01T01:52:49 | 2017-03-01T01:52:49 | 81,597,897 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,394 | cpp | #include "LineSegment2.hpp"
LineSegment2::LineSegment2(Vector2 starting, Vector2 ending) {
start = starting;
end = ending;
}
LineSegment2::LineSegment2(float startX, float startY, float endX, float endY) {
start = Vector2(startX, startY);
end = Vector2(endX, endY);
}
void LineSegment2::SetStart(const Vector2 starting) {
start = starting;
}
void LineSegment2::SetEnd(const Vector2 ending) {
end = ending;
}
void LineSegment2::TranslateLine(const Vector2& translation) {
end += translation;
start += translation;
}
void LineSegment2::TranslateStart(const Vector2& translation) {
start += translation;
}
void LineSegment2::TranslateEnd(const Vector2& translation) {
end += translation;
}
void LineSegment2::ReverseLineDirection() {
Vector2 tempStart = start;
start = end;
end = tempStart;
}
float LineSegment2::CalcLength() {
return CalcDistance(start, end);
}
float LineSegment2::CalcHeading() {
return Vector2(end.x - start.x, end.y - start.y).CalcHeadingDegrees();
}
float LineSegment2::CalcReverseHeading() {
Vector2 reverseVector = end - start;
reverseVector.Rotate90Degrees();
reverseVector.Rotate90Degrees();
return reverseVector.CalcHeadingDegrees();
}
float LineSegment2::CalcSlope() {
if (end.x - start.x == 0)
return 0.f;
return(end.y - start.y) / (end.x - start.x);
}
const Vector2 LineSegment2::CalcPointFromPercentageToEnd(float percentage) {
Vector2 scalingVector = end - start;
scalingVector.SetLength(scalingVector.CalcLength()*percentage);
return scalingVector + start;
}
const LineSegment2 Interpolate(const LineSegment2& start, const LineSegment2& end, float fractionToEnd) {
float fractionOfStart = 1.f - fractionToEnd;
LineSegment2 blended;
blended.start = (fractionOfStart * start.start) + (fractionToEnd * end.start);
blended.end = (fractionOfStart * start.end) + (fractionToEnd * end.end);
return blended;
}
void LineSegment2::operator-=(const Vector2& antiTranslation) {
start -= antiTranslation;
end -= antiTranslation;
}
void LineSegment2::operator+=(const Vector2& translation) {
start += translation;
end += translation;
}
const LineSegment2 LineSegment2::operator-(const Vector2& antiTranslation) {
return LineSegment2(start - antiTranslation, end - antiTranslation);
}
const LineSegment2 LineSegment2::operator+(const Vector2& translation) {
return LineSegment2(start + translation, end + translation);
}
| [
"[email protected]"
] | |
64ae8dd06c596794f5d2380879fd1739d519e9b8 | e35f02de2c9bb0ff005a548ad56dc32ac5c52274 | /HackerRank/Implementation/AppleAndOrange.cpp | 28ff66999b964623a05c30b32e60b2c8cd4ecd01 | [] | no_license | abhirammv/AlgosAndDS | 12798b1a2034507eb567f943a51eeff59896fa7c | 72e6e7f0572c07abbf1b2e67d6668bff1c5406cd | refs/heads/master | 2021-01-01T16:47:10.703346 | 2017-08-10T05:44:19 | 2017-08-10T05:44:19 | 97,920,340 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 758 | cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
int s;
int t;
cin >> s >> t;
int a;
int b;
cin >> a >> b;
int m;
int n;
cin >> m >> n;
vector<int> apple(m);
for(int apple_i = 0;apple_i < m;apple_i++){
cin >> apple[apple_i];
}
vector<int> orange(n);
for(int orange_i = 0;orange_i < n;orange_i++){
cin >> orange[orange_i];
}
int apples = 0, oranges = 0;
for(int i = 0; i<m; i++)
{
if((apple[i]+a >= s) && (apple[i]+a <= t))
apples++;
}
for(int j = 0; j<n; j++)
{
if((orange[j]+b<=t) && (orange[j] + b >=s))
oranges++;
}
cout<<apples<<endl;
cout<<oranges<<endl;
return 0;
}
| [
"[email protected]"
] | |
9aea473fcb2795de6b904d6023ae7fccc84b4431 | 0b32d0febcf6d05cb6d041d5b8eb14134c1eaf91 | /2Daction/Temp/StagingArea/Data/il2cppOutput/UnityEngine.SharedInternalsModule.cpp | 67cbc24dccabe47245c560a66217dd58c336ada2 | [] | no_license | Jotaro0928/test_repo | 54280a0d00f01a6f6e9ab48a31f8f5c3dd3c4745 | 9ce7936ea417e685caaf989bab80eb06c57e0ef0 | refs/heads/main | 2023-02-20T08:37:43.384427 | 2021-01-22T05:59:13 | 2021-01-22T05:59:13 | 321,549,528 | 0 | 0 | null | 2021-01-22T05:59:15 | 2020-12-15T04:11:26 | C# | UTF-8 | C++ | false | false | 162,954 | cpp | #include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include <stdint.h>
#include "codegen/il2cpp-codegen.h"
#include "il2cpp-object-internals.h"
template <typename R>
struct VirtFuncInvoker0
{
typedef R (*Func)(void*, const RuntimeMethod*);
static inline R Invoke (Il2CppMethodSlot slot, RuntimeObject* obj)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_virtual_invoke_data(slot, obj);
return ((Func)invokeData.methodPtr)(obj, invokeData.method);
}
};
// System.ArgumentException
struct ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1;
// System.ArgumentNullException
struct ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD;
// System.Attribute
struct Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74;
// System.Byte[]
struct ByteU5BU5D_tD06FDBE8142446525DF1C40351D523A228373821;
// System.Char[]
struct CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2;
// System.Collections.Generic.Dictionary`2<System.Int32,System.Globalization.CultureInfo>
struct Dictionary_2_tC88A56872F7C79DBB9582D4F3FC22ED5D8E0B98B;
// System.Collections.Generic.Dictionary`2<System.String,System.Globalization.CultureInfo>
struct Dictionary_2_tBA5388DBB42BF620266F9A48E8B859BBBB224E25;
// System.Collections.Generic.IEnumerable`1<System.String>
struct IEnumerable_1_t31EF1520A3A805598500BB6033C14ABDA7116D5E;
// System.Collections.IDictionary
struct IDictionary_t1BD5C1546718A374EA8122FBD6C6EE45331E8CE7;
// System.Diagnostics.StackTrace[]
struct StackTraceU5BU5D_t855F09649EA34DEE7C1B6F088E0538E3CCC3F196;
// System.Globalization.Calendar
struct Calendar_tF55A785ACD277504CF0D2F2C6AD56F76C6E91BD5;
// System.Globalization.CompareInfo
struct CompareInfo_tB9A071DBC11AC00AF2EA2066D0C2AE1DCB1865D1;
// System.Globalization.CultureData
struct CultureData_tF43B080FFA6EB278F4F289BCDA3FB74B6C208ECD;
// System.Globalization.CultureInfo
struct CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F;
// System.Globalization.DateTimeFormatInfo
struct DateTimeFormatInfo_tF4BB3AA482C2F772D2A9022F78BF8727830FAF5F;
// System.Globalization.NumberFormatInfo
struct NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8;
// System.Globalization.TextInfo
struct TextInfo_t5F1E697CB6A7E5EC80F0DC3A968B9B4A70C291D8;
// System.IFormatProvider
struct IFormatProvider_t4247E13AE2D97A079B88D594B7ABABF313259901;
// System.Int32[]
struct Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83;
// System.IntPtr[]
struct IntPtrU5BU5D_t4DC01DCB9A6DF6C9792A6513595D7A11E637DCDD;
// System.Object[]
struct ObjectU5BU5D_t3C9242B5C88A48B2A5BD9FDA6CD0024E792AF08A;
// System.Runtime.Serialization.SafeSerializationManager
struct SafeSerializationManager_t4A754D86B0F784B18CBC36C073BA564BED109770;
// System.String
struct String_t;
// System.String[]
struct StringU5BU5D_t933FB07893230EA91C40FF900D5400665E87B14E;
// System.Void
struct Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017;
// UnityEngine.AssetFileNameExtensionAttribute
struct AssetFileNameExtensionAttribute_t634736D44FACBB2E58C82ABE354A807BD77DEB03;
// UnityEngine.Bindings.FreeFunctionAttribute
struct FreeFunctionAttribute_tE41160023E316B5E3DF87DA36BDDA9639DD835AE;
// UnityEngine.Bindings.IgnoreAttribute
struct IgnoreAttribute_tD849E806CA1C75980B97B047908DE57D156B775F;
// UnityEngine.Bindings.NativeConditionalAttribute
struct NativeConditionalAttribute_t8F72026EC5B1194F1D82D72E0C76C51D7D7FBD2E;
// UnityEngine.Bindings.NativeHeaderAttribute
struct NativeHeaderAttribute_t5C38607694D73834F0B9EB2AB0E575D3FD6D0D8B;
// UnityEngine.Bindings.NativeMethodAttribute
struct NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309;
// UnityEngine.Bindings.NativeNameAttribute
struct NativeNameAttribute_t16D90ABD66BD1E0081A2D037FE91ECF220E797F9;
// UnityEngine.Bindings.NativePropertyAttribute
struct NativePropertyAttribute_tD231CE0D66BEF2B7C0E5D3FF92B02E4FD0365C61;
// UnityEngine.Bindings.NativeThrowsAttribute
struct NativeThrowsAttribute_t0DAF98C14FF11B321CBB7131226E0A2413426EFA;
// UnityEngine.Bindings.NativeTypeAttribute
struct NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831;
// UnityEngine.Bindings.NotNullAttribute
struct NotNullAttribute_t04A526B0B7DD6B37D2FFC6E5079575E0C461E2A0;
// UnityEngine.Bindings.StaticAccessorAttribute
struct StaticAccessorAttribute_tE507394A59220DFDF5DBE62DD94B6A00AA01D1F2;
// UnityEngine.Bindings.ThreadSafeAttribute
struct ThreadSafeAttribute_t3FB9EE5993C748628BC06D9D46ACA3A58FDAE317;
// UnityEngine.Bindings.VisibleToOtherModulesAttribute
struct VisibleToOtherModulesAttribute_t8601A3A00D7B9528C62DD278E53B317B566FDA90;
// UnityEngine.NativeClassAttribute
struct NativeClassAttribute_t1CA9B99EEAAFC1EE97D52505821BD3AD15F8448C;
// UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute
struct GeneratedByOldBindingsGeneratorAttribute_tF3386E1746F60B4E1D77C2167915FBB4B89BBA86;
// UnityEngine.Scripting.RequiredByNativeCodeAttribute
struct RequiredByNativeCodeAttribute_t949320E827C2BD269B3E686FE317A18835670AAE;
// UnityEngine.Scripting.UsedByNativeCodeAttribute
struct UsedByNativeCodeAttribute_t923F9A140847AF2F193AD1AB33143B8774797912;
// UnityEngine.ThreadAndSerializationSafeAttribute
struct ThreadAndSerializationSafeAttribute_tC7AAA73802AAF871C176CF59656C030E5BFA87AA;
// UnityEngine.UnityEngineModuleAssembly
struct UnityEngineModuleAssembly_t5CEBDCE354FDB9B42BFF9344E7EBA474E4C070DB;
// UnityEngine.WritableAttribute
struct WritableAttribute_tAEE55CD07B2C5AD9CDBAD9FAF35FBB94AD8DE9BD;
IL2CPP_EXTERN_C RuntimeClass* ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1_il2cpp_TypeInfo_var;
IL2CPP_EXTERN_C RuntimeClass* ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD_il2cpp_TypeInfo_var;
IL2CPP_EXTERN_C RuntimeClass* CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_il2cpp_TypeInfo_var;
IL2CPP_EXTERN_C String_t* _stringLiteral00F1751BBAD144F9A705A5D34DE53F8993F5F75F;
IL2CPP_EXTERN_C String_t* _stringLiteral594FD1615A341C77829E83ED988F137E1BA96231;
IL2CPP_EXTERN_C String_t* _stringLiteral6AE999552A0D2DCA14D62E2BC8B764D377B1DD6C;
IL2CPP_EXTERN_C String_t* _stringLiteralDA39A3EE5E6B4B0D3255BFEF95601890AFD80709;
IL2CPP_EXTERN_C String_t* _stringLiteralE603ACC092BAF5342CBBBABD96FF616A275F364E;
IL2CPP_EXTERN_C String_t* _stringLiteralEAB8FC250F05F082661640C1F97CCD12D297B765;
IL2CPP_EXTERN_C const RuntimeMethod* NativeHeaderAttribute__ctor_m490124694FDBCB4336CBA29D2E24A27FF3451A0E_RuntimeMethod_var;
IL2CPP_EXTERN_C const RuntimeMethod* NativeMethodAttribute__ctor_m1A8CC57006916ACBBBCB515C26224392E8711A22_RuntimeMethod_var;
IL2CPP_EXTERN_C const RuntimeMethod* NativeNameAttribute__ctor_m85D49395E6305D8C6CFA8C39A83653F36A8FC9BA_RuntimeMethod_var;
IL2CPP_EXTERN_C const RuntimeMethod* NativeTypeAttribute__ctor_m7ACA25C054E933120D16DC7BBDE17734194454B6_RuntimeMethod_var;
IL2CPP_EXTERN_C const uint32_t NativeClassAttribute__ctor_m814DCB23A54C2AE01ACDB1930DDF06277CAD9DE8_MetadataUsageId;
IL2CPP_EXTERN_C const uint32_t NativeHeaderAttribute__ctor_m490124694FDBCB4336CBA29D2E24A27FF3451A0E_MetadataUsageId;
IL2CPP_EXTERN_C const uint32_t NativeMethodAttribute__ctor_m1A8CC57006916ACBBBCB515C26224392E8711A22_MetadataUsageId;
IL2CPP_EXTERN_C const uint32_t NativeNameAttribute__ctor_m85D49395E6305D8C6CFA8C39A83653F36A8FC9BA_MetadataUsageId;
IL2CPP_EXTERN_C const uint32_t NativeTypeAttribute__ctor_m7ACA25C054E933120D16DC7BBDE17734194454B6_MetadataUsageId;
IL2CPP_EXTERN_C const uint32_t UnityString_Format_m415056ECF8DA7B3EC6A8456E299D0C2002177387_MetadataUsageId;
struct CultureData_tF43B080FFA6EB278F4F289BCDA3FB74B6C208ECD_marshaled_com;
struct CultureData_tF43B080FFA6EB278F4F289BCDA3FB74B6C208ECD_marshaled_pinvoke;
struct CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_marshaled_com;
struct CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_marshaled_pinvoke;
struct Exception_t_marshaled_com;
struct Exception_t_marshaled_pinvoke;
struct ObjectU5BU5D_t3C9242B5C88A48B2A5BD9FDA6CD0024E792AF08A;
struct StringU5BU5D_t933FB07893230EA91C40FF900D5400665E87B14E;
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_tDD607E0208590BE5D73D68EB7825AD7A1FBDFCC3
{
public:
public:
};
// System.Object
struct Il2CppArrayBounds;
// System.Array
// System.Attribute
struct Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74 : public RuntimeObject
{
public:
public:
};
// System.Globalization.CultureInfo
struct CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F : public RuntimeObject
{
public:
// System.Boolean System.Globalization.CultureInfo::m_isReadOnly
bool ___m_isReadOnly_3;
// System.Int32 System.Globalization.CultureInfo::cultureID
int32_t ___cultureID_4;
// System.Int32 System.Globalization.CultureInfo::parent_lcid
int32_t ___parent_lcid_5;
// System.Int32 System.Globalization.CultureInfo::datetime_index
int32_t ___datetime_index_6;
// System.Int32 System.Globalization.CultureInfo::number_index
int32_t ___number_index_7;
// System.Int32 System.Globalization.CultureInfo::default_calendar_type
int32_t ___default_calendar_type_8;
// System.Boolean System.Globalization.CultureInfo::m_useUserOverride
bool ___m_useUserOverride_9;
// System.Globalization.NumberFormatInfo modreq(System.Runtime.CompilerServices.IsVolatile) System.Globalization.CultureInfo::numInfo
NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8 * ___numInfo_10;
// System.Globalization.DateTimeFormatInfo modreq(System.Runtime.CompilerServices.IsVolatile) System.Globalization.CultureInfo::dateTimeInfo
DateTimeFormatInfo_tF4BB3AA482C2F772D2A9022F78BF8727830FAF5F * ___dateTimeInfo_11;
// System.Globalization.TextInfo modreq(System.Runtime.CompilerServices.IsVolatile) System.Globalization.CultureInfo::textInfo
TextInfo_t5F1E697CB6A7E5EC80F0DC3A968B9B4A70C291D8 * ___textInfo_12;
// System.String System.Globalization.CultureInfo::m_name
String_t* ___m_name_13;
// System.String System.Globalization.CultureInfo::englishname
String_t* ___englishname_14;
// System.String System.Globalization.CultureInfo::nativename
String_t* ___nativename_15;
// System.String System.Globalization.CultureInfo::iso3lang
String_t* ___iso3lang_16;
// System.String System.Globalization.CultureInfo::iso2lang
String_t* ___iso2lang_17;
// System.String System.Globalization.CultureInfo::win3lang
String_t* ___win3lang_18;
// System.String System.Globalization.CultureInfo::territory
String_t* ___territory_19;
// System.String[] System.Globalization.CultureInfo::native_calendar_names
StringU5BU5D_t933FB07893230EA91C40FF900D5400665E87B14E* ___native_calendar_names_20;
// System.Globalization.CompareInfo modreq(System.Runtime.CompilerServices.IsVolatile) System.Globalization.CultureInfo::compareInfo
CompareInfo_tB9A071DBC11AC00AF2EA2066D0C2AE1DCB1865D1 * ___compareInfo_21;
// System.Void* System.Globalization.CultureInfo::textinfo_data
void* ___textinfo_data_22;
// System.Int32 System.Globalization.CultureInfo::m_dataItem
int32_t ___m_dataItem_23;
// System.Globalization.Calendar System.Globalization.CultureInfo::calendar
Calendar_tF55A785ACD277504CF0D2F2C6AD56F76C6E91BD5 * ___calendar_24;
// System.Globalization.CultureInfo System.Globalization.CultureInfo::parent_culture
CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * ___parent_culture_25;
// System.Boolean System.Globalization.CultureInfo::constructed
bool ___constructed_26;
// System.Byte[] System.Globalization.CultureInfo::cached_serialized_form
ByteU5BU5D_tD06FDBE8142446525DF1C40351D523A228373821* ___cached_serialized_form_27;
// System.Globalization.CultureData System.Globalization.CultureInfo::m_cultureData
CultureData_tF43B080FFA6EB278F4F289BCDA3FB74B6C208ECD * ___m_cultureData_28;
// System.Boolean System.Globalization.CultureInfo::m_isInherited
bool ___m_isInherited_29;
public:
inline static int32_t get_offset_of_m_isReadOnly_3() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___m_isReadOnly_3)); }
inline bool get_m_isReadOnly_3() const { return ___m_isReadOnly_3; }
inline bool* get_address_of_m_isReadOnly_3() { return &___m_isReadOnly_3; }
inline void set_m_isReadOnly_3(bool value)
{
___m_isReadOnly_3 = value;
}
inline static int32_t get_offset_of_cultureID_4() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___cultureID_4)); }
inline int32_t get_cultureID_4() const { return ___cultureID_4; }
inline int32_t* get_address_of_cultureID_4() { return &___cultureID_4; }
inline void set_cultureID_4(int32_t value)
{
___cultureID_4 = value;
}
inline static int32_t get_offset_of_parent_lcid_5() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___parent_lcid_5)); }
inline int32_t get_parent_lcid_5() const { return ___parent_lcid_5; }
inline int32_t* get_address_of_parent_lcid_5() { return &___parent_lcid_5; }
inline void set_parent_lcid_5(int32_t value)
{
___parent_lcid_5 = value;
}
inline static int32_t get_offset_of_datetime_index_6() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___datetime_index_6)); }
inline int32_t get_datetime_index_6() const { return ___datetime_index_6; }
inline int32_t* get_address_of_datetime_index_6() { return &___datetime_index_6; }
inline void set_datetime_index_6(int32_t value)
{
___datetime_index_6 = value;
}
inline static int32_t get_offset_of_number_index_7() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___number_index_7)); }
inline int32_t get_number_index_7() const { return ___number_index_7; }
inline int32_t* get_address_of_number_index_7() { return &___number_index_7; }
inline void set_number_index_7(int32_t value)
{
___number_index_7 = value;
}
inline static int32_t get_offset_of_default_calendar_type_8() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___default_calendar_type_8)); }
inline int32_t get_default_calendar_type_8() const { return ___default_calendar_type_8; }
inline int32_t* get_address_of_default_calendar_type_8() { return &___default_calendar_type_8; }
inline void set_default_calendar_type_8(int32_t value)
{
___default_calendar_type_8 = value;
}
inline static int32_t get_offset_of_m_useUserOverride_9() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___m_useUserOverride_9)); }
inline bool get_m_useUserOverride_9() const { return ___m_useUserOverride_9; }
inline bool* get_address_of_m_useUserOverride_9() { return &___m_useUserOverride_9; }
inline void set_m_useUserOverride_9(bool value)
{
___m_useUserOverride_9 = value;
}
inline static int32_t get_offset_of_numInfo_10() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___numInfo_10)); }
inline NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8 * get_numInfo_10() const { return ___numInfo_10; }
inline NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8 ** get_address_of_numInfo_10() { return &___numInfo_10; }
inline void set_numInfo_10(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8 * value)
{
___numInfo_10 = value;
Il2CppCodeGenWriteBarrier((void**)(&___numInfo_10), (void*)value);
}
inline static int32_t get_offset_of_dateTimeInfo_11() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___dateTimeInfo_11)); }
inline DateTimeFormatInfo_tF4BB3AA482C2F772D2A9022F78BF8727830FAF5F * get_dateTimeInfo_11() const { return ___dateTimeInfo_11; }
inline DateTimeFormatInfo_tF4BB3AA482C2F772D2A9022F78BF8727830FAF5F ** get_address_of_dateTimeInfo_11() { return &___dateTimeInfo_11; }
inline void set_dateTimeInfo_11(DateTimeFormatInfo_tF4BB3AA482C2F772D2A9022F78BF8727830FAF5F * value)
{
___dateTimeInfo_11 = value;
Il2CppCodeGenWriteBarrier((void**)(&___dateTimeInfo_11), (void*)value);
}
inline static int32_t get_offset_of_textInfo_12() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___textInfo_12)); }
inline TextInfo_t5F1E697CB6A7E5EC80F0DC3A968B9B4A70C291D8 * get_textInfo_12() const { return ___textInfo_12; }
inline TextInfo_t5F1E697CB6A7E5EC80F0DC3A968B9B4A70C291D8 ** get_address_of_textInfo_12() { return &___textInfo_12; }
inline void set_textInfo_12(TextInfo_t5F1E697CB6A7E5EC80F0DC3A968B9B4A70C291D8 * value)
{
___textInfo_12 = value;
Il2CppCodeGenWriteBarrier((void**)(&___textInfo_12), (void*)value);
}
inline static int32_t get_offset_of_m_name_13() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___m_name_13)); }
inline String_t* get_m_name_13() const { return ___m_name_13; }
inline String_t** get_address_of_m_name_13() { return &___m_name_13; }
inline void set_m_name_13(String_t* value)
{
___m_name_13 = value;
Il2CppCodeGenWriteBarrier((void**)(&___m_name_13), (void*)value);
}
inline static int32_t get_offset_of_englishname_14() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___englishname_14)); }
inline String_t* get_englishname_14() const { return ___englishname_14; }
inline String_t** get_address_of_englishname_14() { return &___englishname_14; }
inline void set_englishname_14(String_t* value)
{
___englishname_14 = value;
Il2CppCodeGenWriteBarrier((void**)(&___englishname_14), (void*)value);
}
inline static int32_t get_offset_of_nativename_15() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___nativename_15)); }
inline String_t* get_nativename_15() const { return ___nativename_15; }
inline String_t** get_address_of_nativename_15() { return &___nativename_15; }
inline void set_nativename_15(String_t* value)
{
___nativename_15 = value;
Il2CppCodeGenWriteBarrier((void**)(&___nativename_15), (void*)value);
}
inline static int32_t get_offset_of_iso3lang_16() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___iso3lang_16)); }
inline String_t* get_iso3lang_16() const { return ___iso3lang_16; }
inline String_t** get_address_of_iso3lang_16() { return &___iso3lang_16; }
inline void set_iso3lang_16(String_t* value)
{
___iso3lang_16 = value;
Il2CppCodeGenWriteBarrier((void**)(&___iso3lang_16), (void*)value);
}
inline static int32_t get_offset_of_iso2lang_17() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___iso2lang_17)); }
inline String_t* get_iso2lang_17() const { return ___iso2lang_17; }
inline String_t** get_address_of_iso2lang_17() { return &___iso2lang_17; }
inline void set_iso2lang_17(String_t* value)
{
___iso2lang_17 = value;
Il2CppCodeGenWriteBarrier((void**)(&___iso2lang_17), (void*)value);
}
inline static int32_t get_offset_of_win3lang_18() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___win3lang_18)); }
inline String_t* get_win3lang_18() const { return ___win3lang_18; }
inline String_t** get_address_of_win3lang_18() { return &___win3lang_18; }
inline void set_win3lang_18(String_t* value)
{
___win3lang_18 = value;
Il2CppCodeGenWriteBarrier((void**)(&___win3lang_18), (void*)value);
}
inline static int32_t get_offset_of_territory_19() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___territory_19)); }
inline String_t* get_territory_19() const { return ___territory_19; }
inline String_t** get_address_of_territory_19() { return &___territory_19; }
inline void set_territory_19(String_t* value)
{
___territory_19 = value;
Il2CppCodeGenWriteBarrier((void**)(&___territory_19), (void*)value);
}
inline static int32_t get_offset_of_native_calendar_names_20() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___native_calendar_names_20)); }
inline StringU5BU5D_t933FB07893230EA91C40FF900D5400665E87B14E* get_native_calendar_names_20() const { return ___native_calendar_names_20; }
inline StringU5BU5D_t933FB07893230EA91C40FF900D5400665E87B14E** get_address_of_native_calendar_names_20() { return &___native_calendar_names_20; }
inline void set_native_calendar_names_20(StringU5BU5D_t933FB07893230EA91C40FF900D5400665E87B14E* value)
{
___native_calendar_names_20 = value;
Il2CppCodeGenWriteBarrier((void**)(&___native_calendar_names_20), (void*)value);
}
inline static int32_t get_offset_of_compareInfo_21() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___compareInfo_21)); }
inline CompareInfo_tB9A071DBC11AC00AF2EA2066D0C2AE1DCB1865D1 * get_compareInfo_21() const { return ___compareInfo_21; }
inline CompareInfo_tB9A071DBC11AC00AF2EA2066D0C2AE1DCB1865D1 ** get_address_of_compareInfo_21() { return &___compareInfo_21; }
inline void set_compareInfo_21(CompareInfo_tB9A071DBC11AC00AF2EA2066D0C2AE1DCB1865D1 * value)
{
___compareInfo_21 = value;
Il2CppCodeGenWriteBarrier((void**)(&___compareInfo_21), (void*)value);
}
inline static int32_t get_offset_of_textinfo_data_22() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___textinfo_data_22)); }
inline void* get_textinfo_data_22() const { return ___textinfo_data_22; }
inline void** get_address_of_textinfo_data_22() { return &___textinfo_data_22; }
inline void set_textinfo_data_22(void* value)
{
___textinfo_data_22 = value;
}
inline static int32_t get_offset_of_m_dataItem_23() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___m_dataItem_23)); }
inline int32_t get_m_dataItem_23() const { return ___m_dataItem_23; }
inline int32_t* get_address_of_m_dataItem_23() { return &___m_dataItem_23; }
inline void set_m_dataItem_23(int32_t value)
{
___m_dataItem_23 = value;
}
inline static int32_t get_offset_of_calendar_24() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___calendar_24)); }
inline Calendar_tF55A785ACD277504CF0D2F2C6AD56F76C6E91BD5 * get_calendar_24() const { return ___calendar_24; }
inline Calendar_tF55A785ACD277504CF0D2F2C6AD56F76C6E91BD5 ** get_address_of_calendar_24() { return &___calendar_24; }
inline void set_calendar_24(Calendar_tF55A785ACD277504CF0D2F2C6AD56F76C6E91BD5 * value)
{
___calendar_24 = value;
Il2CppCodeGenWriteBarrier((void**)(&___calendar_24), (void*)value);
}
inline static int32_t get_offset_of_parent_culture_25() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___parent_culture_25)); }
inline CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * get_parent_culture_25() const { return ___parent_culture_25; }
inline CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F ** get_address_of_parent_culture_25() { return &___parent_culture_25; }
inline void set_parent_culture_25(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * value)
{
___parent_culture_25 = value;
Il2CppCodeGenWriteBarrier((void**)(&___parent_culture_25), (void*)value);
}
inline static int32_t get_offset_of_constructed_26() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___constructed_26)); }
inline bool get_constructed_26() const { return ___constructed_26; }
inline bool* get_address_of_constructed_26() { return &___constructed_26; }
inline void set_constructed_26(bool value)
{
___constructed_26 = value;
}
inline static int32_t get_offset_of_cached_serialized_form_27() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___cached_serialized_form_27)); }
inline ByteU5BU5D_tD06FDBE8142446525DF1C40351D523A228373821* get_cached_serialized_form_27() const { return ___cached_serialized_form_27; }
inline ByteU5BU5D_tD06FDBE8142446525DF1C40351D523A228373821** get_address_of_cached_serialized_form_27() { return &___cached_serialized_form_27; }
inline void set_cached_serialized_form_27(ByteU5BU5D_tD06FDBE8142446525DF1C40351D523A228373821* value)
{
___cached_serialized_form_27 = value;
Il2CppCodeGenWriteBarrier((void**)(&___cached_serialized_form_27), (void*)value);
}
inline static int32_t get_offset_of_m_cultureData_28() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___m_cultureData_28)); }
inline CultureData_tF43B080FFA6EB278F4F289BCDA3FB74B6C208ECD * get_m_cultureData_28() const { return ___m_cultureData_28; }
inline CultureData_tF43B080FFA6EB278F4F289BCDA3FB74B6C208ECD ** get_address_of_m_cultureData_28() { return &___m_cultureData_28; }
inline void set_m_cultureData_28(CultureData_tF43B080FFA6EB278F4F289BCDA3FB74B6C208ECD * value)
{
___m_cultureData_28 = value;
Il2CppCodeGenWriteBarrier((void**)(&___m_cultureData_28), (void*)value);
}
inline static int32_t get_offset_of_m_isInherited_29() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F, ___m_isInherited_29)); }
inline bool get_m_isInherited_29() const { return ___m_isInherited_29; }
inline bool* get_address_of_m_isInherited_29() { return &___m_isInherited_29; }
inline void set_m_isInherited_29(bool value)
{
___m_isInherited_29 = value;
}
};
struct CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_StaticFields
{
public:
// System.Globalization.CultureInfo modreq(System.Runtime.CompilerServices.IsVolatile) System.Globalization.CultureInfo::invariant_culture_info
CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * ___invariant_culture_info_0;
// System.Object System.Globalization.CultureInfo::shared_table_lock
RuntimeObject * ___shared_table_lock_1;
// System.Globalization.CultureInfo System.Globalization.CultureInfo::default_current_culture
CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * ___default_current_culture_2;
// System.Globalization.CultureInfo modreq(System.Runtime.CompilerServices.IsVolatile) System.Globalization.CultureInfo::s_DefaultThreadCurrentUICulture
CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * ___s_DefaultThreadCurrentUICulture_33;
// System.Globalization.CultureInfo modreq(System.Runtime.CompilerServices.IsVolatile) System.Globalization.CultureInfo::s_DefaultThreadCurrentCulture
CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * ___s_DefaultThreadCurrentCulture_34;
// System.Collections.Generic.Dictionary`2<System.Int32,System.Globalization.CultureInfo> System.Globalization.CultureInfo::shared_by_number
Dictionary_2_tC88A56872F7C79DBB9582D4F3FC22ED5D8E0B98B * ___shared_by_number_35;
// System.Collections.Generic.Dictionary`2<System.String,System.Globalization.CultureInfo> System.Globalization.CultureInfo::shared_by_name
Dictionary_2_tBA5388DBB42BF620266F9A48E8B859BBBB224E25 * ___shared_by_name_36;
// System.Boolean System.Globalization.CultureInfo::IsTaiwanSku
bool ___IsTaiwanSku_37;
public:
inline static int32_t get_offset_of_invariant_culture_info_0() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_StaticFields, ___invariant_culture_info_0)); }
inline CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * get_invariant_culture_info_0() const { return ___invariant_culture_info_0; }
inline CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F ** get_address_of_invariant_culture_info_0() { return &___invariant_culture_info_0; }
inline void set_invariant_culture_info_0(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * value)
{
___invariant_culture_info_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___invariant_culture_info_0), (void*)value);
}
inline static int32_t get_offset_of_shared_table_lock_1() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_StaticFields, ___shared_table_lock_1)); }
inline RuntimeObject * get_shared_table_lock_1() const { return ___shared_table_lock_1; }
inline RuntimeObject ** get_address_of_shared_table_lock_1() { return &___shared_table_lock_1; }
inline void set_shared_table_lock_1(RuntimeObject * value)
{
___shared_table_lock_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___shared_table_lock_1), (void*)value);
}
inline static int32_t get_offset_of_default_current_culture_2() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_StaticFields, ___default_current_culture_2)); }
inline CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * get_default_current_culture_2() const { return ___default_current_culture_2; }
inline CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F ** get_address_of_default_current_culture_2() { return &___default_current_culture_2; }
inline void set_default_current_culture_2(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * value)
{
___default_current_culture_2 = value;
Il2CppCodeGenWriteBarrier((void**)(&___default_current_culture_2), (void*)value);
}
inline static int32_t get_offset_of_s_DefaultThreadCurrentUICulture_33() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_StaticFields, ___s_DefaultThreadCurrentUICulture_33)); }
inline CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * get_s_DefaultThreadCurrentUICulture_33() const { return ___s_DefaultThreadCurrentUICulture_33; }
inline CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F ** get_address_of_s_DefaultThreadCurrentUICulture_33() { return &___s_DefaultThreadCurrentUICulture_33; }
inline void set_s_DefaultThreadCurrentUICulture_33(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * value)
{
___s_DefaultThreadCurrentUICulture_33 = value;
Il2CppCodeGenWriteBarrier((void**)(&___s_DefaultThreadCurrentUICulture_33), (void*)value);
}
inline static int32_t get_offset_of_s_DefaultThreadCurrentCulture_34() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_StaticFields, ___s_DefaultThreadCurrentCulture_34)); }
inline CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * get_s_DefaultThreadCurrentCulture_34() const { return ___s_DefaultThreadCurrentCulture_34; }
inline CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F ** get_address_of_s_DefaultThreadCurrentCulture_34() { return &___s_DefaultThreadCurrentCulture_34; }
inline void set_s_DefaultThreadCurrentCulture_34(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * value)
{
___s_DefaultThreadCurrentCulture_34 = value;
Il2CppCodeGenWriteBarrier((void**)(&___s_DefaultThreadCurrentCulture_34), (void*)value);
}
inline static int32_t get_offset_of_shared_by_number_35() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_StaticFields, ___shared_by_number_35)); }
inline Dictionary_2_tC88A56872F7C79DBB9582D4F3FC22ED5D8E0B98B * get_shared_by_number_35() const { return ___shared_by_number_35; }
inline Dictionary_2_tC88A56872F7C79DBB9582D4F3FC22ED5D8E0B98B ** get_address_of_shared_by_number_35() { return &___shared_by_number_35; }
inline void set_shared_by_number_35(Dictionary_2_tC88A56872F7C79DBB9582D4F3FC22ED5D8E0B98B * value)
{
___shared_by_number_35 = value;
Il2CppCodeGenWriteBarrier((void**)(&___shared_by_number_35), (void*)value);
}
inline static int32_t get_offset_of_shared_by_name_36() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_StaticFields, ___shared_by_name_36)); }
inline Dictionary_2_tBA5388DBB42BF620266F9A48E8B859BBBB224E25 * get_shared_by_name_36() const { return ___shared_by_name_36; }
inline Dictionary_2_tBA5388DBB42BF620266F9A48E8B859BBBB224E25 ** get_address_of_shared_by_name_36() { return &___shared_by_name_36; }
inline void set_shared_by_name_36(Dictionary_2_tBA5388DBB42BF620266F9A48E8B859BBBB224E25 * value)
{
___shared_by_name_36 = value;
Il2CppCodeGenWriteBarrier((void**)(&___shared_by_name_36), (void*)value);
}
inline static int32_t get_offset_of_IsTaiwanSku_37() { return static_cast<int32_t>(offsetof(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_StaticFields, ___IsTaiwanSku_37)); }
inline bool get_IsTaiwanSku_37() const { return ___IsTaiwanSku_37; }
inline bool* get_address_of_IsTaiwanSku_37() { return &___IsTaiwanSku_37; }
inline void set_IsTaiwanSku_37(bool value)
{
___IsTaiwanSku_37 = value;
}
};
// Native definition for P/Invoke marshalling of System.Globalization.CultureInfo
struct CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_marshaled_pinvoke
{
int32_t ___m_isReadOnly_3;
int32_t ___cultureID_4;
int32_t ___parent_lcid_5;
int32_t ___datetime_index_6;
int32_t ___number_index_7;
int32_t ___default_calendar_type_8;
int32_t ___m_useUserOverride_9;
NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8 * ___numInfo_10;
DateTimeFormatInfo_tF4BB3AA482C2F772D2A9022F78BF8727830FAF5F * ___dateTimeInfo_11;
TextInfo_t5F1E697CB6A7E5EC80F0DC3A968B9B4A70C291D8 * ___textInfo_12;
char* ___m_name_13;
char* ___englishname_14;
char* ___nativename_15;
char* ___iso3lang_16;
char* ___iso2lang_17;
char* ___win3lang_18;
char* ___territory_19;
char** ___native_calendar_names_20;
CompareInfo_tB9A071DBC11AC00AF2EA2066D0C2AE1DCB1865D1 * ___compareInfo_21;
void* ___textinfo_data_22;
int32_t ___m_dataItem_23;
Calendar_tF55A785ACD277504CF0D2F2C6AD56F76C6E91BD5 * ___calendar_24;
CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_marshaled_pinvoke* ___parent_culture_25;
int32_t ___constructed_26;
Il2CppSafeArray/*NONE*/* ___cached_serialized_form_27;
CultureData_tF43B080FFA6EB278F4F289BCDA3FB74B6C208ECD_marshaled_pinvoke* ___m_cultureData_28;
int32_t ___m_isInherited_29;
};
// Native definition for COM marshalling of System.Globalization.CultureInfo
struct CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_marshaled_com
{
int32_t ___m_isReadOnly_3;
int32_t ___cultureID_4;
int32_t ___parent_lcid_5;
int32_t ___datetime_index_6;
int32_t ___number_index_7;
int32_t ___default_calendar_type_8;
int32_t ___m_useUserOverride_9;
NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8 * ___numInfo_10;
DateTimeFormatInfo_tF4BB3AA482C2F772D2A9022F78BF8727830FAF5F * ___dateTimeInfo_11;
TextInfo_t5F1E697CB6A7E5EC80F0DC3A968B9B4A70C291D8 * ___textInfo_12;
Il2CppChar* ___m_name_13;
Il2CppChar* ___englishname_14;
Il2CppChar* ___nativename_15;
Il2CppChar* ___iso3lang_16;
Il2CppChar* ___iso2lang_17;
Il2CppChar* ___win3lang_18;
Il2CppChar* ___territory_19;
Il2CppChar** ___native_calendar_names_20;
CompareInfo_tB9A071DBC11AC00AF2EA2066D0C2AE1DCB1865D1 * ___compareInfo_21;
void* ___textinfo_data_22;
int32_t ___m_dataItem_23;
Calendar_tF55A785ACD277504CF0D2F2C6AD56F76C6E91BD5 * ___calendar_24;
CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_marshaled_com* ___parent_culture_25;
int32_t ___constructed_26;
Il2CppSafeArray/*NONE*/* ___cached_serialized_form_27;
CultureData_tF43B080FFA6EB278F4F289BCDA3FB74B6C208ECD_marshaled_com* ___m_cultureData_28;
int32_t ___m_isInherited_29;
};
// System.String
struct String_t : public RuntimeObject
{
public:
// System.Int32 System.String::m_stringLength
int32_t ___m_stringLength_0;
// System.Char System.String::m_firstChar
Il2CppChar ___m_firstChar_1;
public:
inline static int32_t get_offset_of_m_stringLength_0() { return static_cast<int32_t>(offsetof(String_t, ___m_stringLength_0)); }
inline int32_t get_m_stringLength_0() const { return ___m_stringLength_0; }
inline int32_t* get_address_of_m_stringLength_0() { return &___m_stringLength_0; }
inline void set_m_stringLength_0(int32_t value)
{
___m_stringLength_0 = value;
}
inline static int32_t get_offset_of_m_firstChar_1() { return static_cast<int32_t>(offsetof(String_t, ___m_firstChar_1)); }
inline Il2CppChar get_m_firstChar_1() const { return ___m_firstChar_1; }
inline Il2CppChar* get_address_of_m_firstChar_1() { return &___m_firstChar_1; }
inline void set_m_firstChar_1(Il2CppChar value)
{
___m_firstChar_1 = value;
}
};
struct String_t_StaticFields
{
public:
// System.String System.String::Empty
String_t* ___Empty_5;
public:
inline static int32_t get_offset_of_Empty_5() { return static_cast<int32_t>(offsetof(String_t_StaticFields, ___Empty_5)); }
inline String_t* get_Empty_5() const { return ___Empty_5; }
inline String_t** get_address_of_Empty_5() { return &___Empty_5; }
inline void set_Empty_5(String_t* value)
{
___Empty_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&___Empty_5), (void*)value);
}
};
// System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF : public RuntimeObject
{
public:
public:
};
// Native definition for P/Invoke marshalling of System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_marshaled_com
{
};
// UnityEngine.UnityString
struct UnityString_t23ABC3E7AC3E5DA2DAF1DE7A50E1670E3DC6691B : public RuntimeObject
{
public:
public:
};
// System.Boolean
struct Boolean_tB53F6830F670160873277339AA58F15CAED4399C
{
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_tB53F6830F670160873277339AA58F15CAED4399C, ___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_tB53F6830F670160873277339AA58F15CAED4399C_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_tB53F6830F670160873277339AA58F15CAED4399C_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_tB53F6830F670160873277339AA58F15CAED4399C_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.Enum
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521 : public ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF
{
public:
public:
};
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_StaticFields
{
public:
// System.Char[] System.Enum::enumSeperatorCharArray
CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2* ___enumSeperatorCharArray_0;
public:
inline static int32_t get_offset_of_enumSeperatorCharArray_0() { return static_cast<int32_t>(offsetof(Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_StaticFields, ___enumSeperatorCharArray_0)); }
inline CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2* get_enumSeperatorCharArray_0() const { return ___enumSeperatorCharArray_0; }
inline CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2** get_address_of_enumSeperatorCharArray_0() { return &___enumSeperatorCharArray_0; }
inline void set_enumSeperatorCharArray_0(CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2* value)
{
___enumSeperatorCharArray_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___enumSeperatorCharArray_0), (void*)value);
}
};
// Native definition for P/Invoke marshalling of System.Enum
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.Enum
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_marshaled_com
{
};
// 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.Void
struct Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017
{
public:
union
{
struct
{
};
uint8_t Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017__padding[1];
};
public:
};
// UnityEngine.AssetFileNameExtensionAttribute
struct AssetFileNameExtensionAttribute_t634736D44FACBB2E58C82ABE354A807BD77DEB03 : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
// System.String UnityEngine.AssetFileNameExtensionAttribute::<preferredExtension>k__BackingField
String_t* ___U3CpreferredExtensionU3Ek__BackingField_0;
// System.Collections.Generic.IEnumerable`1<System.String> UnityEngine.AssetFileNameExtensionAttribute::<otherExtensions>k__BackingField
RuntimeObject* ___U3CotherExtensionsU3Ek__BackingField_1;
public:
inline static int32_t get_offset_of_U3CpreferredExtensionU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(AssetFileNameExtensionAttribute_t634736D44FACBB2E58C82ABE354A807BD77DEB03, ___U3CpreferredExtensionU3Ek__BackingField_0)); }
inline String_t* get_U3CpreferredExtensionU3Ek__BackingField_0() const { return ___U3CpreferredExtensionU3Ek__BackingField_0; }
inline String_t** get_address_of_U3CpreferredExtensionU3Ek__BackingField_0() { return &___U3CpreferredExtensionU3Ek__BackingField_0; }
inline void set_U3CpreferredExtensionU3Ek__BackingField_0(String_t* value)
{
___U3CpreferredExtensionU3Ek__BackingField_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CpreferredExtensionU3Ek__BackingField_0), (void*)value);
}
inline static int32_t get_offset_of_U3CotherExtensionsU3Ek__BackingField_1() { return static_cast<int32_t>(offsetof(AssetFileNameExtensionAttribute_t634736D44FACBB2E58C82ABE354A807BD77DEB03, ___U3CotherExtensionsU3Ek__BackingField_1)); }
inline RuntimeObject* get_U3CotherExtensionsU3Ek__BackingField_1() const { return ___U3CotherExtensionsU3Ek__BackingField_1; }
inline RuntimeObject** get_address_of_U3CotherExtensionsU3Ek__BackingField_1() { return &___U3CotherExtensionsU3Ek__BackingField_1; }
inline void set_U3CotherExtensionsU3Ek__BackingField_1(RuntimeObject* value)
{
___U3CotherExtensionsU3Ek__BackingField_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CotherExtensionsU3Ek__BackingField_1), (void*)value);
}
};
// UnityEngine.Bindings.IgnoreAttribute
struct IgnoreAttribute_tD849E806CA1C75980B97B047908DE57D156B775F : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
// System.Boolean UnityEngine.Bindings.IgnoreAttribute::<DoesNotContributeToSize>k__BackingField
bool ___U3CDoesNotContributeToSizeU3Ek__BackingField_0;
public:
inline static int32_t get_offset_of_U3CDoesNotContributeToSizeU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(IgnoreAttribute_tD849E806CA1C75980B97B047908DE57D156B775F, ___U3CDoesNotContributeToSizeU3Ek__BackingField_0)); }
inline bool get_U3CDoesNotContributeToSizeU3Ek__BackingField_0() const { return ___U3CDoesNotContributeToSizeU3Ek__BackingField_0; }
inline bool* get_address_of_U3CDoesNotContributeToSizeU3Ek__BackingField_0() { return &___U3CDoesNotContributeToSizeU3Ek__BackingField_0; }
inline void set_U3CDoesNotContributeToSizeU3Ek__BackingField_0(bool value)
{
___U3CDoesNotContributeToSizeU3Ek__BackingField_0 = value;
}
};
// UnityEngine.Bindings.NativeConditionalAttribute
struct NativeConditionalAttribute_t8F72026EC5B1194F1D82D72E0C76C51D7D7FBD2E : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
// System.String UnityEngine.Bindings.NativeConditionalAttribute::<Condition>k__BackingField
String_t* ___U3CConditionU3Ek__BackingField_0;
// System.Boolean UnityEngine.Bindings.NativeConditionalAttribute::<Enabled>k__BackingField
bool ___U3CEnabledU3Ek__BackingField_1;
public:
inline static int32_t get_offset_of_U3CConditionU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(NativeConditionalAttribute_t8F72026EC5B1194F1D82D72E0C76C51D7D7FBD2E, ___U3CConditionU3Ek__BackingField_0)); }
inline String_t* get_U3CConditionU3Ek__BackingField_0() const { return ___U3CConditionU3Ek__BackingField_0; }
inline String_t** get_address_of_U3CConditionU3Ek__BackingField_0() { return &___U3CConditionU3Ek__BackingField_0; }
inline void set_U3CConditionU3Ek__BackingField_0(String_t* value)
{
___U3CConditionU3Ek__BackingField_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CConditionU3Ek__BackingField_0), (void*)value);
}
inline static int32_t get_offset_of_U3CEnabledU3Ek__BackingField_1() { return static_cast<int32_t>(offsetof(NativeConditionalAttribute_t8F72026EC5B1194F1D82D72E0C76C51D7D7FBD2E, ___U3CEnabledU3Ek__BackingField_1)); }
inline bool get_U3CEnabledU3Ek__BackingField_1() const { return ___U3CEnabledU3Ek__BackingField_1; }
inline bool* get_address_of_U3CEnabledU3Ek__BackingField_1() { return &___U3CEnabledU3Ek__BackingField_1; }
inline void set_U3CEnabledU3Ek__BackingField_1(bool value)
{
___U3CEnabledU3Ek__BackingField_1 = value;
}
};
// UnityEngine.Bindings.NativeHeaderAttribute
struct NativeHeaderAttribute_t5C38607694D73834F0B9EB2AB0E575D3FD6D0D8B : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
// System.String UnityEngine.Bindings.NativeHeaderAttribute::<Header>k__BackingField
String_t* ___U3CHeaderU3Ek__BackingField_0;
public:
inline static int32_t get_offset_of_U3CHeaderU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(NativeHeaderAttribute_t5C38607694D73834F0B9EB2AB0E575D3FD6D0D8B, ___U3CHeaderU3Ek__BackingField_0)); }
inline String_t* get_U3CHeaderU3Ek__BackingField_0() const { return ___U3CHeaderU3Ek__BackingField_0; }
inline String_t** get_address_of_U3CHeaderU3Ek__BackingField_0() { return &___U3CHeaderU3Ek__BackingField_0; }
inline void set_U3CHeaderU3Ek__BackingField_0(String_t* value)
{
___U3CHeaderU3Ek__BackingField_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CHeaderU3Ek__BackingField_0), (void*)value);
}
};
// UnityEngine.Bindings.NativeMethodAttribute
struct NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
// System.String UnityEngine.Bindings.NativeMethodAttribute::<Name>k__BackingField
String_t* ___U3CNameU3Ek__BackingField_0;
// System.Boolean UnityEngine.Bindings.NativeMethodAttribute::<IsThreadSafe>k__BackingField
bool ___U3CIsThreadSafeU3Ek__BackingField_1;
// System.Boolean UnityEngine.Bindings.NativeMethodAttribute::<IsFreeFunction>k__BackingField
bool ___U3CIsFreeFunctionU3Ek__BackingField_2;
// System.Boolean UnityEngine.Bindings.NativeMethodAttribute::<ThrowsException>k__BackingField
bool ___U3CThrowsExceptionU3Ek__BackingField_3;
// System.Boolean UnityEngine.Bindings.NativeMethodAttribute::<HasExplicitThis>k__BackingField
bool ___U3CHasExplicitThisU3Ek__BackingField_4;
public:
inline static int32_t get_offset_of_U3CNameU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309, ___U3CNameU3Ek__BackingField_0)); }
inline String_t* get_U3CNameU3Ek__BackingField_0() const { return ___U3CNameU3Ek__BackingField_0; }
inline String_t** get_address_of_U3CNameU3Ek__BackingField_0() { return &___U3CNameU3Ek__BackingField_0; }
inline void set_U3CNameU3Ek__BackingField_0(String_t* value)
{
___U3CNameU3Ek__BackingField_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CNameU3Ek__BackingField_0), (void*)value);
}
inline static int32_t get_offset_of_U3CIsThreadSafeU3Ek__BackingField_1() { return static_cast<int32_t>(offsetof(NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309, ___U3CIsThreadSafeU3Ek__BackingField_1)); }
inline bool get_U3CIsThreadSafeU3Ek__BackingField_1() const { return ___U3CIsThreadSafeU3Ek__BackingField_1; }
inline bool* get_address_of_U3CIsThreadSafeU3Ek__BackingField_1() { return &___U3CIsThreadSafeU3Ek__BackingField_1; }
inline void set_U3CIsThreadSafeU3Ek__BackingField_1(bool value)
{
___U3CIsThreadSafeU3Ek__BackingField_1 = value;
}
inline static int32_t get_offset_of_U3CIsFreeFunctionU3Ek__BackingField_2() { return static_cast<int32_t>(offsetof(NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309, ___U3CIsFreeFunctionU3Ek__BackingField_2)); }
inline bool get_U3CIsFreeFunctionU3Ek__BackingField_2() const { return ___U3CIsFreeFunctionU3Ek__BackingField_2; }
inline bool* get_address_of_U3CIsFreeFunctionU3Ek__BackingField_2() { return &___U3CIsFreeFunctionU3Ek__BackingField_2; }
inline void set_U3CIsFreeFunctionU3Ek__BackingField_2(bool value)
{
___U3CIsFreeFunctionU3Ek__BackingField_2 = value;
}
inline static int32_t get_offset_of_U3CThrowsExceptionU3Ek__BackingField_3() { return static_cast<int32_t>(offsetof(NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309, ___U3CThrowsExceptionU3Ek__BackingField_3)); }
inline bool get_U3CThrowsExceptionU3Ek__BackingField_3() const { return ___U3CThrowsExceptionU3Ek__BackingField_3; }
inline bool* get_address_of_U3CThrowsExceptionU3Ek__BackingField_3() { return &___U3CThrowsExceptionU3Ek__BackingField_3; }
inline void set_U3CThrowsExceptionU3Ek__BackingField_3(bool value)
{
___U3CThrowsExceptionU3Ek__BackingField_3 = value;
}
inline static int32_t get_offset_of_U3CHasExplicitThisU3Ek__BackingField_4() { return static_cast<int32_t>(offsetof(NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309, ___U3CHasExplicitThisU3Ek__BackingField_4)); }
inline bool get_U3CHasExplicitThisU3Ek__BackingField_4() const { return ___U3CHasExplicitThisU3Ek__BackingField_4; }
inline bool* get_address_of_U3CHasExplicitThisU3Ek__BackingField_4() { return &___U3CHasExplicitThisU3Ek__BackingField_4; }
inline void set_U3CHasExplicitThisU3Ek__BackingField_4(bool value)
{
___U3CHasExplicitThisU3Ek__BackingField_4 = value;
}
};
// UnityEngine.Bindings.NativeNameAttribute
struct NativeNameAttribute_t16D90ABD66BD1E0081A2D037FE91ECF220E797F9 : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
// System.String UnityEngine.Bindings.NativeNameAttribute::<Name>k__BackingField
String_t* ___U3CNameU3Ek__BackingField_0;
public:
inline static int32_t get_offset_of_U3CNameU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(NativeNameAttribute_t16D90ABD66BD1E0081A2D037FE91ECF220E797F9, ___U3CNameU3Ek__BackingField_0)); }
inline String_t* get_U3CNameU3Ek__BackingField_0() const { return ___U3CNameU3Ek__BackingField_0; }
inline String_t** get_address_of_U3CNameU3Ek__BackingField_0() { return &___U3CNameU3Ek__BackingField_0; }
inline void set_U3CNameU3Ek__BackingField_0(String_t* value)
{
___U3CNameU3Ek__BackingField_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CNameU3Ek__BackingField_0), (void*)value);
}
};
// UnityEngine.Bindings.NativeThrowsAttribute
struct NativeThrowsAttribute_t0DAF98C14FF11B321CBB7131226E0A2413426EFA : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
// System.Boolean UnityEngine.Bindings.NativeThrowsAttribute::<ThrowsException>k__BackingField
bool ___U3CThrowsExceptionU3Ek__BackingField_0;
public:
inline static int32_t get_offset_of_U3CThrowsExceptionU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(NativeThrowsAttribute_t0DAF98C14FF11B321CBB7131226E0A2413426EFA, ___U3CThrowsExceptionU3Ek__BackingField_0)); }
inline bool get_U3CThrowsExceptionU3Ek__BackingField_0() const { return ___U3CThrowsExceptionU3Ek__BackingField_0; }
inline bool* get_address_of_U3CThrowsExceptionU3Ek__BackingField_0() { return &___U3CThrowsExceptionU3Ek__BackingField_0; }
inline void set_U3CThrowsExceptionU3Ek__BackingField_0(bool value)
{
___U3CThrowsExceptionU3Ek__BackingField_0 = value;
}
};
// UnityEngine.Bindings.NotNullAttribute
struct NotNullAttribute_t04A526B0B7DD6B37D2FFC6E5079575E0C461E2A0 : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
public:
};
// UnityEngine.Bindings.VisibleToOtherModulesAttribute
struct VisibleToOtherModulesAttribute_t8601A3A00D7B9528C62DD278E53B317B566FDA90 : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
public:
};
// UnityEngine.NativeClassAttribute
struct NativeClassAttribute_t1CA9B99EEAAFC1EE97D52505821BD3AD15F8448C : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
// System.String UnityEngine.NativeClassAttribute::<QualifiedNativeName>k__BackingField
String_t* ___U3CQualifiedNativeNameU3Ek__BackingField_0;
// System.String UnityEngine.NativeClassAttribute::<Declaration>k__BackingField
String_t* ___U3CDeclarationU3Ek__BackingField_1;
public:
inline static int32_t get_offset_of_U3CQualifiedNativeNameU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(NativeClassAttribute_t1CA9B99EEAAFC1EE97D52505821BD3AD15F8448C, ___U3CQualifiedNativeNameU3Ek__BackingField_0)); }
inline String_t* get_U3CQualifiedNativeNameU3Ek__BackingField_0() const { return ___U3CQualifiedNativeNameU3Ek__BackingField_0; }
inline String_t** get_address_of_U3CQualifiedNativeNameU3Ek__BackingField_0() { return &___U3CQualifiedNativeNameU3Ek__BackingField_0; }
inline void set_U3CQualifiedNativeNameU3Ek__BackingField_0(String_t* value)
{
___U3CQualifiedNativeNameU3Ek__BackingField_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CQualifiedNativeNameU3Ek__BackingField_0), (void*)value);
}
inline static int32_t get_offset_of_U3CDeclarationU3Ek__BackingField_1() { return static_cast<int32_t>(offsetof(NativeClassAttribute_t1CA9B99EEAAFC1EE97D52505821BD3AD15F8448C, ___U3CDeclarationU3Ek__BackingField_1)); }
inline String_t* get_U3CDeclarationU3Ek__BackingField_1() const { return ___U3CDeclarationU3Ek__BackingField_1; }
inline String_t** get_address_of_U3CDeclarationU3Ek__BackingField_1() { return &___U3CDeclarationU3Ek__BackingField_1; }
inline void set_U3CDeclarationU3Ek__BackingField_1(String_t* value)
{
___U3CDeclarationU3Ek__BackingField_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CDeclarationU3Ek__BackingField_1), (void*)value);
}
};
// UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute
struct GeneratedByOldBindingsGeneratorAttribute_tF3386E1746F60B4E1D77C2167915FBB4B89BBA86 : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
public:
};
// UnityEngine.Scripting.RequiredByNativeCodeAttribute
struct RequiredByNativeCodeAttribute_t949320E827C2BD269B3E686FE317A18835670AAE : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
// System.Boolean UnityEngine.Scripting.RequiredByNativeCodeAttribute::<Optional>k__BackingField
bool ___U3COptionalU3Ek__BackingField_0;
// System.Boolean UnityEngine.Scripting.RequiredByNativeCodeAttribute::<GenerateProxy>k__BackingField
bool ___U3CGenerateProxyU3Ek__BackingField_1;
public:
inline static int32_t get_offset_of_U3COptionalU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(RequiredByNativeCodeAttribute_t949320E827C2BD269B3E686FE317A18835670AAE, ___U3COptionalU3Ek__BackingField_0)); }
inline bool get_U3COptionalU3Ek__BackingField_0() const { return ___U3COptionalU3Ek__BackingField_0; }
inline bool* get_address_of_U3COptionalU3Ek__BackingField_0() { return &___U3COptionalU3Ek__BackingField_0; }
inline void set_U3COptionalU3Ek__BackingField_0(bool value)
{
___U3COptionalU3Ek__BackingField_0 = value;
}
inline static int32_t get_offset_of_U3CGenerateProxyU3Ek__BackingField_1() { return static_cast<int32_t>(offsetof(RequiredByNativeCodeAttribute_t949320E827C2BD269B3E686FE317A18835670AAE, ___U3CGenerateProxyU3Ek__BackingField_1)); }
inline bool get_U3CGenerateProxyU3Ek__BackingField_1() const { return ___U3CGenerateProxyU3Ek__BackingField_1; }
inline bool* get_address_of_U3CGenerateProxyU3Ek__BackingField_1() { return &___U3CGenerateProxyU3Ek__BackingField_1; }
inline void set_U3CGenerateProxyU3Ek__BackingField_1(bool value)
{
___U3CGenerateProxyU3Ek__BackingField_1 = value;
}
};
// UnityEngine.Scripting.UsedByNativeCodeAttribute
struct UsedByNativeCodeAttribute_t923F9A140847AF2F193AD1AB33143B8774797912 : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
// System.String UnityEngine.Scripting.UsedByNativeCodeAttribute::<Name>k__BackingField
String_t* ___U3CNameU3Ek__BackingField_0;
public:
inline static int32_t get_offset_of_U3CNameU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(UsedByNativeCodeAttribute_t923F9A140847AF2F193AD1AB33143B8774797912, ___U3CNameU3Ek__BackingField_0)); }
inline String_t* get_U3CNameU3Ek__BackingField_0() const { return ___U3CNameU3Ek__BackingField_0; }
inline String_t** get_address_of_U3CNameU3Ek__BackingField_0() { return &___U3CNameU3Ek__BackingField_0; }
inline void set_U3CNameU3Ek__BackingField_0(String_t* value)
{
___U3CNameU3Ek__BackingField_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CNameU3Ek__BackingField_0), (void*)value);
}
};
// UnityEngine.ThreadAndSerializationSafeAttribute
struct ThreadAndSerializationSafeAttribute_tC7AAA73802AAF871C176CF59656C030E5BFA87AA : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
public:
};
// UnityEngine.UnityEngineModuleAssembly
struct UnityEngineModuleAssembly_t5CEBDCE354FDB9B42BFF9344E7EBA474E4C070DB : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
public:
};
// UnityEngine.WritableAttribute
struct WritableAttribute_tAEE55CD07B2C5AD9CDBAD9FAF35FBB94AD8DE9BD : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
public:
};
// System.Exception
struct Exception_t : public RuntimeObject
{
public:
// System.String System.Exception::_className
String_t* ____className_1;
// System.String System.Exception::_message
String_t* ____message_2;
// System.Collections.IDictionary System.Exception::_data
RuntimeObject* ____data_3;
// System.Exception System.Exception::_innerException
Exception_t * ____innerException_4;
// System.String System.Exception::_helpURL
String_t* ____helpURL_5;
// System.Object System.Exception::_stackTrace
RuntimeObject * ____stackTrace_6;
// System.String System.Exception::_stackTraceString
String_t* ____stackTraceString_7;
// System.String System.Exception::_remoteStackTraceString
String_t* ____remoteStackTraceString_8;
// System.Int32 System.Exception::_remoteStackIndex
int32_t ____remoteStackIndex_9;
// System.Object System.Exception::_dynamicMethods
RuntimeObject * ____dynamicMethods_10;
// System.Int32 System.Exception::_HResult
int32_t ____HResult_11;
// System.String System.Exception::_source
String_t* ____source_12;
// System.Runtime.Serialization.SafeSerializationManager System.Exception::_safeSerializationManager
SafeSerializationManager_t4A754D86B0F784B18CBC36C073BA564BED109770 * ____safeSerializationManager_13;
// System.Diagnostics.StackTrace[] System.Exception::captured_traces
StackTraceU5BU5D_t855F09649EA34DEE7C1B6F088E0538E3CCC3F196* ___captured_traces_14;
// System.IntPtr[] System.Exception::native_trace_ips
IntPtrU5BU5D_t4DC01DCB9A6DF6C9792A6513595D7A11E637DCDD* ___native_trace_ips_15;
public:
inline static int32_t get_offset_of__className_1() { return static_cast<int32_t>(offsetof(Exception_t, ____className_1)); }
inline String_t* get__className_1() const { return ____className_1; }
inline String_t** get_address_of__className_1() { return &____className_1; }
inline void set__className_1(String_t* value)
{
____className_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&____className_1), (void*)value);
}
inline static int32_t get_offset_of__message_2() { return static_cast<int32_t>(offsetof(Exception_t, ____message_2)); }
inline String_t* get__message_2() const { return ____message_2; }
inline String_t** get_address_of__message_2() { return &____message_2; }
inline void set__message_2(String_t* value)
{
____message_2 = value;
Il2CppCodeGenWriteBarrier((void**)(&____message_2), (void*)value);
}
inline static int32_t get_offset_of__data_3() { return static_cast<int32_t>(offsetof(Exception_t, ____data_3)); }
inline RuntimeObject* get__data_3() const { return ____data_3; }
inline RuntimeObject** get_address_of__data_3() { return &____data_3; }
inline void set__data_3(RuntimeObject* value)
{
____data_3 = value;
Il2CppCodeGenWriteBarrier((void**)(&____data_3), (void*)value);
}
inline static int32_t get_offset_of__innerException_4() { return static_cast<int32_t>(offsetof(Exception_t, ____innerException_4)); }
inline Exception_t * get__innerException_4() const { return ____innerException_4; }
inline Exception_t ** get_address_of__innerException_4() { return &____innerException_4; }
inline void set__innerException_4(Exception_t * value)
{
____innerException_4 = value;
Il2CppCodeGenWriteBarrier((void**)(&____innerException_4), (void*)value);
}
inline static int32_t get_offset_of__helpURL_5() { return static_cast<int32_t>(offsetof(Exception_t, ____helpURL_5)); }
inline String_t* get__helpURL_5() const { return ____helpURL_5; }
inline String_t** get_address_of__helpURL_5() { return &____helpURL_5; }
inline void set__helpURL_5(String_t* value)
{
____helpURL_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&____helpURL_5), (void*)value);
}
inline static int32_t get_offset_of__stackTrace_6() { return static_cast<int32_t>(offsetof(Exception_t, ____stackTrace_6)); }
inline RuntimeObject * get__stackTrace_6() const { return ____stackTrace_6; }
inline RuntimeObject ** get_address_of__stackTrace_6() { return &____stackTrace_6; }
inline void set__stackTrace_6(RuntimeObject * value)
{
____stackTrace_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&____stackTrace_6), (void*)value);
}
inline static int32_t get_offset_of__stackTraceString_7() { return static_cast<int32_t>(offsetof(Exception_t, ____stackTraceString_7)); }
inline String_t* get__stackTraceString_7() const { return ____stackTraceString_7; }
inline String_t** get_address_of__stackTraceString_7() { return &____stackTraceString_7; }
inline void set__stackTraceString_7(String_t* value)
{
____stackTraceString_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&____stackTraceString_7), (void*)value);
}
inline static int32_t get_offset_of__remoteStackTraceString_8() { return static_cast<int32_t>(offsetof(Exception_t, ____remoteStackTraceString_8)); }
inline String_t* get__remoteStackTraceString_8() const { return ____remoteStackTraceString_8; }
inline String_t** get_address_of__remoteStackTraceString_8() { return &____remoteStackTraceString_8; }
inline void set__remoteStackTraceString_8(String_t* value)
{
____remoteStackTraceString_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&____remoteStackTraceString_8), (void*)value);
}
inline static int32_t get_offset_of__remoteStackIndex_9() { return static_cast<int32_t>(offsetof(Exception_t, ____remoteStackIndex_9)); }
inline int32_t get__remoteStackIndex_9() const { return ____remoteStackIndex_9; }
inline int32_t* get_address_of__remoteStackIndex_9() { return &____remoteStackIndex_9; }
inline void set__remoteStackIndex_9(int32_t value)
{
____remoteStackIndex_9 = value;
}
inline static int32_t get_offset_of__dynamicMethods_10() { return static_cast<int32_t>(offsetof(Exception_t, ____dynamicMethods_10)); }
inline RuntimeObject * get__dynamicMethods_10() const { return ____dynamicMethods_10; }
inline RuntimeObject ** get_address_of__dynamicMethods_10() { return &____dynamicMethods_10; }
inline void set__dynamicMethods_10(RuntimeObject * value)
{
____dynamicMethods_10 = value;
Il2CppCodeGenWriteBarrier((void**)(&____dynamicMethods_10), (void*)value);
}
inline static int32_t get_offset_of__HResult_11() { return static_cast<int32_t>(offsetof(Exception_t, ____HResult_11)); }
inline int32_t get__HResult_11() const { return ____HResult_11; }
inline int32_t* get_address_of__HResult_11() { return &____HResult_11; }
inline void set__HResult_11(int32_t value)
{
____HResult_11 = value;
}
inline static int32_t get_offset_of__source_12() { return static_cast<int32_t>(offsetof(Exception_t, ____source_12)); }
inline String_t* get__source_12() const { return ____source_12; }
inline String_t** get_address_of__source_12() { return &____source_12; }
inline void set__source_12(String_t* value)
{
____source_12 = value;
Il2CppCodeGenWriteBarrier((void**)(&____source_12), (void*)value);
}
inline static int32_t get_offset_of__safeSerializationManager_13() { return static_cast<int32_t>(offsetof(Exception_t, ____safeSerializationManager_13)); }
inline SafeSerializationManager_t4A754D86B0F784B18CBC36C073BA564BED109770 * get__safeSerializationManager_13() const { return ____safeSerializationManager_13; }
inline SafeSerializationManager_t4A754D86B0F784B18CBC36C073BA564BED109770 ** get_address_of__safeSerializationManager_13() { return &____safeSerializationManager_13; }
inline void set__safeSerializationManager_13(SafeSerializationManager_t4A754D86B0F784B18CBC36C073BA564BED109770 * value)
{
____safeSerializationManager_13 = value;
Il2CppCodeGenWriteBarrier((void**)(&____safeSerializationManager_13), (void*)value);
}
inline static int32_t get_offset_of_captured_traces_14() { return static_cast<int32_t>(offsetof(Exception_t, ___captured_traces_14)); }
inline StackTraceU5BU5D_t855F09649EA34DEE7C1B6F088E0538E3CCC3F196* get_captured_traces_14() const { return ___captured_traces_14; }
inline StackTraceU5BU5D_t855F09649EA34DEE7C1B6F088E0538E3CCC3F196** get_address_of_captured_traces_14() { return &___captured_traces_14; }
inline void set_captured_traces_14(StackTraceU5BU5D_t855F09649EA34DEE7C1B6F088E0538E3CCC3F196* value)
{
___captured_traces_14 = value;
Il2CppCodeGenWriteBarrier((void**)(&___captured_traces_14), (void*)value);
}
inline static int32_t get_offset_of_native_trace_ips_15() { return static_cast<int32_t>(offsetof(Exception_t, ___native_trace_ips_15)); }
inline IntPtrU5BU5D_t4DC01DCB9A6DF6C9792A6513595D7A11E637DCDD* get_native_trace_ips_15() const { return ___native_trace_ips_15; }
inline IntPtrU5BU5D_t4DC01DCB9A6DF6C9792A6513595D7A11E637DCDD** get_address_of_native_trace_ips_15() { return &___native_trace_ips_15; }
inline void set_native_trace_ips_15(IntPtrU5BU5D_t4DC01DCB9A6DF6C9792A6513595D7A11E637DCDD* value)
{
___native_trace_ips_15 = value;
Il2CppCodeGenWriteBarrier((void**)(&___native_trace_ips_15), (void*)value);
}
};
struct Exception_t_StaticFields
{
public:
// System.Object System.Exception::s_EDILock
RuntimeObject * ___s_EDILock_0;
public:
inline static int32_t get_offset_of_s_EDILock_0() { return static_cast<int32_t>(offsetof(Exception_t_StaticFields, ___s_EDILock_0)); }
inline RuntimeObject * get_s_EDILock_0() const { return ___s_EDILock_0; }
inline RuntimeObject ** get_address_of_s_EDILock_0() { return &___s_EDILock_0; }
inline void set_s_EDILock_0(RuntimeObject * value)
{
___s_EDILock_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___s_EDILock_0), (void*)value);
}
};
// Native definition for P/Invoke marshalling of System.Exception
struct Exception_t_marshaled_pinvoke
{
char* ____className_1;
char* ____message_2;
RuntimeObject* ____data_3;
Exception_t_marshaled_pinvoke* ____innerException_4;
char* ____helpURL_5;
Il2CppIUnknown* ____stackTrace_6;
char* ____stackTraceString_7;
char* ____remoteStackTraceString_8;
int32_t ____remoteStackIndex_9;
Il2CppIUnknown* ____dynamicMethods_10;
int32_t ____HResult_11;
char* ____source_12;
SafeSerializationManager_t4A754D86B0F784B18CBC36C073BA564BED109770 * ____safeSerializationManager_13;
StackTraceU5BU5D_t855F09649EA34DEE7C1B6F088E0538E3CCC3F196* ___captured_traces_14;
Il2CppSafeArray/*NONE*/* ___native_trace_ips_15;
};
// Native definition for COM marshalling of System.Exception
struct Exception_t_marshaled_com
{
Il2CppChar* ____className_1;
Il2CppChar* ____message_2;
RuntimeObject* ____data_3;
Exception_t_marshaled_com* ____innerException_4;
Il2CppChar* ____helpURL_5;
Il2CppIUnknown* ____stackTrace_6;
Il2CppChar* ____stackTraceString_7;
Il2CppChar* ____remoteStackTraceString_8;
int32_t ____remoteStackIndex_9;
Il2CppIUnknown* ____dynamicMethods_10;
int32_t ____HResult_11;
Il2CppChar* ____source_12;
SafeSerializationManager_t4A754D86B0F784B18CBC36C073BA564BED109770 * ____safeSerializationManager_13;
StackTraceU5BU5D_t855F09649EA34DEE7C1B6F088E0538E3CCC3F196* ___captured_traces_14;
Il2CppSafeArray/*NONE*/* ___native_trace_ips_15;
};
// System.Globalization.NumberStyles
struct NumberStyles_tB0ADA2D9CCAA236331AED14C42BE5832B2351592
{
public:
// System.Int32 System.Globalization.NumberStyles::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(NumberStyles_tB0ADA2D9CCAA236331AED14C42BE5832B2351592, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
// UnityEngine.Bindings.CodegenOptions
struct CodegenOptions_t046CD01EAB9A7BBBF2862220BE36B1AE7AE895CE
{
public:
// System.Int32 UnityEngine.Bindings.CodegenOptions::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(CodegenOptions_t046CD01EAB9A7BBBF2862220BE36B1AE7AE895CE, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
// UnityEngine.Bindings.FreeFunctionAttribute
struct FreeFunctionAttribute_tE41160023E316B5E3DF87DA36BDDA9639DD835AE : public NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309
{
public:
public:
};
// UnityEngine.Bindings.StaticAccessorType
struct StaticAccessorType_t1F9C3101E6A29C700469488FDBC8F04FA6AFF061
{
public:
// System.Int32 UnityEngine.Bindings.StaticAccessorType::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(StaticAccessorType_t1F9C3101E6A29C700469488FDBC8F04FA6AFF061, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
// UnityEngine.Bindings.TargetType
struct TargetType_t8EE9F64281EE7EA0EDE81FA41E92A8C44C0F31BA
{
public:
// System.Int32 UnityEngine.Bindings.TargetType::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(TargetType_t8EE9F64281EE7EA0EDE81FA41E92A8C44C0F31BA, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
// UnityEngine.Bindings.ThreadSafeAttribute
struct ThreadSafeAttribute_t3FB9EE5993C748628BC06D9D46ACA3A58FDAE317 : public NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309
{
public:
public:
};
// System.Globalization.NumberFormatInfo
struct NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8 : public RuntimeObject
{
public:
// System.Int32[] System.Globalization.NumberFormatInfo::numberGroupSizes
Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* ___numberGroupSizes_1;
// System.Int32[] System.Globalization.NumberFormatInfo::currencyGroupSizes
Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* ___currencyGroupSizes_2;
// System.Int32[] System.Globalization.NumberFormatInfo::percentGroupSizes
Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* ___percentGroupSizes_3;
// System.String System.Globalization.NumberFormatInfo::positiveSign
String_t* ___positiveSign_4;
// System.String System.Globalization.NumberFormatInfo::negativeSign
String_t* ___negativeSign_5;
// System.String System.Globalization.NumberFormatInfo::numberDecimalSeparator
String_t* ___numberDecimalSeparator_6;
// System.String System.Globalization.NumberFormatInfo::numberGroupSeparator
String_t* ___numberGroupSeparator_7;
// System.String System.Globalization.NumberFormatInfo::currencyGroupSeparator
String_t* ___currencyGroupSeparator_8;
// System.String System.Globalization.NumberFormatInfo::currencyDecimalSeparator
String_t* ___currencyDecimalSeparator_9;
// System.String System.Globalization.NumberFormatInfo::currencySymbol
String_t* ___currencySymbol_10;
// System.String System.Globalization.NumberFormatInfo::ansiCurrencySymbol
String_t* ___ansiCurrencySymbol_11;
// System.String System.Globalization.NumberFormatInfo::nanSymbol
String_t* ___nanSymbol_12;
// System.String System.Globalization.NumberFormatInfo::positiveInfinitySymbol
String_t* ___positiveInfinitySymbol_13;
// System.String System.Globalization.NumberFormatInfo::negativeInfinitySymbol
String_t* ___negativeInfinitySymbol_14;
// System.String System.Globalization.NumberFormatInfo::percentDecimalSeparator
String_t* ___percentDecimalSeparator_15;
// System.String System.Globalization.NumberFormatInfo::percentGroupSeparator
String_t* ___percentGroupSeparator_16;
// System.String System.Globalization.NumberFormatInfo::percentSymbol
String_t* ___percentSymbol_17;
// System.String System.Globalization.NumberFormatInfo::perMilleSymbol
String_t* ___perMilleSymbol_18;
// System.String[] System.Globalization.NumberFormatInfo::nativeDigits
StringU5BU5D_t933FB07893230EA91C40FF900D5400665E87B14E* ___nativeDigits_19;
// System.Int32 System.Globalization.NumberFormatInfo::m_dataItem
int32_t ___m_dataItem_20;
// System.Int32 System.Globalization.NumberFormatInfo::numberDecimalDigits
int32_t ___numberDecimalDigits_21;
// System.Int32 System.Globalization.NumberFormatInfo::currencyDecimalDigits
int32_t ___currencyDecimalDigits_22;
// System.Int32 System.Globalization.NumberFormatInfo::currencyPositivePattern
int32_t ___currencyPositivePattern_23;
// System.Int32 System.Globalization.NumberFormatInfo::currencyNegativePattern
int32_t ___currencyNegativePattern_24;
// System.Int32 System.Globalization.NumberFormatInfo::numberNegativePattern
int32_t ___numberNegativePattern_25;
// System.Int32 System.Globalization.NumberFormatInfo::percentPositivePattern
int32_t ___percentPositivePattern_26;
// System.Int32 System.Globalization.NumberFormatInfo::percentNegativePattern
int32_t ___percentNegativePattern_27;
// System.Int32 System.Globalization.NumberFormatInfo::percentDecimalDigits
int32_t ___percentDecimalDigits_28;
// System.Int32 System.Globalization.NumberFormatInfo::digitSubstitution
int32_t ___digitSubstitution_29;
// System.Boolean System.Globalization.NumberFormatInfo::isReadOnly
bool ___isReadOnly_30;
// System.Boolean System.Globalization.NumberFormatInfo::m_useUserOverride
bool ___m_useUserOverride_31;
// System.Boolean System.Globalization.NumberFormatInfo::m_isInvariant
bool ___m_isInvariant_32;
// System.Boolean System.Globalization.NumberFormatInfo::validForParseAsNumber
bool ___validForParseAsNumber_33;
// System.Boolean System.Globalization.NumberFormatInfo::validForParseAsCurrency
bool ___validForParseAsCurrency_34;
public:
inline static int32_t get_offset_of_numberGroupSizes_1() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___numberGroupSizes_1)); }
inline Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* get_numberGroupSizes_1() const { return ___numberGroupSizes_1; }
inline Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83** get_address_of_numberGroupSizes_1() { return &___numberGroupSizes_1; }
inline void set_numberGroupSizes_1(Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* value)
{
___numberGroupSizes_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___numberGroupSizes_1), (void*)value);
}
inline static int32_t get_offset_of_currencyGroupSizes_2() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___currencyGroupSizes_2)); }
inline Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* get_currencyGroupSizes_2() const { return ___currencyGroupSizes_2; }
inline Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83** get_address_of_currencyGroupSizes_2() { return &___currencyGroupSizes_2; }
inline void set_currencyGroupSizes_2(Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* value)
{
___currencyGroupSizes_2 = value;
Il2CppCodeGenWriteBarrier((void**)(&___currencyGroupSizes_2), (void*)value);
}
inline static int32_t get_offset_of_percentGroupSizes_3() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___percentGroupSizes_3)); }
inline Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* get_percentGroupSizes_3() const { return ___percentGroupSizes_3; }
inline Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83** get_address_of_percentGroupSizes_3() { return &___percentGroupSizes_3; }
inline void set_percentGroupSizes_3(Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* value)
{
___percentGroupSizes_3 = value;
Il2CppCodeGenWriteBarrier((void**)(&___percentGroupSizes_3), (void*)value);
}
inline static int32_t get_offset_of_positiveSign_4() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___positiveSign_4)); }
inline String_t* get_positiveSign_4() const { return ___positiveSign_4; }
inline String_t** get_address_of_positiveSign_4() { return &___positiveSign_4; }
inline void set_positiveSign_4(String_t* value)
{
___positiveSign_4 = value;
Il2CppCodeGenWriteBarrier((void**)(&___positiveSign_4), (void*)value);
}
inline static int32_t get_offset_of_negativeSign_5() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___negativeSign_5)); }
inline String_t* get_negativeSign_5() const { return ___negativeSign_5; }
inline String_t** get_address_of_negativeSign_5() { return &___negativeSign_5; }
inline void set_negativeSign_5(String_t* value)
{
___negativeSign_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&___negativeSign_5), (void*)value);
}
inline static int32_t get_offset_of_numberDecimalSeparator_6() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___numberDecimalSeparator_6)); }
inline String_t* get_numberDecimalSeparator_6() const { return ___numberDecimalSeparator_6; }
inline String_t** get_address_of_numberDecimalSeparator_6() { return &___numberDecimalSeparator_6; }
inline void set_numberDecimalSeparator_6(String_t* value)
{
___numberDecimalSeparator_6 = value;
Il2CppCodeGenWriteBarrier((void**)(&___numberDecimalSeparator_6), (void*)value);
}
inline static int32_t get_offset_of_numberGroupSeparator_7() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___numberGroupSeparator_7)); }
inline String_t* get_numberGroupSeparator_7() const { return ___numberGroupSeparator_7; }
inline String_t** get_address_of_numberGroupSeparator_7() { return &___numberGroupSeparator_7; }
inline void set_numberGroupSeparator_7(String_t* value)
{
___numberGroupSeparator_7 = value;
Il2CppCodeGenWriteBarrier((void**)(&___numberGroupSeparator_7), (void*)value);
}
inline static int32_t get_offset_of_currencyGroupSeparator_8() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___currencyGroupSeparator_8)); }
inline String_t* get_currencyGroupSeparator_8() const { return ___currencyGroupSeparator_8; }
inline String_t** get_address_of_currencyGroupSeparator_8() { return &___currencyGroupSeparator_8; }
inline void set_currencyGroupSeparator_8(String_t* value)
{
___currencyGroupSeparator_8 = value;
Il2CppCodeGenWriteBarrier((void**)(&___currencyGroupSeparator_8), (void*)value);
}
inline static int32_t get_offset_of_currencyDecimalSeparator_9() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___currencyDecimalSeparator_9)); }
inline String_t* get_currencyDecimalSeparator_9() const { return ___currencyDecimalSeparator_9; }
inline String_t** get_address_of_currencyDecimalSeparator_9() { return &___currencyDecimalSeparator_9; }
inline void set_currencyDecimalSeparator_9(String_t* value)
{
___currencyDecimalSeparator_9 = value;
Il2CppCodeGenWriteBarrier((void**)(&___currencyDecimalSeparator_9), (void*)value);
}
inline static int32_t get_offset_of_currencySymbol_10() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___currencySymbol_10)); }
inline String_t* get_currencySymbol_10() const { return ___currencySymbol_10; }
inline String_t** get_address_of_currencySymbol_10() { return &___currencySymbol_10; }
inline void set_currencySymbol_10(String_t* value)
{
___currencySymbol_10 = value;
Il2CppCodeGenWriteBarrier((void**)(&___currencySymbol_10), (void*)value);
}
inline static int32_t get_offset_of_ansiCurrencySymbol_11() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___ansiCurrencySymbol_11)); }
inline String_t* get_ansiCurrencySymbol_11() const { return ___ansiCurrencySymbol_11; }
inline String_t** get_address_of_ansiCurrencySymbol_11() { return &___ansiCurrencySymbol_11; }
inline void set_ansiCurrencySymbol_11(String_t* value)
{
___ansiCurrencySymbol_11 = value;
Il2CppCodeGenWriteBarrier((void**)(&___ansiCurrencySymbol_11), (void*)value);
}
inline static int32_t get_offset_of_nanSymbol_12() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___nanSymbol_12)); }
inline String_t* get_nanSymbol_12() const { return ___nanSymbol_12; }
inline String_t** get_address_of_nanSymbol_12() { return &___nanSymbol_12; }
inline void set_nanSymbol_12(String_t* value)
{
___nanSymbol_12 = value;
Il2CppCodeGenWriteBarrier((void**)(&___nanSymbol_12), (void*)value);
}
inline static int32_t get_offset_of_positiveInfinitySymbol_13() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___positiveInfinitySymbol_13)); }
inline String_t* get_positiveInfinitySymbol_13() const { return ___positiveInfinitySymbol_13; }
inline String_t** get_address_of_positiveInfinitySymbol_13() { return &___positiveInfinitySymbol_13; }
inline void set_positiveInfinitySymbol_13(String_t* value)
{
___positiveInfinitySymbol_13 = value;
Il2CppCodeGenWriteBarrier((void**)(&___positiveInfinitySymbol_13), (void*)value);
}
inline static int32_t get_offset_of_negativeInfinitySymbol_14() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___negativeInfinitySymbol_14)); }
inline String_t* get_negativeInfinitySymbol_14() const { return ___negativeInfinitySymbol_14; }
inline String_t** get_address_of_negativeInfinitySymbol_14() { return &___negativeInfinitySymbol_14; }
inline void set_negativeInfinitySymbol_14(String_t* value)
{
___negativeInfinitySymbol_14 = value;
Il2CppCodeGenWriteBarrier((void**)(&___negativeInfinitySymbol_14), (void*)value);
}
inline static int32_t get_offset_of_percentDecimalSeparator_15() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___percentDecimalSeparator_15)); }
inline String_t* get_percentDecimalSeparator_15() const { return ___percentDecimalSeparator_15; }
inline String_t** get_address_of_percentDecimalSeparator_15() { return &___percentDecimalSeparator_15; }
inline void set_percentDecimalSeparator_15(String_t* value)
{
___percentDecimalSeparator_15 = value;
Il2CppCodeGenWriteBarrier((void**)(&___percentDecimalSeparator_15), (void*)value);
}
inline static int32_t get_offset_of_percentGroupSeparator_16() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___percentGroupSeparator_16)); }
inline String_t* get_percentGroupSeparator_16() const { return ___percentGroupSeparator_16; }
inline String_t** get_address_of_percentGroupSeparator_16() { return &___percentGroupSeparator_16; }
inline void set_percentGroupSeparator_16(String_t* value)
{
___percentGroupSeparator_16 = value;
Il2CppCodeGenWriteBarrier((void**)(&___percentGroupSeparator_16), (void*)value);
}
inline static int32_t get_offset_of_percentSymbol_17() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___percentSymbol_17)); }
inline String_t* get_percentSymbol_17() const { return ___percentSymbol_17; }
inline String_t** get_address_of_percentSymbol_17() { return &___percentSymbol_17; }
inline void set_percentSymbol_17(String_t* value)
{
___percentSymbol_17 = value;
Il2CppCodeGenWriteBarrier((void**)(&___percentSymbol_17), (void*)value);
}
inline static int32_t get_offset_of_perMilleSymbol_18() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___perMilleSymbol_18)); }
inline String_t* get_perMilleSymbol_18() const { return ___perMilleSymbol_18; }
inline String_t** get_address_of_perMilleSymbol_18() { return &___perMilleSymbol_18; }
inline void set_perMilleSymbol_18(String_t* value)
{
___perMilleSymbol_18 = value;
Il2CppCodeGenWriteBarrier((void**)(&___perMilleSymbol_18), (void*)value);
}
inline static int32_t get_offset_of_nativeDigits_19() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___nativeDigits_19)); }
inline StringU5BU5D_t933FB07893230EA91C40FF900D5400665E87B14E* get_nativeDigits_19() const { return ___nativeDigits_19; }
inline StringU5BU5D_t933FB07893230EA91C40FF900D5400665E87B14E** get_address_of_nativeDigits_19() { return &___nativeDigits_19; }
inline void set_nativeDigits_19(StringU5BU5D_t933FB07893230EA91C40FF900D5400665E87B14E* value)
{
___nativeDigits_19 = value;
Il2CppCodeGenWriteBarrier((void**)(&___nativeDigits_19), (void*)value);
}
inline static int32_t get_offset_of_m_dataItem_20() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___m_dataItem_20)); }
inline int32_t get_m_dataItem_20() const { return ___m_dataItem_20; }
inline int32_t* get_address_of_m_dataItem_20() { return &___m_dataItem_20; }
inline void set_m_dataItem_20(int32_t value)
{
___m_dataItem_20 = value;
}
inline static int32_t get_offset_of_numberDecimalDigits_21() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___numberDecimalDigits_21)); }
inline int32_t get_numberDecimalDigits_21() const { return ___numberDecimalDigits_21; }
inline int32_t* get_address_of_numberDecimalDigits_21() { return &___numberDecimalDigits_21; }
inline void set_numberDecimalDigits_21(int32_t value)
{
___numberDecimalDigits_21 = value;
}
inline static int32_t get_offset_of_currencyDecimalDigits_22() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___currencyDecimalDigits_22)); }
inline int32_t get_currencyDecimalDigits_22() const { return ___currencyDecimalDigits_22; }
inline int32_t* get_address_of_currencyDecimalDigits_22() { return &___currencyDecimalDigits_22; }
inline void set_currencyDecimalDigits_22(int32_t value)
{
___currencyDecimalDigits_22 = value;
}
inline static int32_t get_offset_of_currencyPositivePattern_23() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___currencyPositivePattern_23)); }
inline int32_t get_currencyPositivePattern_23() const { return ___currencyPositivePattern_23; }
inline int32_t* get_address_of_currencyPositivePattern_23() { return &___currencyPositivePattern_23; }
inline void set_currencyPositivePattern_23(int32_t value)
{
___currencyPositivePattern_23 = value;
}
inline static int32_t get_offset_of_currencyNegativePattern_24() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___currencyNegativePattern_24)); }
inline int32_t get_currencyNegativePattern_24() const { return ___currencyNegativePattern_24; }
inline int32_t* get_address_of_currencyNegativePattern_24() { return &___currencyNegativePattern_24; }
inline void set_currencyNegativePattern_24(int32_t value)
{
___currencyNegativePattern_24 = value;
}
inline static int32_t get_offset_of_numberNegativePattern_25() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___numberNegativePattern_25)); }
inline int32_t get_numberNegativePattern_25() const { return ___numberNegativePattern_25; }
inline int32_t* get_address_of_numberNegativePattern_25() { return &___numberNegativePattern_25; }
inline void set_numberNegativePattern_25(int32_t value)
{
___numberNegativePattern_25 = value;
}
inline static int32_t get_offset_of_percentPositivePattern_26() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___percentPositivePattern_26)); }
inline int32_t get_percentPositivePattern_26() const { return ___percentPositivePattern_26; }
inline int32_t* get_address_of_percentPositivePattern_26() { return &___percentPositivePattern_26; }
inline void set_percentPositivePattern_26(int32_t value)
{
___percentPositivePattern_26 = value;
}
inline static int32_t get_offset_of_percentNegativePattern_27() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___percentNegativePattern_27)); }
inline int32_t get_percentNegativePattern_27() const { return ___percentNegativePattern_27; }
inline int32_t* get_address_of_percentNegativePattern_27() { return &___percentNegativePattern_27; }
inline void set_percentNegativePattern_27(int32_t value)
{
___percentNegativePattern_27 = value;
}
inline static int32_t get_offset_of_percentDecimalDigits_28() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___percentDecimalDigits_28)); }
inline int32_t get_percentDecimalDigits_28() const { return ___percentDecimalDigits_28; }
inline int32_t* get_address_of_percentDecimalDigits_28() { return &___percentDecimalDigits_28; }
inline void set_percentDecimalDigits_28(int32_t value)
{
___percentDecimalDigits_28 = value;
}
inline static int32_t get_offset_of_digitSubstitution_29() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___digitSubstitution_29)); }
inline int32_t get_digitSubstitution_29() const { return ___digitSubstitution_29; }
inline int32_t* get_address_of_digitSubstitution_29() { return &___digitSubstitution_29; }
inline void set_digitSubstitution_29(int32_t value)
{
___digitSubstitution_29 = value;
}
inline static int32_t get_offset_of_isReadOnly_30() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___isReadOnly_30)); }
inline bool get_isReadOnly_30() const { return ___isReadOnly_30; }
inline bool* get_address_of_isReadOnly_30() { return &___isReadOnly_30; }
inline void set_isReadOnly_30(bool value)
{
___isReadOnly_30 = value;
}
inline static int32_t get_offset_of_m_useUserOverride_31() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___m_useUserOverride_31)); }
inline bool get_m_useUserOverride_31() const { return ___m_useUserOverride_31; }
inline bool* get_address_of_m_useUserOverride_31() { return &___m_useUserOverride_31; }
inline void set_m_useUserOverride_31(bool value)
{
___m_useUserOverride_31 = value;
}
inline static int32_t get_offset_of_m_isInvariant_32() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___m_isInvariant_32)); }
inline bool get_m_isInvariant_32() const { return ___m_isInvariant_32; }
inline bool* get_address_of_m_isInvariant_32() { return &___m_isInvariant_32; }
inline void set_m_isInvariant_32(bool value)
{
___m_isInvariant_32 = value;
}
inline static int32_t get_offset_of_validForParseAsNumber_33() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___validForParseAsNumber_33)); }
inline bool get_validForParseAsNumber_33() const { return ___validForParseAsNumber_33; }
inline bool* get_address_of_validForParseAsNumber_33() { return &___validForParseAsNumber_33; }
inline void set_validForParseAsNumber_33(bool value)
{
___validForParseAsNumber_33 = value;
}
inline static int32_t get_offset_of_validForParseAsCurrency_34() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8, ___validForParseAsCurrency_34)); }
inline bool get_validForParseAsCurrency_34() const { return ___validForParseAsCurrency_34; }
inline bool* get_address_of_validForParseAsCurrency_34() { return &___validForParseAsCurrency_34; }
inline void set_validForParseAsCurrency_34(bool value)
{
___validForParseAsCurrency_34 = value;
}
};
struct NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8_StaticFields
{
public:
// System.Globalization.NumberFormatInfo modreq(System.Runtime.CompilerServices.IsVolatile) System.Globalization.NumberFormatInfo::invariantInfo
NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8 * ___invariantInfo_0;
public:
inline static int32_t get_offset_of_invariantInfo_0() { return static_cast<int32_t>(offsetof(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8_StaticFields, ___invariantInfo_0)); }
inline NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8 * get_invariantInfo_0() const { return ___invariantInfo_0; }
inline NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8 ** get_address_of_invariantInfo_0() { return &___invariantInfo_0; }
inline void set_invariantInfo_0(NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8 * value)
{
___invariantInfo_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___invariantInfo_0), (void*)value);
}
};
// System.SystemException
struct SystemException_t5380468142AA850BE4A341D7AF3EAB9C78746782 : public Exception_t
{
public:
public:
};
// UnityEngine.Bindings.NativePropertyAttribute
struct NativePropertyAttribute_tD231CE0D66BEF2B7C0E5D3FF92B02E4FD0365C61 : public NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309
{
public:
// UnityEngine.Bindings.TargetType UnityEngine.Bindings.NativePropertyAttribute::<TargetType>k__BackingField
int32_t ___U3CTargetTypeU3Ek__BackingField_5;
public:
inline static int32_t get_offset_of_U3CTargetTypeU3Ek__BackingField_5() { return static_cast<int32_t>(offsetof(NativePropertyAttribute_tD231CE0D66BEF2B7C0E5D3FF92B02E4FD0365C61, ___U3CTargetTypeU3Ek__BackingField_5)); }
inline int32_t get_U3CTargetTypeU3Ek__BackingField_5() const { return ___U3CTargetTypeU3Ek__BackingField_5; }
inline int32_t* get_address_of_U3CTargetTypeU3Ek__BackingField_5() { return &___U3CTargetTypeU3Ek__BackingField_5; }
inline void set_U3CTargetTypeU3Ek__BackingField_5(int32_t value)
{
___U3CTargetTypeU3Ek__BackingField_5 = value;
}
};
// UnityEngine.Bindings.NativeTypeAttribute
struct NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
// System.String UnityEngine.Bindings.NativeTypeAttribute::<Header>k__BackingField
String_t* ___U3CHeaderU3Ek__BackingField_0;
// System.String UnityEngine.Bindings.NativeTypeAttribute::<IntermediateScriptingStructName>k__BackingField
String_t* ___U3CIntermediateScriptingStructNameU3Ek__BackingField_1;
// UnityEngine.Bindings.CodegenOptions UnityEngine.Bindings.NativeTypeAttribute::<CodegenOptions>k__BackingField
int32_t ___U3CCodegenOptionsU3Ek__BackingField_2;
public:
inline static int32_t get_offset_of_U3CHeaderU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831, ___U3CHeaderU3Ek__BackingField_0)); }
inline String_t* get_U3CHeaderU3Ek__BackingField_0() const { return ___U3CHeaderU3Ek__BackingField_0; }
inline String_t** get_address_of_U3CHeaderU3Ek__BackingField_0() { return &___U3CHeaderU3Ek__BackingField_0; }
inline void set_U3CHeaderU3Ek__BackingField_0(String_t* value)
{
___U3CHeaderU3Ek__BackingField_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CHeaderU3Ek__BackingField_0), (void*)value);
}
inline static int32_t get_offset_of_U3CIntermediateScriptingStructNameU3Ek__BackingField_1() { return static_cast<int32_t>(offsetof(NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831, ___U3CIntermediateScriptingStructNameU3Ek__BackingField_1)); }
inline String_t* get_U3CIntermediateScriptingStructNameU3Ek__BackingField_1() const { return ___U3CIntermediateScriptingStructNameU3Ek__BackingField_1; }
inline String_t** get_address_of_U3CIntermediateScriptingStructNameU3Ek__BackingField_1() { return &___U3CIntermediateScriptingStructNameU3Ek__BackingField_1; }
inline void set_U3CIntermediateScriptingStructNameU3Ek__BackingField_1(String_t* value)
{
___U3CIntermediateScriptingStructNameU3Ek__BackingField_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CIntermediateScriptingStructNameU3Ek__BackingField_1), (void*)value);
}
inline static int32_t get_offset_of_U3CCodegenOptionsU3Ek__BackingField_2() { return static_cast<int32_t>(offsetof(NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831, ___U3CCodegenOptionsU3Ek__BackingField_2)); }
inline int32_t get_U3CCodegenOptionsU3Ek__BackingField_2() const { return ___U3CCodegenOptionsU3Ek__BackingField_2; }
inline int32_t* get_address_of_U3CCodegenOptionsU3Ek__BackingField_2() { return &___U3CCodegenOptionsU3Ek__BackingField_2; }
inline void set_U3CCodegenOptionsU3Ek__BackingField_2(int32_t value)
{
___U3CCodegenOptionsU3Ek__BackingField_2 = value;
}
};
// UnityEngine.Bindings.StaticAccessorAttribute
struct StaticAccessorAttribute_tE507394A59220DFDF5DBE62DD94B6A00AA01D1F2 : public Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74
{
public:
// System.String UnityEngine.Bindings.StaticAccessorAttribute::<Name>k__BackingField
String_t* ___U3CNameU3Ek__BackingField_0;
// UnityEngine.Bindings.StaticAccessorType UnityEngine.Bindings.StaticAccessorAttribute::<Type>k__BackingField
int32_t ___U3CTypeU3Ek__BackingField_1;
public:
inline static int32_t get_offset_of_U3CNameU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(StaticAccessorAttribute_tE507394A59220DFDF5DBE62DD94B6A00AA01D1F2, ___U3CNameU3Ek__BackingField_0)); }
inline String_t* get_U3CNameU3Ek__BackingField_0() const { return ___U3CNameU3Ek__BackingField_0; }
inline String_t** get_address_of_U3CNameU3Ek__BackingField_0() { return &___U3CNameU3Ek__BackingField_0; }
inline void set_U3CNameU3Ek__BackingField_0(String_t* value)
{
___U3CNameU3Ek__BackingField_0 = value;
Il2CppCodeGenWriteBarrier((void**)(&___U3CNameU3Ek__BackingField_0), (void*)value);
}
inline static int32_t get_offset_of_U3CTypeU3Ek__BackingField_1() { return static_cast<int32_t>(offsetof(StaticAccessorAttribute_tE507394A59220DFDF5DBE62DD94B6A00AA01D1F2, ___U3CTypeU3Ek__BackingField_1)); }
inline int32_t get_U3CTypeU3Ek__BackingField_1() const { return ___U3CTypeU3Ek__BackingField_1; }
inline int32_t* get_address_of_U3CTypeU3Ek__BackingField_1() { return &___U3CTypeU3Ek__BackingField_1; }
inline void set_U3CTypeU3Ek__BackingField_1(int32_t value)
{
___U3CTypeU3Ek__BackingField_1 = value;
}
};
// System.ArgumentException
struct ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1 : public SystemException_t5380468142AA850BE4A341D7AF3EAB9C78746782
{
public:
// System.String System.ArgumentException::m_paramName
String_t* ___m_paramName_17;
public:
inline static int32_t get_offset_of_m_paramName_17() { return static_cast<int32_t>(offsetof(ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1, ___m_paramName_17)); }
inline String_t* get_m_paramName_17() const { return ___m_paramName_17; }
inline String_t** get_address_of_m_paramName_17() { return &___m_paramName_17; }
inline void set_m_paramName_17(String_t* value)
{
___m_paramName_17 = value;
Il2CppCodeGenWriteBarrier((void**)(&___m_paramName_17), (void*)value);
}
};
// System.ArgumentNullException
struct ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD : public ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// System.String[]
struct StringU5BU5D_t933FB07893230EA91C40FF900D5400665E87B14E : public RuntimeArray
{
public:
ALIGN_FIELD (8) String_t* m_Items[1];
public:
inline String_t* GetAt(il2cpp_array_size_t index) const
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items[index];
}
inline String_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, String_t* value)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
m_Items[index] = value;
Il2CppCodeGenWriteBarrier((void**)m_Items + index, (void*)value);
}
inline String_t* GetAtUnchecked(il2cpp_array_size_t index) const
{
return m_Items[index];
}
inline String_t** GetAddressAtUnchecked(il2cpp_array_size_t index)
{
return m_Items + index;
}
inline void SetAtUnchecked(il2cpp_array_size_t index, String_t* value)
{
m_Items[index] = value;
Il2CppCodeGenWriteBarrier((void**)m_Items + index, (void*)value);
}
};
// System.Object[]
struct ObjectU5BU5D_t3C9242B5C88A48B2A5BD9FDA6CD0024E792AF08A : public RuntimeArray
{
public:
ALIGN_FIELD (8) RuntimeObject * m_Items[1];
public:
inline RuntimeObject * GetAt(il2cpp_array_size_t index) const
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items[index];
}
inline RuntimeObject ** 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, RuntimeObject * value)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
m_Items[index] = value;
Il2CppCodeGenWriteBarrier((void**)m_Items + index, (void*)value);
}
inline RuntimeObject * GetAtUnchecked(il2cpp_array_size_t index) const
{
return m_Items[index];
}
inline RuntimeObject ** GetAddressAtUnchecked(il2cpp_array_size_t index)
{
return m_Items + index;
}
inline void SetAtUnchecked(il2cpp_array_size_t index, RuntimeObject * value)
{
m_Items[index] = value;
Il2CppCodeGenWriteBarrier((void**)m_Items + index, (void*)value);
}
};
// System.Void System.Attribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0 (Attribute_tF048C13FB3C8CFCC53F82290E4A3F621089F9A74 * __this, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeMethodAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeMethodAttribute__ctor_mE26CCBB6FA1CF524CDF21471D4D513E7DE1C5B43 (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeMethodAttribute::set_IsFreeFunction(System.Boolean)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeMethodAttribute_set_IsFreeFunction_m4A2C3A5DE2D0CCAC8FFFB6660BAD55A044EFFDDF_inline (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, bool ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeMethodAttribute::.ctor(System.String,System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeMethodAttribute__ctor_m34B386D374A17251F14912F04256860E57DF559F (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, String_t* ___name0, bool ___isFreeFunction1, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeMethodAttribute::.ctor(System.String,System.Boolean,System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeMethodAttribute__ctor_m793B5D7530F92DC04173E68EAD8F4A8F9232DD29 (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, String_t* ___name0, bool ___isFreeFunction1, bool ___isThreadSafe2, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeConditionalAttribute::set_Condition(System.String)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeConditionalAttribute_set_Condition_m0BD35F77FDBCC278203543FB3CAC35A8227474B5_inline (NativeConditionalAttribute_t8F72026EC5B1194F1D82D72E0C76C51D7D7FBD2E * __this, String_t* ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeConditionalAttribute::set_Enabled(System.Boolean)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeConditionalAttribute_set_Enabled_m3584B9F0F4BD7F3F8B8C49595D1900EF01B3C1E0_inline (NativeConditionalAttribute_t8F72026EC5B1194F1D82D72E0C76C51D7D7FBD2E * __this, bool ___value0, const RuntimeMethod* method);
// System.Void System.ArgumentNullException::.ctor(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void ArgumentNullException__ctor_mEE0C0D6FCB2D08CD7967DBB1329A0854BBED49ED (ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD * __this, String_t* ___paramName0, const RuntimeMethod* method);
// System.Boolean System.String::op_Equality(System.String,System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool String_op_Equality_m139F0E4195AE2F856019E63B241F36F016997FCE (String_t* ___a0, String_t* ___b1, const RuntimeMethod* method);
// System.Void System.ArgumentException::.ctor(System.String,System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void ArgumentException__ctor_m26DC3463C6F3C98BF33EA39598DD2B32F0249CA8 (ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1 * __this, String_t* ___message0, String_t* ___paramName1, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeHeaderAttribute::set_Header(System.String)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeHeaderAttribute_set_Header_m4DBF0E38BD79721921158F6B12B9AF58316C6778_inline (NativeHeaderAttribute_t5C38607694D73834F0B9EB2AB0E575D3FD6D0D8B * __this, String_t* ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeMethodAttribute::set_Name(System.String)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeMethodAttribute_set_Name_mBC4CF088461DE9830E85F6E68B462DE9CC48574C_inline (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, String_t* ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeMethodAttribute::.ctor(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeMethodAttribute__ctor_m1A8CC57006916ACBBBCB515C26224392E8711A22 (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, String_t* ___name0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeMethodAttribute::set_IsThreadSafe(System.Boolean)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeMethodAttribute_set_IsThreadSafe_m11B322FBC460DD97E27F24B6686F5D8C4077F7E6_inline (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, bool ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeNameAttribute::set_Name(System.String)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeNameAttribute_set_Name_m8559126FDC09CB14ADF9AF9D03E6102908738FD3_inline (NativeNameAttribute_t16D90ABD66BD1E0081A2D037FE91ECF220E797F9 * __this, String_t* ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativePropertyAttribute::set_TargetType(UnityEngine.Bindings.TargetType)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativePropertyAttribute_set_TargetType_m8705F4754AA0C953CDA6DDCB95B0276F51FE0146_inline (NativePropertyAttribute_tD231CE0D66BEF2B7C0E5D3FF92B02E4FD0365C61 * __this, int32_t ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeThrowsAttribute::set_ThrowsException(System.Boolean)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeThrowsAttribute_set_ThrowsException_m563468CF2C9D8B2D745373285B67150C734F363F_inline (NativeThrowsAttribute_t0DAF98C14FF11B321CBB7131226E0A2413426EFA * __this, bool ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeTypeAttribute::set_CodegenOptions(UnityEngine.Bindings.CodegenOptions)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeTypeAttribute_set_CodegenOptions_m25EC23287090E27AA2344F376BABD52DE4D4A23D_inline (NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 * __this, int32_t ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeTypeAttribute::set_Header(System.String)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeTypeAttribute_set_Header_m1CC3A47E66E54E5E7A87C5C5911B8EE9D0E8657B_inline (NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 * __this, String_t* ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeTypeAttribute::.ctor(UnityEngine.Bindings.CodegenOptions)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeTypeAttribute__ctor_m51D3D691AF2587E97E54787810199664922210DE (NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 * __this, int32_t ___codegenOptions0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.NativeTypeAttribute::set_IntermediateScriptingStructName(System.String)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeTypeAttribute_set_IntermediateScriptingStructName_m6409CEAAEE1D910DE284325904215DAE9104DDFE_inline (NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 * __this, String_t* ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.StaticAccessorAttribute::set_Name(System.String)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void StaticAccessorAttribute_set_Name_mBFD8EFC09BA63B0CE005B306037E564B530377D0_inline (StaticAccessorAttribute_tE507394A59220DFDF5DBE62DD94B6A00AA01D1F2 * __this, String_t* ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.Bindings.StaticAccessorAttribute::set_Type(UnityEngine.Bindings.StaticAccessorType)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void StaticAccessorAttribute_set_Type_m85233B66B145700BD66145EB0AA31D0960896AE2_inline (StaticAccessorAttribute_tE507394A59220DFDF5DBE62DD94B6A00AA01D1F2 * __this, int32_t ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.NativeClassAttribute::set_QualifiedNativeName(System.String)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeClassAttribute_set_QualifiedNativeName_m4649657DC46E04FAE4BED6D53EBB7C82CEE4FC31_inline (NativeClassAttribute_t1CA9B99EEAAFC1EE97D52505821BD3AD15F8448C * __this, String_t* ___value0, const RuntimeMethod* method);
// System.String System.String::Concat(System.String,System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR String_t* String_Concat_mB78D0094592718DA6D5DB6C712A9C225631666BE (String_t* ___str00, String_t* ___str11, const RuntimeMethod* method);
// System.Void UnityEngine.NativeClassAttribute::set_Declaration(System.String)
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeClassAttribute_set_Declaration_m2C630638B2BB58F82CA43663F183761444524F1A_inline (NativeClassAttribute_t1CA9B99EEAAFC1EE97D52505821BD3AD15F8448C * __this, String_t* ___value0, const RuntimeMethod* method);
// System.Globalization.CultureInfo System.Globalization.CultureInfo::get_InvariantCulture()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * CultureInfo_get_InvariantCulture_mF13B47F8A763CE6A9C8A8BB2EED33FF8F7A63A72 (const RuntimeMethod* method);
// System.String System.String::Format(System.IFormatProvider,System.String,System.Object[])
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR String_t* String_Format_mF68EE0DEC1AA5ADE9DFEF9AE0508E428FBB10EFD (RuntimeObject* ___provider0, String_t* ___format1, ObjectU5BU5D_t3C9242B5C88A48B2A5BD9FDA6CD0024E792AF08A* ___args2, 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
// System.Void UnityEngine.AssetFileNameExtensionAttribute::.ctor(System.String,System.String[])
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AssetFileNameExtensionAttribute__ctor_m49EB0E6BB7D29A0AC5131A6EC007AFBC1DE60390 (AssetFileNameExtensionAttribute_t634736D44FACBB2E58C82ABE354A807BD77DEB03 * __this, String_t* ___preferredExtension0, StringU5BU5D_t933FB07893230EA91C40FF900D5400665E87B14E* ___otherExtensions1, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
String_t* L_0 = ___preferredExtension0;
__this->set_U3CpreferredExtensionU3Ek__BackingField_0(L_0);
StringU5BU5D_t933FB07893230EA91C40FF900D5400665E87B14E* L_1 = ___otherExtensions1;
__this->set_U3CotherExtensionsU3Ek__BackingField_1((RuntimeObject*)L_1);
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
// System.Void UnityEngine.Bindings.FreeFunctionAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void FreeFunctionAttribute__ctor_m69E4EBDD649729C9473BA68585097AF48D06B83D (FreeFunctionAttribute_tE41160023E316B5E3DF87DA36BDDA9639DD835AE * __this, const RuntimeMethod* method)
{
{
NativeMethodAttribute__ctor_mE26CCBB6FA1CF524CDF21471D4D513E7DE1C5B43(__this, /*hidden argument*/NULL);
NativeMethodAttribute_set_IsFreeFunction_m4A2C3A5DE2D0CCAC8FFFB6660BAD55A044EFFDDF_inline(__this, (bool)1, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.Bindings.FreeFunctionAttribute::.ctor(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void FreeFunctionAttribute__ctor_m18D7DE98494E55663EB23287EE6DB00E6649241F (FreeFunctionAttribute_tE41160023E316B5E3DF87DA36BDDA9639DD835AE * __this, String_t* ___name0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___name0;
NativeMethodAttribute__ctor_m34B386D374A17251F14912F04256860E57DF559F(__this, L_0, (bool)1, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.Bindings.FreeFunctionAttribute::.ctor(System.String,System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void FreeFunctionAttribute__ctor_m54898E27CB62607552A0612FA26165A18CB3F444 (FreeFunctionAttribute_tE41160023E316B5E3DF87DA36BDDA9639DD835AE * __this, String_t* ___name0, bool ___isThreadSafe1, const RuntimeMethod* method)
{
{
String_t* L_0 = ___name0;
bool L_1 = ___isThreadSafe1;
NativeMethodAttribute__ctor_m793B5D7530F92DC04173E68EAD8F4A8F9232DD29(__this, L_0, (bool)1, L_1, /*hidden argument*/NULL);
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.Bindings.IgnoreAttribute::set_DoesNotContributeToSize(System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void IgnoreAttribute_set_DoesNotContributeToSize_mF507E8A0ADF588062014330B44B9BD674D7A75AA (IgnoreAttribute_tD849E806CA1C75980B97B047908DE57D156B775F * __this, bool ___value0, const RuntimeMethod* method)
{
{
bool L_0 = ___value0;
__this->set_U3CDoesNotContributeToSizeU3Ek__BackingField_0(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.IgnoreAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void IgnoreAttribute__ctor_m4B78BE44704DA9040A683AC928187E1DAE6BC885 (IgnoreAttribute_tD849E806CA1C75980B97B047908DE57D156B775F * __this, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
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.Bindings.NativeConditionalAttribute::set_Condition(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeConditionalAttribute_set_Condition_m0BD35F77FDBCC278203543FB3CAC35A8227474B5 (NativeConditionalAttribute_t8F72026EC5B1194F1D82D72E0C76C51D7D7FBD2E * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CConditionU3Ek__BackingField_0(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.NativeConditionalAttribute::set_Enabled(System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeConditionalAttribute_set_Enabled_m3584B9F0F4BD7F3F8B8C49595D1900EF01B3C1E0 (NativeConditionalAttribute_t8F72026EC5B1194F1D82D72E0C76C51D7D7FBD2E * __this, bool ___value0, const RuntimeMethod* method)
{
{
bool L_0 = ___value0;
__this->set_U3CEnabledU3Ek__BackingField_1(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.NativeConditionalAttribute::.ctor(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeConditionalAttribute__ctor_mBF34AC3E165A50B3BE9F49520DDE1851DC7CFF13 (NativeConditionalAttribute_t8F72026EC5B1194F1D82D72E0C76C51D7D7FBD2E * __this, String_t* ___condition0, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
String_t* L_0 = ___condition0;
NativeConditionalAttribute_set_Condition_m0BD35F77FDBCC278203543FB3CAC35A8227474B5_inline(__this, L_0, /*hidden argument*/NULL);
NativeConditionalAttribute_set_Enabled_m3584B9F0F4BD7F3F8B8C49595D1900EF01B3C1E0_inline(__this, (bool)1, /*hidden argument*/NULL);
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.Bindings.NativeHeaderAttribute::set_Header(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeHeaderAttribute_set_Header_m4DBF0E38BD79721921158F6B12B9AF58316C6778 (NativeHeaderAttribute_t5C38607694D73834F0B9EB2AB0E575D3FD6D0D8B * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CHeaderU3Ek__BackingField_0(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.NativeHeaderAttribute::.ctor(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeHeaderAttribute__ctor_m490124694FDBCB4336CBA29D2E24A27FF3451A0E (NativeHeaderAttribute_t5C38607694D73834F0B9EB2AB0E575D3FD6D0D8B * __this, String_t* ___header0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NativeHeaderAttribute__ctor_m490124694FDBCB4336CBA29D2E24A27FF3451A0E_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
bool V_0 = false;
bool V_1 = false;
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
String_t* L_0 = ___header0;
V_0 = (bool)((((RuntimeObject*)(String_t*)L_0) == ((RuntimeObject*)(RuntimeObject *)NULL))? 1 : 0);
bool L_1 = V_0;
if (!L_1)
{
goto IL_001b;
}
}
{
ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD * L_2 = (ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD *)il2cpp_codegen_object_new(ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD_il2cpp_TypeInfo_var);
ArgumentNullException__ctor_mEE0C0D6FCB2D08CD7967DBB1329A0854BBED49ED(L_2, _stringLiteral594FD1615A341C77829E83ED988F137E1BA96231, /*hidden argument*/NULL);
IL2CPP_RAISE_MANAGED_EXCEPTION(L_2, NativeHeaderAttribute__ctor_m490124694FDBCB4336CBA29D2E24A27FF3451A0E_RuntimeMethod_var);
}
IL_001b:
{
String_t* L_3 = ___header0;
bool L_4 = String_op_Equality_m139F0E4195AE2F856019E63B241F36F016997FCE(L_3, _stringLiteralDA39A3EE5E6B4B0D3255BFEF95601890AFD80709, /*hidden argument*/NULL);
V_1 = L_4;
bool L_5 = V_1;
if (!L_5)
{
goto IL_003a;
}
}
{
ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1 * L_6 = (ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1 *)il2cpp_codegen_object_new(ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1_il2cpp_TypeInfo_var);
ArgumentException__ctor_m26DC3463C6F3C98BF33EA39598DD2B32F0249CA8(L_6, _stringLiteral00F1751BBAD144F9A705A5D34DE53F8993F5F75F, _stringLiteral594FD1615A341C77829E83ED988F137E1BA96231, /*hidden argument*/NULL);
IL2CPP_RAISE_MANAGED_EXCEPTION(L_6, NativeHeaderAttribute__ctor_m490124694FDBCB4336CBA29D2E24A27FF3451A0E_RuntimeMethod_var);
}
IL_003a:
{
String_t* L_7 = ___header0;
NativeHeaderAttribute_set_Header_m4DBF0E38BD79721921158F6B12B9AF58316C6778_inline(__this, L_7, /*hidden argument*/NULL);
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.Bindings.NativeMethodAttribute::set_Name(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeMethodAttribute_set_Name_mBC4CF088461DE9830E85F6E68B462DE9CC48574C (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CNameU3Ek__BackingField_0(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.NativeMethodAttribute::set_IsThreadSafe(System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeMethodAttribute_set_IsThreadSafe_m11B322FBC460DD97E27F24B6686F5D8C4077F7E6 (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, bool ___value0, const RuntimeMethod* method)
{
{
bool L_0 = ___value0;
__this->set_U3CIsThreadSafeU3Ek__BackingField_1(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.NativeMethodAttribute::set_IsFreeFunction(System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeMethodAttribute_set_IsFreeFunction_m4A2C3A5DE2D0CCAC8FFFB6660BAD55A044EFFDDF (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, bool ___value0, const RuntimeMethod* method)
{
{
bool L_0 = ___value0;
__this->set_U3CIsFreeFunctionU3Ek__BackingField_2(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.NativeMethodAttribute::set_ThrowsException(System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeMethodAttribute_set_ThrowsException_m923834F65F9D355EE8E6F8FC760DB6F9C94F22F1 (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, bool ___value0, const RuntimeMethod* method)
{
{
bool L_0 = ___value0;
__this->set_U3CThrowsExceptionU3Ek__BackingField_3(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.NativeMethodAttribute::set_HasExplicitThis(System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeMethodAttribute_set_HasExplicitThis_mA955027BB50011811A96125CB83F88BB9BD61F1D (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, bool ___value0, const RuntimeMethod* method)
{
{
bool L_0 = ___value0;
__this->set_U3CHasExplicitThisU3Ek__BackingField_4(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.NativeMethodAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeMethodAttribute__ctor_mE26CCBB6FA1CF524CDF21471D4D513E7DE1C5B43 (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.Bindings.NativeMethodAttribute::.ctor(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeMethodAttribute__ctor_m1A8CC57006916ACBBBCB515C26224392E8711A22 (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, String_t* ___name0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NativeMethodAttribute__ctor_m1A8CC57006916ACBBBCB515C26224392E8711A22_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
bool V_0 = false;
bool V_1 = false;
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
String_t* L_0 = ___name0;
V_0 = (bool)((((RuntimeObject*)(String_t*)L_0) == ((RuntimeObject*)(RuntimeObject *)NULL))? 1 : 0);
bool L_1 = V_0;
if (!L_1)
{
goto IL_001b;
}
}
{
ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD * L_2 = (ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD *)il2cpp_codegen_object_new(ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD_il2cpp_TypeInfo_var);
ArgumentNullException__ctor_mEE0C0D6FCB2D08CD7967DBB1329A0854BBED49ED(L_2, _stringLiteral6AE999552A0D2DCA14D62E2BC8B764D377B1DD6C, /*hidden argument*/NULL);
IL2CPP_RAISE_MANAGED_EXCEPTION(L_2, NativeMethodAttribute__ctor_m1A8CC57006916ACBBBCB515C26224392E8711A22_RuntimeMethod_var);
}
IL_001b:
{
String_t* L_3 = ___name0;
bool L_4 = String_op_Equality_m139F0E4195AE2F856019E63B241F36F016997FCE(L_3, _stringLiteralDA39A3EE5E6B4B0D3255BFEF95601890AFD80709, /*hidden argument*/NULL);
V_1 = L_4;
bool L_5 = V_1;
if (!L_5)
{
goto IL_003a;
}
}
{
ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1 * L_6 = (ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1 *)il2cpp_codegen_object_new(ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1_il2cpp_TypeInfo_var);
ArgumentException__ctor_m26DC3463C6F3C98BF33EA39598DD2B32F0249CA8(L_6, _stringLiteralE603ACC092BAF5342CBBBABD96FF616A275F364E, _stringLiteral6AE999552A0D2DCA14D62E2BC8B764D377B1DD6C, /*hidden argument*/NULL);
IL2CPP_RAISE_MANAGED_EXCEPTION(L_6, NativeMethodAttribute__ctor_m1A8CC57006916ACBBBCB515C26224392E8711A22_RuntimeMethod_var);
}
IL_003a:
{
String_t* L_7 = ___name0;
NativeMethodAttribute_set_Name_mBC4CF088461DE9830E85F6E68B462DE9CC48574C_inline(__this, L_7, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.Bindings.NativeMethodAttribute::.ctor(System.String,System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeMethodAttribute__ctor_m34B386D374A17251F14912F04256860E57DF559F (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, String_t* ___name0, bool ___isFreeFunction1, const RuntimeMethod* method)
{
{
String_t* L_0 = ___name0;
NativeMethodAttribute__ctor_m1A8CC57006916ACBBBCB515C26224392E8711A22(__this, L_0, /*hidden argument*/NULL);
bool L_1 = ___isFreeFunction1;
NativeMethodAttribute_set_IsFreeFunction_m4A2C3A5DE2D0CCAC8FFFB6660BAD55A044EFFDDF_inline(__this, L_1, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.Bindings.NativeMethodAttribute::.ctor(System.String,System.Boolean,System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeMethodAttribute__ctor_m793B5D7530F92DC04173E68EAD8F4A8F9232DD29 (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, String_t* ___name0, bool ___isFreeFunction1, bool ___isThreadSafe2, const RuntimeMethod* method)
{
{
String_t* L_0 = ___name0;
bool L_1 = ___isFreeFunction1;
NativeMethodAttribute__ctor_m34B386D374A17251F14912F04256860E57DF559F(__this, L_0, L_1, /*hidden argument*/NULL);
bool L_2 = ___isThreadSafe2;
NativeMethodAttribute_set_IsThreadSafe_m11B322FBC460DD97E27F24B6686F5D8C4077F7E6_inline(__this, L_2, /*hidden argument*/NULL);
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.Bindings.NativeNameAttribute::set_Name(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeNameAttribute_set_Name_m8559126FDC09CB14ADF9AF9D03E6102908738FD3 (NativeNameAttribute_t16D90ABD66BD1E0081A2D037FE91ECF220E797F9 * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CNameU3Ek__BackingField_0(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.NativeNameAttribute::.ctor(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeNameAttribute__ctor_m85D49395E6305D8C6CFA8C39A83653F36A8FC9BA (NativeNameAttribute_t16D90ABD66BD1E0081A2D037FE91ECF220E797F9 * __this, String_t* ___name0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NativeNameAttribute__ctor_m85D49395E6305D8C6CFA8C39A83653F36A8FC9BA_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
bool V_0 = false;
bool V_1 = false;
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
String_t* L_0 = ___name0;
V_0 = (bool)((((RuntimeObject*)(String_t*)L_0) == ((RuntimeObject*)(RuntimeObject *)NULL))? 1 : 0);
bool L_1 = V_0;
if (!L_1)
{
goto IL_001b;
}
}
{
ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD * L_2 = (ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD *)il2cpp_codegen_object_new(ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD_il2cpp_TypeInfo_var);
ArgumentNullException__ctor_mEE0C0D6FCB2D08CD7967DBB1329A0854BBED49ED(L_2, _stringLiteral6AE999552A0D2DCA14D62E2BC8B764D377B1DD6C, /*hidden argument*/NULL);
IL2CPP_RAISE_MANAGED_EXCEPTION(L_2, NativeNameAttribute__ctor_m85D49395E6305D8C6CFA8C39A83653F36A8FC9BA_RuntimeMethod_var);
}
IL_001b:
{
String_t* L_3 = ___name0;
bool L_4 = String_op_Equality_m139F0E4195AE2F856019E63B241F36F016997FCE(L_3, _stringLiteralDA39A3EE5E6B4B0D3255BFEF95601890AFD80709, /*hidden argument*/NULL);
V_1 = L_4;
bool L_5 = V_1;
if (!L_5)
{
goto IL_003a;
}
}
{
ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1 * L_6 = (ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1 *)il2cpp_codegen_object_new(ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1_il2cpp_TypeInfo_var);
ArgumentException__ctor_m26DC3463C6F3C98BF33EA39598DD2B32F0249CA8(L_6, _stringLiteralE603ACC092BAF5342CBBBABD96FF616A275F364E, _stringLiteral6AE999552A0D2DCA14D62E2BC8B764D377B1DD6C, /*hidden argument*/NULL);
IL2CPP_RAISE_MANAGED_EXCEPTION(L_6, NativeNameAttribute__ctor_m85D49395E6305D8C6CFA8C39A83653F36A8FC9BA_RuntimeMethod_var);
}
IL_003a:
{
String_t* L_7 = ___name0;
NativeNameAttribute_set_Name_m8559126FDC09CB14ADF9AF9D03E6102908738FD3_inline(__this, L_7, /*hidden argument*/NULL);
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.Bindings.NativePropertyAttribute::set_TargetType(UnityEngine.Bindings.TargetType)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativePropertyAttribute_set_TargetType_m8705F4754AA0C953CDA6DDCB95B0276F51FE0146 (NativePropertyAttribute_tD231CE0D66BEF2B7C0E5D3FF92B02E4FD0365C61 * __this, int32_t ___value0, const RuntimeMethod* method)
{
{
int32_t L_0 = ___value0;
__this->set_U3CTargetTypeU3Ek__BackingField_5(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.NativePropertyAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativePropertyAttribute__ctor_mC9AA5DB9519961A6AA76C71968B7E4F9649235FF (NativePropertyAttribute_tD231CE0D66BEF2B7C0E5D3FF92B02E4FD0365C61 * __this, const RuntimeMethod* method)
{
{
NativeMethodAttribute__ctor_mE26CCBB6FA1CF524CDF21471D4D513E7DE1C5B43(__this, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.Bindings.NativePropertyAttribute::.ctor(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativePropertyAttribute__ctor_m92618E6DC14A2AD87A9CB3A2BB3DFCDA1A431164 (NativePropertyAttribute_tD231CE0D66BEF2B7C0E5D3FF92B02E4FD0365C61 * __this, String_t* ___name0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___name0;
NativeMethodAttribute__ctor_m1A8CC57006916ACBBBCB515C26224392E8711A22(__this, L_0, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.Bindings.NativePropertyAttribute::.ctor(System.String,System.Boolean,UnityEngine.Bindings.TargetType)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativePropertyAttribute__ctor_m2584E9D08E56EFB31AE671E6488046168A3911D3 (NativePropertyAttribute_tD231CE0D66BEF2B7C0E5D3FF92B02E4FD0365C61 * __this, String_t* ___name0, bool ___isFree1, int32_t ___targetType2, const RuntimeMethod* method)
{
{
String_t* L_0 = ___name0;
bool L_1 = ___isFree1;
NativeMethodAttribute__ctor_m34B386D374A17251F14912F04256860E57DF559F(__this, L_0, L_1, /*hidden argument*/NULL);
int32_t L_2 = ___targetType2;
NativePropertyAttribute_set_TargetType_m8705F4754AA0C953CDA6DDCB95B0276F51FE0146_inline(__this, L_2, /*hidden argument*/NULL);
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.Bindings.NativeThrowsAttribute::set_ThrowsException(System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeThrowsAttribute_set_ThrowsException_m563468CF2C9D8B2D745373285B67150C734F363F (NativeThrowsAttribute_t0DAF98C14FF11B321CBB7131226E0A2413426EFA * __this, bool ___value0, const RuntimeMethod* method)
{
{
bool L_0 = ___value0;
__this->set_U3CThrowsExceptionU3Ek__BackingField_0(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.NativeThrowsAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeThrowsAttribute__ctor_m4EBDA91A1EBCABBD08DF5A91E216578B8CD76EDB (NativeThrowsAttribute_t0DAF98C14FF11B321CBB7131226E0A2413426EFA * __this, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
NativeThrowsAttribute_set_ThrowsException_m563468CF2C9D8B2D745373285B67150C734F363F_inline(__this, (bool)1, /*hidden argument*/NULL);
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.Bindings.NativeTypeAttribute::set_Header(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeTypeAttribute_set_Header_m1CC3A47E66E54E5E7A87C5C5911B8EE9D0E8657B (NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CHeaderU3Ek__BackingField_0(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.NativeTypeAttribute::set_IntermediateScriptingStructName(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeTypeAttribute_set_IntermediateScriptingStructName_m6409CEAAEE1D910DE284325904215DAE9104DDFE (NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CIntermediateScriptingStructNameU3Ek__BackingField_1(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.NativeTypeAttribute::set_CodegenOptions(UnityEngine.Bindings.CodegenOptions)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeTypeAttribute_set_CodegenOptions_m25EC23287090E27AA2344F376BABD52DE4D4A23D (NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 * __this, int32_t ___value0, const RuntimeMethod* method)
{
{
int32_t L_0 = ___value0;
__this->set_U3CCodegenOptionsU3Ek__BackingField_2(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.NativeTypeAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeTypeAttribute__ctor_mC6578F8A8AD3F4778CCC17248E32746D9BCD7C1F (NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 * __this, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
NativeTypeAttribute_set_CodegenOptions_m25EC23287090E27AA2344F376BABD52DE4D4A23D_inline(__this, 0, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.Bindings.NativeTypeAttribute::.ctor(UnityEngine.Bindings.CodegenOptions)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeTypeAttribute__ctor_m51D3D691AF2587E97E54787810199664922210DE (NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 * __this, int32_t ___codegenOptions0, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
int32_t L_0 = ___codegenOptions0;
NativeTypeAttribute_set_CodegenOptions_m25EC23287090E27AA2344F376BABD52DE4D4A23D_inline(__this, L_0, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.Bindings.NativeTypeAttribute::.ctor(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeTypeAttribute__ctor_m7ACA25C054E933120D16DC7BBDE17734194454B6 (NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 * __this, String_t* ___header0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NativeTypeAttribute__ctor_m7ACA25C054E933120D16DC7BBDE17734194454B6_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
bool V_0 = false;
bool V_1 = false;
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
String_t* L_0 = ___header0;
V_0 = (bool)((((RuntimeObject*)(String_t*)L_0) == ((RuntimeObject*)(RuntimeObject *)NULL))? 1 : 0);
bool L_1 = V_0;
if (!L_1)
{
goto IL_001b;
}
}
{
ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD * L_2 = (ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD *)il2cpp_codegen_object_new(ArgumentNullException_t581DF992B1F3E0EC6EFB30CC5DC43519A79B27AD_il2cpp_TypeInfo_var);
ArgumentNullException__ctor_mEE0C0D6FCB2D08CD7967DBB1329A0854BBED49ED(L_2, _stringLiteral594FD1615A341C77829E83ED988F137E1BA96231, /*hidden argument*/NULL);
IL2CPP_RAISE_MANAGED_EXCEPTION(L_2, NativeTypeAttribute__ctor_m7ACA25C054E933120D16DC7BBDE17734194454B6_RuntimeMethod_var);
}
IL_001b:
{
String_t* L_3 = ___header0;
bool L_4 = String_op_Equality_m139F0E4195AE2F856019E63B241F36F016997FCE(L_3, _stringLiteralDA39A3EE5E6B4B0D3255BFEF95601890AFD80709, /*hidden argument*/NULL);
V_1 = L_4;
bool L_5 = V_1;
if (!L_5)
{
goto IL_003a;
}
}
{
ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1 * L_6 = (ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1 *)il2cpp_codegen_object_new(ArgumentException_tEDCD16F20A09ECE461C3DA766C16EDA8864057D1_il2cpp_TypeInfo_var);
ArgumentException__ctor_m26DC3463C6F3C98BF33EA39598DD2B32F0249CA8(L_6, _stringLiteral00F1751BBAD144F9A705A5D34DE53F8993F5F75F, _stringLiteral594FD1615A341C77829E83ED988F137E1BA96231, /*hidden argument*/NULL);
IL2CPP_RAISE_MANAGED_EXCEPTION(L_6, NativeTypeAttribute__ctor_m7ACA25C054E933120D16DC7BBDE17734194454B6_RuntimeMethod_var);
}
IL_003a:
{
NativeTypeAttribute_set_CodegenOptions_m25EC23287090E27AA2344F376BABD52DE4D4A23D_inline(__this, 0, /*hidden argument*/NULL);
String_t* L_7 = ___header0;
NativeTypeAttribute_set_Header_m1CC3A47E66E54E5E7A87C5C5911B8EE9D0E8657B_inline(__this, L_7, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.Bindings.NativeTypeAttribute::.ctor(UnityEngine.Bindings.CodegenOptions,System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeTypeAttribute__ctor_mF0E347C64A5AAF78A6FDB8EF2FDC39C0753B0211 (NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 * __this, int32_t ___codegenOptions0, String_t* ___intermediateStructName1, const RuntimeMethod* method)
{
{
int32_t L_0 = ___codegenOptions0;
NativeTypeAttribute__ctor_m51D3D691AF2587E97E54787810199664922210DE(__this, L_0, /*hidden argument*/NULL);
String_t* L_1 = ___intermediateStructName1;
NativeTypeAttribute_set_IntermediateScriptingStructName_m6409CEAAEE1D910DE284325904215DAE9104DDFE_inline(__this, L_1, /*hidden argument*/NULL);
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.Bindings.NotNullAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NotNullAttribute__ctor_m8F88B3030D52285AA10334E4E117151630BEC045 (NotNullAttribute_t04A526B0B7DD6B37D2FFC6E5079575E0C461E2A0 * __this, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
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.Bindings.StaticAccessorAttribute::set_Name(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void StaticAccessorAttribute_set_Name_mBFD8EFC09BA63B0CE005B306037E564B530377D0 (StaticAccessorAttribute_tE507394A59220DFDF5DBE62DD94B6A00AA01D1F2 * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CNameU3Ek__BackingField_0(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.StaticAccessorAttribute::set_Type(UnityEngine.Bindings.StaticAccessorType)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void StaticAccessorAttribute_set_Type_m85233B66B145700BD66145EB0AA31D0960896AE2 (StaticAccessorAttribute_tE507394A59220DFDF5DBE62DD94B6A00AA01D1F2 * __this, int32_t ___value0, const RuntimeMethod* method)
{
{
int32_t L_0 = ___value0;
__this->set_U3CTypeU3Ek__BackingField_1(L_0);
return;
}
}
// System.Void UnityEngine.Bindings.StaticAccessorAttribute::.ctor(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void StaticAccessorAttribute__ctor_m6698A0204830E258A0D9881AFA7368196C179782 (StaticAccessorAttribute_tE507394A59220DFDF5DBE62DD94B6A00AA01D1F2 * __this, String_t* ___name0, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
String_t* L_0 = ___name0;
StaticAccessorAttribute_set_Name_mBFD8EFC09BA63B0CE005B306037E564B530377D0_inline(__this, L_0, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.Bindings.StaticAccessorAttribute::.ctor(System.String,UnityEngine.Bindings.StaticAccessorType)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void StaticAccessorAttribute__ctor_m8F492CF3D710FAE0D63BB8C2640D271264C84448 (StaticAccessorAttribute_tE507394A59220DFDF5DBE62DD94B6A00AA01D1F2 * __this, String_t* ___name0, int32_t ___type1, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
String_t* L_0 = ___name0;
StaticAccessorAttribute_set_Name_mBFD8EFC09BA63B0CE005B306037E564B530377D0_inline(__this, L_0, /*hidden argument*/NULL);
int32_t L_1 = ___type1;
StaticAccessorAttribute_set_Type_m85233B66B145700BD66145EB0AA31D0960896AE2_inline(__this, L_1, /*hidden argument*/NULL);
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
#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.Bindings.ThreadSafeAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void ThreadSafeAttribute__ctor_mC3058002BD52E2EB8475B8115A1AC5FFCA53E1DD (ThreadSafeAttribute_t3FB9EE5993C748628BC06D9D46ACA3A58FDAE317 * __this, const RuntimeMethod* method)
{
{
NativeMethodAttribute__ctor_mE26CCBB6FA1CF524CDF21471D4D513E7DE1C5B43(__this, /*hidden argument*/NULL);
NativeMethodAttribute_set_IsThreadSafe_m11B322FBC460DD97E27F24B6686F5D8C4077F7E6_inline(__this, (bool)1, /*hidden argument*/NULL);
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.Bindings.VisibleToOtherModulesAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void VisibleToOtherModulesAttribute__ctor_m82D98B6D202548277D803878EB2BE3A82722CC74 (VisibleToOtherModulesAttribute_t8601A3A00D7B9528C62DD278E53B317B566FDA90 * __this, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.Bindings.VisibleToOtherModulesAttribute::.ctor(System.String[])
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void VisibleToOtherModulesAttribute__ctor_mEC52A33ADE6FEA527A467F9F64BF966F2A63A942 (VisibleToOtherModulesAttribute_t8601A3A00D7B9528C62DD278E53B317B566FDA90 * __this, StringU5BU5D_t933FB07893230EA91C40FF900D5400665E87B14E* ___modules0, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
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.NativeClassAttribute::set_QualifiedNativeName(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeClassAttribute_set_QualifiedNativeName_m4649657DC46E04FAE4BED6D53EBB7C82CEE4FC31 (NativeClassAttribute_t1CA9B99EEAAFC1EE97D52505821BD3AD15F8448C * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CQualifiedNativeNameU3Ek__BackingField_0(L_0);
return;
}
}
// System.Void UnityEngine.NativeClassAttribute::set_Declaration(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeClassAttribute_set_Declaration_m2C630638B2BB58F82CA43663F183761444524F1A (NativeClassAttribute_t1CA9B99EEAAFC1EE97D52505821BD3AD15F8448C * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CDeclarationU3Ek__BackingField_1(L_0);
return;
}
}
// System.Void UnityEngine.NativeClassAttribute::.ctor(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeClassAttribute__ctor_m814DCB23A54C2AE01ACDB1930DDF06277CAD9DE8 (NativeClassAttribute_t1CA9B99EEAAFC1EE97D52505821BD3AD15F8448C * __this, String_t* ___qualifiedCppName0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NativeClassAttribute__ctor_m814DCB23A54C2AE01ACDB1930DDF06277CAD9DE8_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
String_t* L_0 = ___qualifiedCppName0;
NativeClassAttribute_set_QualifiedNativeName_m4649657DC46E04FAE4BED6D53EBB7C82CEE4FC31_inline(__this, L_0, /*hidden argument*/NULL);
String_t* L_1 = ___qualifiedCppName0;
String_t* L_2 = String_Concat_mB78D0094592718DA6D5DB6C712A9C225631666BE(_stringLiteralEAB8FC250F05F082661640C1F97CCD12D297B765, L_1, /*hidden argument*/NULL);
NativeClassAttribute_set_Declaration_m2C630638B2BB58F82CA43663F183761444524F1A_inline(__this, L_2, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.NativeClassAttribute::.ctor(System.String,System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void NativeClassAttribute__ctor_mFAF14B283CE2D27EA4A98E118CB5ED55A2232F92 (NativeClassAttribute_t1CA9B99EEAAFC1EE97D52505821BD3AD15F8448C * __this, String_t* ___qualifiedCppName0, String_t* ___declaration1, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
String_t* L_0 = ___qualifiedCppName0;
NativeClassAttribute_set_QualifiedNativeName_m4649657DC46E04FAE4BED6D53EBB7C82CEE4FC31_inline(__this, L_0, /*hidden argument*/NULL);
String_t* L_1 = ___declaration1;
NativeClassAttribute_set_Declaration_m2C630638B2BB58F82CA43663F183761444524F1A_inline(__this, L_1, /*hidden argument*/NULL);
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.Scripting.GeneratedByOldBindingsGeneratorAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void GeneratedByOldBindingsGeneratorAttribute__ctor_m16915B4C437B4BE69681DD9A0A368FCD6155EB81 (GeneratedByOldBindingsGeneratorAttribute_tF3386E1746F60B4E1D77C2167915FBB4B89BBA86 * __this, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
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.Scripting.RequiredByNativeCodeAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void RequiredByNativeCodeAttribute__ctor_mD8B976753773E00BB7E1E63DF6C23A1EB3054422 (RequiredByNativeCodeAttribute_t949320E827C2BD269B3E686FE317A18835670AAE * __this, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.Scripting.RequiredByNativeCodeAttribute::set_Optional(System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void RequiredByNativeCodeAttribute_set_Optional_m995DE99A803BC2D6FE66CCB370AEBE5ACF706955 (RequiredByNativeCodeAttribute_t949320E827C2BD269B3E686FE317A18835670AAE * __this, bool ___value0, const RuntimeMethod* method)
{
{
bool L_0 = ___value0;
__this->set_U3COptionalU3Ek__BackingField_0(L_0);
return;
}
}
// System.Void UnityEngine.Scripting.RequiredByNativeCodeAttribute::set_GenerateProxy(System.Boolean)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void RequiredByNativeCodeAttribute_set_GenerateProxy_m8B647BCD03460AD81F920CEF4CC51B499B5AFE55 (RequiredByNativeCodeAttribute_t949320E827C2BD269B3E686FE317A18835670AAE * __this, bool ___value0, const RuntimeMethod* method)
{
{
bool L_0 = ___value0;
__this->set_U3CGenerateProxyU3Ek__BackingField_1(L_0);
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.Scripting.UsedByNativeCodeAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void UsedByNativeCodeAttribute__ctor_m599B42E9BBC333CDA57CD8154C902AB7594B80AD (UsedByNativeCodeAttribute_t923F9A140847AF2F193AD1AB33143B8774797912 * __this, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.Scripting.UsedByNativeCodeAttribute::set_Name(System.String)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void UsedByNativeCodeAttribute_set_Name_m5AF6F7B56F5D616F4CA7C5C2AE1E92B5A621A062 (UsedByNativeCodeAttribute_t923F9A140847AF2F193AD1AB33143B8774797912 * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CNameU3Ek__BackingField_0(L_0);
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.ThreadAndSerializationSafeAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void ThreadAndSerializationSafeAttribute__ctor_mCB8D8FEED836D6472A4FB90C69969F0D99C39619 (ThreadAndSerializationSafeAttribute_tC7AAA73802AAF871C176CF59656C030E5BFA87AA * __this, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
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.UnityEngineModuleAssembly::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void UnityEngineModuleAssembly__ctor_m791D74EDFEF6B1368540E376C7DCA131C2528993 (UnityEngineModuleAssembly_t5CEBDCE354FDB9B42BFF9344E7EBA474E4C070DB * __this, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
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.String UnityEngine.UnityString::Format(System.String,System.Object[])
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR String_t* UnityString_Format_m415056ECF8DA7B3EC6A8456E299D0C2002177387 (String_t* ___fmt0, ObjectU5BU5D_t3C9242B5C88A48B2A5BD9FDA6CD0024E792AF08A* ___args1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (UnityString_Format_m415056ECF8DA7B3EC6A8456E299D0C2002177387_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
String_t* V_0 = NULL;
{
IL2CPP_RUNTIME_CLASS_INIT(CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F_il2cpp_TypeInfo_var);
CultureInfo_t345AC6924134F039ED9A11F3E03F8E91B6A3225F * L_0 = CultureInfo_get_InvariantCulture_mF13B47F8A763CE6A9C8A8BB2EED33FF8F7A63A72(/*hidden argument*/NULL);
NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8 * L_1 = VirtFuncInvoker0< NumberFormatInfo_tFDF57037EBC5BC833D0A53EF0327B805994860A8 * >::Invoke(14 /* System.Globalization.NumberFormatInfo System.Globalization.CultureInfo::get_NumberFormat() */, L_0);
String_t* L_2 = ___fmt0;
ObjectU5BU5D_t3C9242B5C88A48B2A5BD9FDA6CD0024E792AF08A* L_3 = ___args1;
String_t* L_4 = String_Format_mF68EE0DEC1AA5ADE9DFEF9AE0508E428FBB10EFD(L_1, L_2, L_3, /*hidden argument*/NULL);
V_0 = L_4;
goto IL_0015;
}
IL_0015:
{
String_t* L_5 = V_0;
return L_5;
}
}
#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.WritableAttribute::.ctor()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void WritableAttribute__ctor_m58A5D24131EC67D50A7BF2804568DCB607BD97D6 (WritableAttribute_tAEE55CD07B2C5AD9CDBAD9FAF35FBB94AD8DE9BD * __this, const RuntimeMethod* method)
{
{
Attribute__ctor_m45CAD4B01265CC84CC5A84F62EE2DBE85DE89EC0(__this, /*hidden argument*/NULL);
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeMethodAttribute_set_IsFreeFunction_m4A2C3A5DE2D0CCAC8FFFB6660BAD55A044EFFDDF_inline (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, bool ___value0, const RuntimeMethod* method)
{
{
bool L_0 = ___value0;
__this->set_U3CIsFreeFunctionU3Ek__BackingField_2(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeConditionalAttribute_set_Condition_m0BD35F77FDBCC278203543FB3CAC35A8227474B5_inline (NativeConditionalAttribute_t8F72026EC5B1194F1D82D72E0C76C51D7D7FBD2E * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CConditionU3Ek__BackingField_0(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeConditionalAttribute_set_Enabled_m3584B9F0F4BD7F3F8B8C49595D1900EF01B3C1E0_inline (NativeConditionalAttribute_t8F72026EC5B1194F1D82D72E0C76C51D7D7FBD2E * __this, bool ___value0, const RuntimeMethod* method)
{
{
bool L_0 = ___value0;
__this->set_U3CEnabledU3Ek__BackingField_1(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeHeaderAttribute_set_Header_m4DBF0E38BD79721921158F6B12B9AF58316C6778_inline (NativeHeaderAttribute_t5C38607694D73834F0B9EB2AB0E575D3FD6D0D8B * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CHeaderU3Ek__BackingField_0(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeMethodAttribute_set_Name_mBC4CF088461DE9830E85F6E68B462DE9CC48574C_inline (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CNameU3Ek__BackingField_0(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeMethodAttribute_set_IsThreadSafe_m11B322FBC460DD97E27F24B6686F5D8C4077F7E6_inline (NativeMethodAttribute_tB1AB33D5877AD8417C7E646A48AF1941283DC309 * __this, bool ___value0, const RuntimeMethod* method)
{
{
bool L_0 = ___value0;
__this->set_U3CIsThreadSafeU3Ek__BackingField_1(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeNameAttribute_set_Name_m8559126FDC09CB14ADF9AF9D03E6102908738FD3_inline (NativeNameAttribute_t16D90ABD66BD1E0081A2D037FE91ECF220E797F9 * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CNameU3Ek__BackingField_0(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativePropertyAttribute_set_TargetType_m8705F4754AA0C953CDA6DDCB95B0276F51FE0146_inline (NativePropertyAttribute_tD231CE0D66BEF2B7C0E5D3FF92B02E4FD0365C61 * __this, int32_t ___value0, const RuntimeMethod* method)
{
{
int32_t L_0 = ___value0;
__this->set_U3CTargetTypeU3Ek__BackingField_5(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeThrowsAttribute_set_ThrowsException_m563468CF2C9D8B2D745373285B67150C734F363F_inline (NativeThrowsAttribute_t0DAF98C14FF11B321CBB7131226E0A2413426EFA * __this, bool ___value0, const RuntimeMethod* method)
{
{
bool L_0 = ___value0;
__this->set_U3CThrowsExceptionU3Ek__BackingField_0(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeTypeAttribute_set_CodegenOptions_m25EC23287090E27AA2344F376BABD52DE4D4A23D_inline (NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 * __this, int32_t ___value0, const RuntimeMethod* method)
{
{
int32_t L_0 = ___value0;
__this->set_U3CCodegenOptionsU3Ek__BackingField_2(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeTypeAttribute_set_Header_m1CC3A47E66E54E5E7A87C5C5911B8EE9D0E8657B_inline (NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CHeaderU3Ek__BackingField_0(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeTypeAttribute_set_IntermediateScriptingStructName_m6409CEAAEE1D910DE284325904215DAE9104DDFE_inline (NativeTypeAttribute_t13DB73C52788E49FFE842918C50B9D79C352B831 * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CIntermediateScriptingStructNameU3Ek__BackingField_1(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void StaticAccessorAttribute_set_Name_mBFD8EFC09BA63B0CE005B306037E564B530377D0_inline (StaticAccessorAttribute_tE507394A59220DFDF5DBE62DD94B6A00AA01D1F2 * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CNameU3Ek__BackingField_0(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void StaticAccessorAttribute_set_Type_m85233B66B145700BD66145EB0AA31D0960896AE2_inline (StaticAccessorAttribute_tE507394A59220DFDF5DBE62DD94B6A00AA01D1F2 * __this, int32_t ___value0, const RuntimeMethod* method)
{
{
int32_t L_0 = ___value0;
__this->set_U3CTypeU3Ek__BackingField_1(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeClassAttribute_set_QualifiedNativeName_m4649657DC46E04FAE4BED6D53EBB7C82CEE4FC31_inline (NativeClassAttribute_t1CA9B99EEAAFC1EE97D52505821BD3AD15F8448C * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CQualifiedNativeNameU3Ek__BackingField_0(L_0);
return;
}
}
IL2CPP_EXTERN_C inline IL2CPP_METHOD_ATTR void NativeClassAttribute_set_Declaration_m2C630638B2BB58F82CA43663F183761444524F1A_inline (NativeClassAttribute_t1CA9B99EEAAFC1EE97D52505821BD3AD15F8448C * __this, String_t* ___value0, const RuntimeMethod* method)
{
{
String_t* L_0 = ___value0;
__this->set_U3CDeclarationU3Ek__BackingField_1(L_0);
return;
}
}
| [
"[email protected]"
] | |
548791c252e1d48087f41150bee000eeea9f94a5 | 49abb58c40577ce4470cca16034cf03ff0f94f7c | /C++/cisco/CPA/lab/cpa_lab_3_4_7__2/lab_3_4_7__2.cpp | 757d4718b35ed56f122232e38c6848ecb2803faa | [
"MIT"
] | permissive | stablestud/trainee | 196c3e64920adc8278bd2f06430b6e357091c2a7 | 72e18117e98ab4854e9271c2534e91cf39c42042 | refs/heads/master | 2022-08-11T11:52:26.099642 | 2022-07-30T22:45:56 | 2022-07-30T22:45:56 | 130,486,168 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,147 | cpp | /*
*** Lab 3.4.2 One step further: finding the lengths of months ***
** Objectives **
*
* Familiarize the student with:
* - building a set of cooperating functions,
* - singnalling erroneous arguments using a specific return value.
*
** Scenario **
*
* Let's continue our coder's reflections on time. Now, when you have a reliable function diagnosing the nature of any year, you can use it
* to implement another important function returning the length of any month (measured in days, of course).
*
* Write a function equipped with the following features:
* - its name is "monthLength"
* - it accepts two arguments of type int: year number (first) and month number (second)
* - it returns an int value which represents a length of specified month in a specified year (obviously, year is important only when
* month == 2) or 0 if any of the input arguments isn't valid
* - it should be mute
*
* We've prepared a skeleton of the program - fill the function body with an appropriate content!
*
* We've also attached the output that is expected from your program.
*
* Hint: there are at least two ways of implementing the function: you can use switch or (something which seems a bit smarter) declare a
* vector storing months' lengths – choose the more convenient style.
*
*/
#include <iostream>
using namespace std;
bool isLeap ( int year )
{
return ! ( year % 4 );
}
int monthLength ( int year, int month )
{
int days;
switch ( month ) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
days = 31;
break;
case 2:
days = ( isLeap ( year ) == 0 ) ? 28 : 29;
break;
case 4:
case 6:
case 9:
case 11:
days = 30;
break;
}
return days;
}
int main ( void )
{
for ( int yr = 2000; yr < 2002; yr++ ) {
for ( int mo = 1; mo <= 12; mo++ )
cout << monthLength ( yr,mo ) << " ";
cout << endl;
}
return 0;
}
| [
"[email protected]"
] | |
28b763ebc1aae1b4d10982bf4399424df51a0d65 | c882b791d6e88414f7d11f000c74105305db6707 | /source/KiIR_DAIKIN.cpp | 0912caac60dde95347f2dde71c3e40aea34f4608 | [] | no_license | kisoft/KiIRForSaleaeLogic | cf29d1c116ee2c1b2e726059907a31024598525f | 7caf8b20b4aa012bedc4aaa24c6750e61ea2b93c | refs/heads/master | 2021-01-25T12:20:19.199970 | 2018-03-01T17:15:33 | 2018-03-01T17:15:33 | 123,465,380 | 2 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 1,426 | cpp | #include "KiIR_DAIKIN.h"
const Protocol DAIKIN_ProtocolInfo =
{
peDAIKIN, "DAIKIN", // Идентификатор и название протокола
ptPulseDistance, // Тип протокола
{ { 0, 64, 64, 34674 }, { 1, 64, 64, 34674 }, { 2, 152, 152, 70000 } }, bdLSB, // Описание фреймов, LSB или MSB
{ 0, bcMARK, { 480, 388 } }, // Описание бита "0"
{ 1, bcMARK, { 480, 1251 } }, // Описание бита "1"
true, { 1, bcMARK, { 3497, 1711 } }, // Наличие битов для Lead, Описание Lead
false, { 1, bcMARK, { 3497, 1711 } }, // Наличие битов для Repeat Lead, Описание Repeat Lead
false, { rtNormal, ritGap, 34674 }, // Повтор (всё о повторе). Здесь две паузы, 25100 и 34500 (два раза)
true, { 0, bcMARK, { 480, 388 } }, // Финальный бит
true, { 5, { 1, bcMARK, { 480, 388 } }, true, { 1, bcMARK, { 480, 388 } }, 25141 } // Синхро последовательность
};
/*
* MARK всегда одинаковый для всех типов, среднее 480
* SPACE для данных: 388 или 1251
* LEAD: 3497, 1711
* SPACE для паузы: 25141, 34674, 34674
*/
/*
* MARK: 480 (Sinchro, Data, Final), 3497 (Lead)
* SPACE: 388 или 1251 (Data), 1711 (Lead), 25141 (после синхро) и 34674 между данными
*/
| [
"[email protected]"
] | |
b62684b91375d1eba526e1ec877edf99e035090b | 836d7462df7d6f51badefa3d6abe5e9ec544cd03 | /include/camera.h | c79c0aafeb97d55b74b44c808cfa181572b1502f | [] | no_license | feisabel/Renderer | 9376a4a7d810617e09debfb5565a89201f65ecdc | e0534ae02994caf79d82fba44d711d8b84152c14 | refs/heads/master | 2021-01-02T09:30:51.674968 | 2017-12-08T20:03:54 | 2017-12-08T20:03:54 | 99,229,919 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,039 | h | #ifndef _CAMERA_H_
#define _CAMERA_H_
#include "ray.h"
class Camera {
private:
point3 viewpoint; //camera viewpoint
vec3 u; //camera X axis basis
vec3 v; //camera Y axis basis
vec3 w; //camera Z axis basis
std::string projection; //projection type
point3 lower_left_corner; // lower left corner of the view plane.
vec3 horizontal; // Horizontal dimension of the view plane.
vec3 vertical; // Vertical dimension of the view plane.
vec3 viewplane_normal;
double lens_radius;
public:
Camera() {}
void set_camera(point3 look_from, point3 look_at, vec3 up_vec, std::string proj);
void set_perspective(double fov, double ratio, double d, double aperture);
void set_perspective(double fov, double ratio, double d, double aperture, vec3 vpn);
void set_parallel(double l, double r, double t, double b);
void set_parallel(double l, double r, double t, double b, vec3 vpn);
Ray get_ray(double s, double t);
};
#endif | [
"[email protected]"
] | |
d380eb363ed5bb590c4959d0c918a8f5db116671 | e92f3f3cc326f41e2dacc86a46e79873f30fec25 | /Source/DBJ_AR/Private/AppCore/Data/TData/ServerPrototype.cpp | 028b9a8f2b5537d8c7cdc3b28bbb3c9e615d70b5 | [] | no_license | 1097195326/DBJ_AR | 85a395b7cf488f9b4e49c5355a019f2710533c19 | 79eb0a6f5a44244d8669667dbd4fcf522e2c7d07 | refs/heads/master | 2020-04-02T08:28:52.378971 | 2018-12-19T08:38:12 | 2018-12-19T08:38:12 | 154,246,609 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 681 | cpp | #include "ServerPrototype.h"
G_REGISTER_CLASS(ServerPrototype)
void ServerPrototype::InitWithXML(TiXmlElement * _xml)
{
for (TiXmlElement* elem = _xml->FirstChildElement(); elem != NULL; elem = elem->NextSiblingElement())
{
const char * id = elem->Attribute("key");
if (id != nullptr)
{
ServerData data;
data.m_Key = UTF8_TO_TCHAR(id);
data.m_Value = UTF8_TO_TCHAR(elem->Attribute("value"));
data.m_Desc = UTF8_TO_TCHAR(elem->Attribute("desc"));
m_ServerData.Add(data.m_Key, data);
}
}
}
ServerData ServerPrototype::GetDataByKey(FString _key)
{
if (m_ServerData.Contains(_key))
{
return *m_ServerData.Find(_key);
}
ServerData d;
return d;
} | [
"[email protected]"
] | |
08ecd372f9f1ba3ded864d5930a449a1347dd0ed | c6d4a9d945d1fcba1b30a2c3b49703f4664e17ae | /872-Ordering.cpp | 86210e8db99388278c58e9f4dfec0d61e12344c2 | [] | no_license | GhadaMuhamed/uvaProblems | 219f89037958f1ea0a41e95dbb5749611a7bf75b | 9027527b9ebf39fdd48271be6322e7aa309bda93 | refs/heads/master | 2021-07-06T12:34:35.762000 | 2017-09-22T19:06:06 | 2017-09-22T19:06:06 | 104,509,016 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,253 | cpp | #include <bits/stdc++.h>
using namespace std;
int arr[26][26];
int indeg[26];
int cnt ;
vector<string> ans1;
void func(string tmp) {
for (int i = 0; i < 26; i++) {
bool f = false;
if (indeg[i] == -1)
continue;
int c = 0;
for (int j = 0; j < tmp.size(); j++) {
if (arr[i][tmp[j] - 'A'])
c++;
if (tmp[j] - 'A' == i) {
f = true;
break;
}
}
if (f)
continue;
if (indeg[i] - c == 0) {
string sss = tmp;
sss += (i + 'A');
func(sss);
}
}
if (tmp.size() == cnt)
ans1.push_back(tmp);
}
int main() {
int t;
cin >> t;
cin.ignore();
while (t--) {
cin.ignore();
cnt=0;
ans1.clear();
memset(indeg, -1, sizeof(indeg));
memset(arr, 0, sizeof(arr));
string m;
getline(cin, m);
for (int i = 0; i < m.size(); i++)
if (m[i] != ' ')
indeg[m[i] - 'A'] = 0, cnt++;
string s;
getline(cin, s);
for (int i = 0; i < s.size(); i += 4) {
arr[s[i + 2] - 'A'][s[i] - 'A'] = 1;
indeg[s[i + 2] - 'A']++;
}
func("");
for (int i = 0; i < ans1.size(); i++) {
for (int j = 0; j < ans1[i].size(); j++) {
printf("%c", ans1[i][j]);
if (j != ans1[i].size() - 1)
printf(" ");
}
printf("\n");
}
if (ans1.size()==0)
printf("NO\n");
if (t)
printf("\n");
}
}
| [
"ghada muhamed"
] | ghada muhamed |
4a87c43a60eb3827c94bf94c1e82402f760e9091 | 1b4e03edab97506a435b2dfd1744735c02ab8b85 | /Practica1.cpp | 29b53a15877b96b4f9a34d40d15d34ac8047e252 | [] | no_license | JafethA/Practica1 | d8ad4f73237bbcbd7316f6caf2816bb8796ba1ed | 109de0c8aee6473db44d4429810c41f6dfd5b1df | refs/heads/master | 2021-05-18T10:10:26.822044 | 2020-03-30T04:42:50 | 2020-03-30T04:42:50 | 251,205,428 | 0 | 0 | null | 2020-03-30T04:57:32 | 2020-03-30T04:57:31 | null | ISO-8859-10 | C++ | false | false | 13,176 | cpp | #include<iostream>
#include <fstream>
#include <stdlib.h>
#include<string.h>
using namespace std;
class Nodo
{ private:
int anio,cilindros,dato;
char *marca,*modelo,*categoria,*trasmision,*color;
Nodo *sig;
public:
Nodo()
{ marca=new char[5];
marca="----";
modelo=new char[5];
modelo="----";
categoria=new char[5];
categoria="----";
trasmision=new char[5];
trasmision="----";
color=new char[5];
color="----";
anio=0;
cilindros=0;
sig=NULL;
}
Nodo(char *Ma,char *Mo,char *Ca,char *Tr,char *Co,int An,int Ci)
{ marca=Ma;
modelo=Mo;
categoria=Ca;
trasmision=Tr;
color=Co;
anio=An;
cilindros=Ci;
sig=NULL;
}
void Asignasig(Nodo*);
void Leer();
void Imprimir();
Nodo *Obtienesig();
int Oban() { return(this->anio); };
int Obci() { return(this->cilindros); };
char* Obma(){ return(this->marca); };
char* Obmo(){ return(this->modelo); };
char* Obtr(){ return(this->trasmision); };
char* Obca(){ return(this->categoria); };
char* Obco(){ return(this->color); };
};
void Nodo::Asignasig(Nodo *x)
{ this->sig=x;
}
void Nodo::Leer()
{ char M[20],Mod[20],Cat[20],Tras[20],Co[20];
cout<<"Ingrese Marca: "; cin>>M;
cout<<"Ingrese Modelo: "; cin>>Mod;
cout<<"Ingrese anio: "; cin>>anio;
cout<<"Ingrese Categoria: "; cin>>Cat;
cout<<"Ingrese numero de Cilindros: "; cin>>cilindros;
cout<<"Ingrese color: "; cin>>Co;
cout<<"Ingrese tipo de Trasmision: "; cin>>Tras;
marca=new char[strlen(M)+1]; strcpy(marca,M);
modelo=new char[strlen(Mod)+1]; strcpy(modelo,Mod);
categoria=new char[strlen(Cat)+1]; strcpy(categoria,Cat);
color=new char[strlen(Co)+1]; strcpy(color,Co);
trasmision=new char[strlen(Tras)+1]; strcpy(trasmision,Tras);
}
void Nodo::Imprimir()
{ cout<<"|\t"<<this->marca<<"\t"<<this->modelo<<"\t"<<this->anio<<"\t"
<<this->categoria<<"\t"<<this->cilindros<<"\t"<<this->trasmision<<"\t"<<this->color<<endl;
}
Nodo* Nodo::Obtienesig()
{ return(this->sig);
}
class LSE
{ private:
Nodo *Inicio;
public:
void InsertarI(char*,char*,char*,char*,char*,int,int);
void InsertarF(char*,char*,char*,char*,char*,int,int);
void Imprimir();
void Agregar(Nodo*);
Nodo *ObtenerNodo(int);
LSE()
{ Inicio=NULL;
}
void BorrarI();
void BorrarF();
void Borrar();
int Contar();
Nodo* Buscar(int,int);
Nodo* BuscarG();
Nodo *Buscar(char*,int);
void CrearA(int,int);
void CrearA(char*);
void Editar();
};
Nodo* LSE::ObtenerNodo(int x)
{ Nodo *aux=Inicio;
int i=1;
if(x>Contar()||x<=0) aux=NULL;
else
{ while(i!=x)
{ aux=aux->Obtienesig();
i++;
}
}
return aux;
}
void LSE::InsertarI(char *Ma,char *Mo,char *Ca,char *Tr,char *Co,int An,int Ci)
{ if(!Inicio) Inicio=new Nodo(Ma,Mo,Ca,Tr,Co,An,Ci);
else
{ Nodo *helpx3=new Nodo(Ma,Mo,Ca,Tr,Co,An,Ci);
helpx3->Asignasig(Inicio);
Inicio=helpx3;
}
}
void LSE::InsertarF(char *Ma,char *Mo,char *Ca,char *Tr,char *Co,int An,int Ci)
{ if(Inicio==NULL)
Inicio=new Nodo(Ma,Mo,Ca,Tr,Co,An,Ci);
else
{ Nodo *help=Inicio;
while(help->Obtienesig()!=NULL)
help=help->Obtienesig();
Nodo *helpx2=new Nodo(Ma,Mo,Ca,Tr,Co,An,Ci);
help->Asignasig(helpx2);
}
}
void LSE::Imprimir()
{ if(!Inicio)
cout<<"Lista Vacia"<<endl;
else
{ Nodo *Aux=Inicio;
while(Aux!=NULL)
{ Aux->Imprimir();
Aux=Aux->Obtienesig();
}
}
}
void LSE::BorrarI()
{ if(!Inicio)
cout<<"Lista Vacia"<<endl;
else
{ if(Inicio->Obtienesig()==NULL)
{ delete Inicio;
Inicio=NULL;
}
else
{ Nodo *hay=Inicio;
Inicio=Inicio->Obtienesig();
hay->Asignasig(NULL);
delete hay;
}
}
}
void LSE::BorrarF()
{ if(!Inicio)
cout<<"Lista Vacia"<<endl;
else
{ if(Inicio->Obtienesig()==NULL)
{ delete Inicio;
Inicio=NULL;
}
else
{ Nodo *Ad,*Sh;
Ad=Inicio;
while(Ad->Obtienesig()!=NULL)
{ Sh=Ad;
Ad=Ad->Obtienesig();
}
Sh->Asignasig(NULL);
delete Ad;
}
}
}
int LSE::Contar()
{ int ESCA=0;
if(!Inicio) ESCA=0;
else
{ Nodo *REC=Inicio;
while(REC!=NULL)
{ ESCA++;
REC=REC->Obtienesig();
}
} return ESCA;
}
void LSE::Editar()
{ system("cls");
cout<<"Edicion de datos"<<endl;
Nodo *temp=BuscarG();
if(temp==NULL) cout<<"Dato no encontrado"<<endl;
else
{ system("cls"); temp->Imprimir(); cout<<"Nuevos datos: "<<endl;
temp->Leer();
}
}
void LSE::Borrar()
{ cout<<"Borrar Datos"<<endl;
Nodo *simi=BuscarG();
if(simi==NULL) cout<<"Dato no encontrado"<<endl;
else
{ if(simi==Inicio) BorrarI();
else
{ if(simi->Obtienesig()==NULL) BorrarF();
else
{ Nodo *XL=Inicio;
while(XL->Obtienesig()!=simi)
XL=XL->Obtienesig();
XL->Asignasig(simi->Obtienesig());
simi->Asignasig(NULL);
delete simi;
}
}
}
}
Nodo* LSE::Buscar(char *m,int op)
{ Nodo *Aux=Inicio;
char *x;
x=new char[strlen(m)+1];
strcpy(x,m);
int i=1,j=0;
if(Inicio)
{ switch(op)
{ case 1: while (Aux!=NULL)
{ if(strcmp(x,Aux->Obma())==0)
{ cout<<"#"<<i<<": "; Aux->Imprimir(); i++; j++;
}
else i++;
Aux=Aux->Obtienesig();
} break;
case 2: while (Aux!=NULL)
{ if(strcmp(x,Aux->Obmo())==0)
{ cout<<"#"<<i<<": "; Aux->Imprimir(); i++; j++;
}
else i++;
Aux=Aux->Obtienesig();
} break;
case 4: while (Aux!=NULL)
{ if(strcmp(x,Aux->Obca())==0)
{ cout<<"#"<<i<<": "; Aux->Imprimir(); i++; j++;
}
else i++;
Aux=Aux->Obtienesig();
} break;
case 6: while (Aux!=NULL)
{ if(strcmp(x,Aux->Obco())==0)
{ cout<<"#"<<i<<": "; Aux->Imprimir(); i++; j++;
}
else i++;
Aux=Aux->Obtienesig();
} break;
case 7: while (Aux!=NULL)
{ if(strcmp(x,Aux->Obtr())==0)
{ cout<<"#"<<i<<": "; Aux->Imprimir(); i++; j++;
}
else i++;
Aux=Aux->Obtienesig();
} break;
}
if(j==0) cout<<"Dato no encontrado en base de datos"<<endl;
else
{ cout<<"Selecciona el numero del dato buscado: "; cin>>i;
Aux=ObtenerNodo(i); return Aux;
}
}
return Aux;
}
Nodo* LSE::Buscar(int x,int op)
{ Nodo *covid=Inicio;
int i=1;
if(Inicio)
{ switch(op)
{ case 3: while (covid!=NULL)
{ if(covid->Oban()==x)
{ cout<<"#"<<i<<": "; covid->Imprimir(); i++;
}
else i++;
covid=covid->Obtienesig();
}
cout<<"Selecciona el numero del dato buscado: "; cin>>i;
covid=ObtenerNodo(i); return covid; break;
case 5: while (covid!=NULL)
{ if(covid->Obci()==x)
{ cout<<"#"<<i<<": "; covid->Imprimir(); i++;
}
else i++;
covid=covid->Obtienesig();
}
cout<<"Selecciona el numero del dato buscado: "; cin>>i;
covid=ObtenerNodo(i); return covid; break;
}
}
return covid;
}
Nodo* LSE::BuscarG()
{ Nodo *temp;
int i,op;
char m[11];
cout<<"Como vamos a buscar los datos que necesitas: "<<endl
<<"Opcion 1=Marca"<<endl<<"Opcion 2=Modelo"<<endl<<"Opcion 3=anio"<<endl
<<"Opcion 4=Categoria"<<endl<<"Opcion 5=Numero de Cilindros"<<endl
<<"Opcion 6=Color"<<endl<<"Opcion 7=Tipo de Trasmision"<<endl
<<"Seleccionaste: "; cin>>op;
switch(op)
{ case 1: cout<<"Ingrese Marca: "; cin>>m;
temp=Buscar(m,op); return temp; break;
case 2: cout<<"Ingrese Modelo: "; cin>>m;
temp=Buscar(m,op); return temp; break;
case 3: cout<<"Ingrese Anio: "; cin>>i;
temp=Buscar(i,op); return temp; break;
case 4: cout<<"Ingrese Categoria: "; cin>>m;
temp=Buscar(m,op); return temp; break;
case 5: cout<<"Ingrese Numero de Cilindros: "; cin>>i;
temp=Buscar(i,op); return temp; break;
case 6: cout<<"Ingrese Color: "; cin>>m;
temp=Buscar(m,op); return temp; break;
case 7: cout<<"Ingrese Tipo de Trasmision: "; cin>>m;
temp=Buscar(m,op); return temp; break;
default: cout<<"Opcion Invalida verifica tu seleccion"<<endl; break;
}
}
void LSE::CrearA(char *m)
{ ofstream Mar;
char *x;
x=new char[strlen(m)+1];
strcpy(x,m);
Nodo *Aux=Inicio;
Mar.open("E:/Carrosmarca.txt");
while(Aux!=NULL)
{ if(strcmp(x,Aux->Obma())==0)
Mar<<Aux->Obma()<<"\t"<<Aux->Obmo()<<"\t"<<Aux->Oban()<<"\t"<<Aux->Obca()<<"\t"<<Aux->Obci()<<"\t"<<Aux->Obtr()<<"\t"<<Aux->Obco()<<endl;
Aux=Aux->Obtienesig();
}
Mar.close();
}
void LSE::CrearA(int x,int op)
{ ofstream An,Cilin;
if(op==1)
{ Nodo *Aux=Inicio;
An.open("E:/Carrosaņo.txt");
while(Aux!=NULL)
{ if(Aux->Oban()==x)
An<<Aux->Obma()<<"\t"<<Aux->Obmo()<<"\t"<<Aux->Oban()<<"\t"<<Aux->Obca()<<"\t"<<Aux->Obci()<<"\t"<<Aux->Obtr()<<"\t"<<Aux->Obco()<<endl;
Aux=Aux->Obtienesig();
}
An.close();
}
else
{ Nodo *Aux=Inicio;
Cilin.open("E:/CarrosCilindros.txt");
while(Aux!=NULL)
{ if(Aux->Obci()==x)
Cilin<<Aux->Obma()<<"\t"<<Aux->Obmo()<<"\t"<<Aux->Oban()<<"\t"<<Aux->Obca()<<"\t"<<Aux->Obci()<<"\t"<<Aux->Obtr()<<"\t"<<Aux->Obco()<<endl;
Aux=Aux->Obtienesig();
}
Cilin.close();
}
}
class Archivo
{ private:
fstream A;
public:
void InicializarLec();
void InicializarEsc();
void LeerA(LSE&);
void EscribirA(int);
void Finalizar(LSE);
};
void Archivo::InicializarLec()
{ A.open("E:/carros.txt", ios::in);
if(A.fail())
{ cout<<"No se abrio el archivo"<<endl;
system("pause");
exit(0);
}
cout<<"Eres un master en el manejo de archivos"<<endl;
}
void Archivo::Finalizar(LSE D)
{ Nodo *Aux=D.ObtenerNodo(1);
ofstream g;
g.open("E:/carros.txt");
if(g.fail())
{ cout<<"No se abrio el archivo"<<endl;
system("pause");
exit(0);
}
else
{ while(Aux!=NULL)
{ g<<Aux->Obma()<<"\t"<<Aux->Obmo()<<"\t"<<Aux->Oban()<<"\t"<<Aux->Obca()<<"\t"<<Aux->Obci()<<"\t"<<Aux->Obtr()<<"\t"<<Aux->Obco()<<endl;
Aux=Aux->Obtienesig();
}
}
cout<<"Datos guardados correctamente adios"<<endl;
g.close();
}
void Archivo::LeerA(LSE &T)
{ int i,nL,ani=0,cili=0;
char *Ma,*Mode,*Cate,*Trasm,*Col;
while(!A.eof())
{ char M[20],Mod[20],An[20],Cat[20],Cil[20],Tras[20],Co[20];
i=0;
A.getline(M,20,'\t');
A.getline(Mod,20,'\t');
A.getline(An,20,'\t');
A.getline(Cat,20,'\t');
A.getline(Cil,20,'\t');
A.getline(Tras,20,'\t');
A.getline(Co,20);
while(*(M+i)!=NULL) i++;
nL=i; Ma=new char[nL+1];
for(i=0;i<nL+1;i++) Ma[i]=M[i];
i=0;
while(*(Mod+i)!=NULL) i++;
nL=i; Mode=new char[nL+1];
for(i=0;i<nL+1;i++) Mode[i]=Mod[i];
i=0;
while(*(Cat+i)!=NULL) i++;
nL=i; Cate=new char[nL+1];
for(i=0;i<nL+1;i++) Cate[i]=Cat[i];
i=0;
while(*(Co+i)!=NULL) i++;
nL=i; Col=new char[nL+1];
for(i=0;i<nL+1;i++) Col[i]=Co[i];
i=0;
while(*(Tras+i)!=NULL) i++;
nL=i; Trasm=new char[nL+1];
for(i=0;i<nL+1;i++) Trasm[i]=Tras[i];
ani=atoi(An); cili=atoi(Cil);
T.InsertarF(Ma,Mode,Cate,Trasm,Col,ani,cili);
} A.close();
}
main()
{ LSE Dan;
Nodo aux;
Archivo A;
char m[11];
int opc,con=0,x,op;
do{
cout<<"\t\tListas LSE Instituto Politecnico Nacional"<<endl<<
"--------------------------------------------------------------------"<<endl<<
"\tMenu\nOpcion 1=Cargar archivos\nOpcion 2=Imprimir\nOpcion 3=Insertar al Inicio"<<
"\nOpcion 4=Insertar al final\nOpcion 5=Borrar Inicio\nOpcion 6=Borrar final"<<
"\nOpcion 7=Contar datos\nOpcion 8=Borrar dato especifico\nOpcion 9=Editar Datos"<<
"\nOpcion 10=Crear archivos con datos\nOpcion 11=Salir\nSeleccionaste: "; cin>>opc;
switch(opc)
{ case 1: if(con==0){ A.InicializarLec();
A.LeerA(Dan); con++;}
else cout<<"Esta opcion solo se puede ocupar una vez"<<endl; break;
case 2: Dan.Imprimir(); break;
case 3: aux.Leer(); Dan.InsertarI(aux.Obma(),aux.Obmo(),aux.Obca(),aux.Obtr(),aux.Obco(),aux.Oban(),aux.Obci()); break;
case 4: aux.Leer(); Dan.InsertarF(aux.Obma(),aux.Obmo(),aux.Obca(),aux.Obtr(),aux.Obco(),aux.Oban(),aux.Obci()); break;
case 5: Dan.BorrarI(); break;
case 6: Dan.BorrarF(); break;
case 7: cout<<"Datos de lista: "<<Dan.Contar()<<endl; break;
case 8: Dan.Borrar(); break;
case 9: Dan.Editar(); break;
case 10:cout<<"Que desea generar\n1=Por anio\n2=Por numero de cilindros\n3=Por marca\nSeleccionaste: "; cin>>op;
switch(op)
{ case 1: cout<<"Ingrese anio: "; cin>>x;
Dan.CrearA(x,op); break;
case 2: cout<<"Ingrese numero de cilindros: "; cin>>x;
Dan.CrearA(x,op); break;
case 3: cout<<"Ingresa la marca: "; cin>>m;
Dan.CrearA(m); break;
default: cout<<"Opcion Invalida Verifica"<<endl;
} break;
case 11: cout<<"Saliste del programa"<<endl; break;
default: cout<<"Opcion invalida verifica las opciones"<<endl; break;
}
system("pause"); system("cls");
}while(opc!=11);
A.Finalizar(Dan);
}
| [
"[email protected]"
] | |
e3602081f1d1016ae9dee3696b1d9b17ae331c46 | ec32c29a28d826c90cbbe6114e904755c25efa10 | /login.h | 107ad2dbc946da42df4d1d1317b9958d54840e6c | [] | no_license | littleTrick/CurveDisplay | 60d9eb5efa347b491d6a9ea904204c6164e92ee6 | e0537f4810d9d2e478edb75866c9b47100fb38c7 | refs/heads/master | 2021-08-22T20:37:17.512973 | 2017-12-01T07:08:29 | 2017-12-01T07:08:29 | 112,010,452 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 323 | h | #ifndef LOGIN_H
#define LOGIN_H
#include <QDialog>
namespace Ui {
class Login;
}
class Login : public QDialog
{
Q_OBJECT
public:
explicit Login(QWidget *parent = 0);
~Login();
public slots:
void ClickedBtnLogin();
void ClickedBtnLogout();
private:
Ui::Login *ui;
};
#endif // LOGIN_H
| [
"[email protected]"
] | |
f8cb6f3e75d5df422e9cd37d8917b07e8b223e44 | 1cd774ad5855a2aa3764be89c1bf7f0c803a9d30 | /c4.cpp | 834f3bf547a104300d23c3846135a988b8c3e908 | [] | no_license | comco/c4 | 384dcc2348ffcfd8a92bbeab8adeb0ce17a05405 | 40aca7b9ef6906a1484d08fbb9e74290d0fb1a29 | refs/heads/master | 2021-01-13T04:46:56.821913 | 2017-01-14T21:23:57 | 2017-01-14T21:23:57 | 78,967,492 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,824 | cpp | #include <iostream>
#include <vector>
#include <cassert>
using namespace std;
typedef vector<vector<int>> graph;
typedef unsigned uint;
bool has_c4_slow(const graph& g) {
uint n = g.size();
for (uint i = 0; i < n; ++i) {
for (uint j : g[i]) {
for (uint k : g[j]) if (k != i) {
for (uint l : g[k]) if (l != j && l != i) {
for (uint m : g[l]) {
if (m == i) return true;
}
}
}
}
}
return false;
}
bool has_c4_fast(const graph& g) {
uint n = g.size();
vector<vector<uint>> arr(n);
for (uint i = 0; i < n; ++i) {
arr[i].resize(n);
}
for (uint i = 0; i < n; ++i) {
for (uint j : g[i]) {
for (uint k : g[i]) if (j < k) {
if (++arr[j][k] == 2) {
return true;
}
}
}
}
return false;
}
void forall_graphs(uint n, uint i, uint j, graph& g, void (*f)(const graph&)) {
if (i == n) {
f(g);
return;
}
if (j == n) {
forall_graphs(n, i+1, i+2, g, f);
} else {
forall_graphs(n, i, j+1, g, f);
g[i].push_back(j);
g[j].push_back(i);
forall_graphs(n, i, j+1, g, f);
g[i].pop_back();
g[j].pop_back();
}
}
ostream& operator <<(ostream& os, const graph& g) {
uint n = g.size();
for (uint i = 0; i < n; ++i) {
os << i << ": ";
for (uint j : g[i]) {
os << j << " ";
}
os << "\n";
}
os << "\n";
return os;
}
void doit(const graph& g) {
bool c4_slow = has_c4_slow(g);
bool c4_fast = has_c4_fast(g);
assert(!(c4_slow ^ c4_fast));
if (c4_slow) {
cout << g;
}
}
int main() {
// Generates all graphs of 7 vertices and verifies that the slow and fast
// algorithms for detecting C4 agree on them.
// Outputs all graphs that contain C4.
uint n = 7;
graph g(n);
forall_graphs(n, 0, 1, g, doit);
return 0;
}
| [
"[email protected]"
] | |
511f77666f4c5b8e13df05d92dec21c8a93c28f3 | 70477889f721da253a4ab49a47d5a504458d5818 | /source/Lidar_curb_scan/Single_lidar_curb_scan/vscan_default/ros-headers/lgsvl_msgs/BoundingBox3D.h | 7e371ff7e2bc01f6121b481884d11a051f05872f | [] | no_license | iljoobaek/Lidar_curb_detection | af2d359627b2228e7678563a7d05137ef0c52a04 | a410b77eecadfc1fe7584de64c7b7a010999ed75 | refs/heads/master | 2022-08-06T01:34:19.848581 | 2020-05-26T16:29:21 | 2020-05-26T16:29:21 | 191,998,099 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,910 | h | // Generated by gencpp from file lgsvl_msgs/BoundingBox3D.msg
// DO NOT EDIT!
#ifndef LGSVL_MSGS_MESSAGE_BOUNDINGBOX3D_H
#define LGSVL_MSGS_MESSAGE_BOUNDINGBOX3D_H
#include <string>
#include <vector>
#include <map>
#include <ros/types.h>
#include <ros/serialization.h>
#include <ros/builtin_message_traits.h>
#include <ros/message_operations.h>
#include <geometry_msgs/Pose.h>
#include <geometry_msgs/Vector3.h>
namespace lgsvl_msgs
{
template <class ContainerAllocator>
struct BoundingBox3D_
{
typedef BoundingBox3D_<ContainerAllocator> Type;
BoundingBox3D_()
: position()
, size() {
}
BoundingBox3D_(const ContainerAllocator& _alloc)
: position(_alloc)
, size(_alloc) {
(void)_alloc;
}
typedef ::geometry_msgs::Pose_<ContainerAllocator> _position_type;
_position_type position;
typedef ::geometry_msgs::Vector3_<ContainerAllocator> _size_type;
_size_type size;
typedef boost::shared_ptr< ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> > Ptr;
typedef boost::shared_ptr< ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> const> ConstPtr;
}; // struct BoundingBox3D_
typedef ::lgsvl_msgs::BoundingBox3D_<std::allocator<void> > BoundingBox3D;
typedef boost::shared_ptr< ::lgsvl_msgs::BoundingBox3D > BoundingBox3DPtr;
typedef boost::shared_ptr< ::lgsvl_msgs::BoundingBox3D const> BoundingBox3DConstPtr;
// constants requiring out of line definition
template<typename ContainerAllocator>
std::ostream& operator<<(std::ostream& s, const ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> & v)
{
ros::message_operations::Printer< ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> >::stream(s, "", v);
return s;
}
} // namespace lgsvl_msgs
namespace ros
{
namespace message_traits
{
// BOOLTRAITS {'IsFixedSize': True, 'IsMessage': True, 'HasHeader': False}
// {'std_msgs': ['/opt/ros/kinetic/share/std_msgs/cmake/../msg'], 'sensor_msgs': ['/opt/ros/kinetic/share/sensor_msgs/cmake/../msg'], 'geometry_msgs': ['/opt/ros/kinetic/share/geometry_msgs/cmake/../msg'], 'lgsvl_msgs': ['/tmp/binarydeb/ros-kinetic-lgsvl-msgs-0.0.2/msg']}
// !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types']
template <class ContainerAllocator>
struct IsFixedSize< ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct IsFixedSize< ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> const>
: TrueType
{ };
template <class ContainerAllocator>
struct IsMessage< ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct IsMessage< ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> const>
: TrueType
{ };
template <class ContainerAllocator>
struct HasHeader< ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct HasHeader< ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> const>
: FalseType
{ };
template<class ContainerAllocator>
struct MD5Sum< ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> >
{
static const char* value()
{
return "0afc39928ba33aad299a6acabb48fd7d";
}
static const char* value(const ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator>&) { return value(); }
static const uint64_t static_value1 = 0x0afc39928ba33aadULL;
static const uint64_t static_value2 = 0x299a6acabb48fd7dULL;
};
template<class ContainerAllocator>
struct DataType< ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> >
{
static const char* value()
{
return "lgsvl_msgs/BoundingBox3D";
}
static const char* value(const ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator>&) { return value(); }
};
template<class ContainerAllocator>
struct Definition< ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> >
{
static const char* value()
{
return "geometry_msgs/Pose position # 3D position and orientation of the bounding box center in Lidar space, in meters\n\
geometry_msgs/Vector3 size # Size of the bounding box, in meters\n\
\n\
================================================================================\n\
MSG: geometry_msgs/Pose\n\
# A representation of pose in free space, composed of position and orientation. \n\
Point position\n\
Quaternion orientation\n\
\n\
================================================================================\n\
MSG: geometry_msgs/Point\n\
# This contains the position of a point in free space\n\
float64 x\n\
float64 y\n\
float64 z\n\
\n\
================================================================================\n\
MSG: geometry_msgs/Quaternion\n\
# This represents an orientation in free space in quaternion form.\n\
\n\
float64 x\n\
float64 y\n\
float64 z\n\
float64 w\n\
\n\
================================================================================\n\
MSG: geometry_msgs/Vector3\n\
# This represents a vector in free space. \n\
# It is only meant to represent a direction. Therefore, it does not\n\
# make sense to apply a translation to it (e.g., when applying a \n\
# generic rigid transformation to a Vector3, tf2 will only apply the\n\
# rotation). If you want your data to be translatable too, use the\n\
# geometry_msgs/Point message instead.\n\
\n\
float64 x\n\
float64 y\n\
float64 z\n\
";
}
static const char* value(const ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator>&) { return value(); }
};
} // namespace message_traits
} // namespace ros
namespace ros
{
namespace serialization
{
template<class ContainerAllocator> struct Serializer< ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> >
{
template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m)
{
stream.next(m.position);
stream.next(m.size);
}
ROS_DECLARE_ALLINONE_SERIALIZER
}; // struct BoundingBox3D_
} // namespace serialization
} // namespace ros
namespace ros
{
namespace message_operations
{
template<class ContainerAllocator>
struct Printer< ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator> >
{
template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::lgsvl_msgs::BoundingBox3D_<ContainerAllocator>& v)
{
s << indent << "position: ";
s << std::endl;
Printer< ::geometry_msgs::Pose_<ContainerAllocator> >::stream(s, indent + " ", v.position);
s << indent << "size: ";
s << std::endl;
Printer< ::geometry_msgs::Vector3_<ContainerAllocator> >::stream(s, indent + " ", v.size);
}
};
} // namespace message_operations
} // namespace ros
#endif // LGSVL_MSGS_MESSAGE_BOUNDINGBOX3D_H
| [
"[email protected]"
] | |
138ea653ce3e6ae8d051e3095365692ac2dc8a5f | 73120b54a6a7a08e3a7140fb53a0b018c38b499d | /hphp/util/vixl/utils.h | e40e0366dc177b64b78b0b6215e78cc01c63cce1 | [
"Zend-2.0",
"LicenseRef-scancode-unknown-license-reference",
"PHP-3.01"
] | permissive | mrotec/hiphop-php | 58705a281ff6759cf1acd9735a312c486a18a594 | 132241f5e5b7c5f1873dbec54c5bc691c6e75f28 | refs/heads/master | 2021-01-18T10:10:43.051362 | 2013-07-31T19:11:55 | 2013-07-31T19:25:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,044 | h | /*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
// Copyright 2013, ARM Limited
// All rights reserved.
//
// 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.
// * Neither the name of ARM Limited nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 OWNER 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 VIXL_UTILS_H
#define VIXL_UTILS_H
#include <string.h>
#include "hphp/util/vixl/globals.h"
namespace vixl {
// Check number width.
inline bool is_intn(unsigned n, int64_t x) {
ASSERT((0 < n) && (n < 64));
int64_t limit = 1L << (n - 1);
return (-limit <= x) && (x < limit);
}
inline bool is_uintn(unsigned n, int64_t x) {
ASSERT((0 < n) && (n < 64));
return !(x >> n);
}
inline unsigned truncate_to_intn(unsigned n, int64_t x) {
ASSERT((0 < n) && (n < 64));
return (x & ((1L << n) - 1));
}
#define INT_1_TO_63_LIST(V) \
V(1) V(2) V(3) V(4) V(5) V(6) V(7) V(8) \
V(9) V(10) V(11) V(12) V(13) V(14) V(15) V(16) \
V(17) V(18) V(19) V(20) V(21) V(22) V(23) V(24) \
V(25) V(26) V(27) V(28) V(29) V(30) V(31) V(32) \
V(33) V(34) V(35) V(36) V(37) V(38) V(39) V(40) \
V(41) V(42) V(43) V(44) V(45) V(46) V(47) V(48) \
V(49) V(50) V(51) V(52) V(53) V(54) V(55) V(56) \
V(57) V(58) V(59) V(60) V(61) V(62) V(63)
#define DECLARE_IS_INT_N(N) \
inline bool is_int##N(int64_t x) { return is_intn(N, x); }
#define DECLARE_IS_UINT_N(N) \
inline bool is_uint##N(int64_t x) { return is_uintn(N, x); }
#define DECLARE_TRUNCATE_TO_INT_N(N) \
inline int truncate_to_int##N(int x) { return truncate_to_intn(N, x); }
INT_1_TO_63_LIST(DECLARE_IS_INT_N)
INT_1_TO_63_LIST(DECLARE_IS_UINT_N)
INT_1_TO_63_LIST(DECLARE_TRUNCATE_TO_INT_N)
#undef DECLARE_IS_INT_N
#undef DECLARE_IS_UINT_N
#undef DECLARE_TRUNCATE_TO_INT_N
// Bit field extraction.
inline uint32_t unsigned_bitextract_32(int msb, int lsb, uint32_t x) {
return (x >> lsb) & ((1 << (1 + msb - lsb)) - 1);
}
inline uint64_t unsigned_bitextract_64(int msb, int lsb, uint64_t x) {
return (x >> lsb) & ((1 << (1 + msb - lsb)) - 1);
}
inline int32_t signed_bitextract_32(int msb, int lsb, int32_t x) {
return (x << (31 - msb)) >> (lsb + 31 - msb);
}
inline int64_t signed_bitextract_64(int msb, int lsb, int64_t x) {
return (x << (63 - msb)) >> (lsb + 63 - msb);
}
// floating point representation
uint32_t float_to_rawbits(float value);
uint64_t double_to_rawbits(double value);
float rawbits_to_float(uint32_t bits);
double rawbits_to_double(uint64_t bits);
// Bits counting.
int CountLeadingZeros(uint64_t value, int width);
int CountLeadingSignBits(int64_t value, int width);
int CountTrailingZeros(uint64_t value, int width);
int CountSetBits(uint64_t value, int width);
// Pointer alignment
// TODO: rename/refactor to make it specific to instructions.
template<typename T>
bool IsWordAligned(T pointer) {
ASSERT(sizeof(pointer) == sizeof(intptr_t)); // NOLINT(runtime/sizeof)
return (reinterpret_cast<intptr_t>(pointer) & 3) == 0;
}
// Increment a pointer until it has the specified alignment.
template<class T>
T AlignUp(T pointer, size_t alignment) {
ASSERT(sizeof(pointer) == sizeof(uintptr_t));
uintptr_t pointer_raw = reinterpret_cast<uintptr_t>(pointer);
size_t align_step = (alignment - pointer_raw) % alignment;
ASSERT((pointer_raw + align_step) % alignment == 0);
return reinterpret_cast<T>(pointer_raw + align_step);
}
} // namespace vixl
#endif // VIXL_UTILS_H
| [
"[email protected]"
] | |
bd523418b25a9bd958f22c8fc9618dad26234804 | bb6ebff7a7f6140903d37905c350954ff6599091 | /third_party/WebKit/Source/core/css/CSSKeyframeRule.h | 48f1bfaf0a572d497b396d331974a0589740c7e6 | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"LGPL-2.0-only",
"BSD-2-Clause",
"LGPL-2.1-only",
"BSD-3-Clause"
] | permissive | PDi-Communication-Systems-Inc/lollipop_external_chromium_org | faa6602bd6bfd9b9b6277ce3cd16df0bd26e7f2f | ccadf4e63dd34be157281f53fe213d09a8c66d2c | refs/heads/master | 2022-12-23T18:07:04.568931 | 2016-04-11T16:03:36 | 2016-04-11T16:03:36 | 53,677,925 | 0 | 1 | BSD-3-Clause | 2022-12-09T23:46:46 | 2016-03-11T15:49:07 | C++ | UTF-8 | C++ | false | false | 3,645 | h | /*
* Copyright (C) 2007, 2008, 2012 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 COMPUTER, 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 COMPUTER, 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 CSSKeyframeRule_h
#define CSSKeyframeRule_h
#include "core/css/CSSRule.h"
namespace WebCore {
class CSSKeyframesRule;
class CSSParserValueList;
class CSSStyleDeclaration;
class MutableStylePropertySet;
class StylePropertySet;
class StyleRuleCSSStyleDeclaration;
class StyleKeyframe FINAL : public RefCountedWillBeGarbageCollectedFinalized<StyleKeyframe> {
WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
public:
static PassRefPtrWillBeRawPtr<StyleKeyframe> create()
{
return adoptRefWillBeNoop(new StyleKeyframe());
}
~StyleKeyframe();
// Exposed to JavaScript.
String keyText() const;
void setKeyText(const String&);
// Used by StyleResolver.
const Vector<double>& keys() const;
// Used by BisonCSSParser when constructing a new StyleKeyframe.
void setKeys(PassOwnPtr<Vector<double> >);
const StylePropertySet& properties() const { return *m_properties; }
MutableStylePropertySet& mutableProperties();
void setProperties(PassRefPtr<StylePropertySet>);
String cssText() const;
void trace(Visitor*) { }
static PassOwnPtr<Vector<double> > createKeyList(CSSParserValueList*);
private:
StyleKeyframe();
RefPtr<StylePropertySet> m_properties;
// These are both calculated lazily. Either one can be set, which invalidates the other.
mutable String m_keyText;
mutable OwnPtr<Vector<double> > m_keys;
};
class CSSKeyframeRule FINAL : public CSSRule {
public:
virtual ~CSSKeyframeRule();
virtual CSSRule::Type type() const OVERRIDE { return KEYFRAME_RULE; }
virtual String cssText() const OVERRIDE { return m_keyframe->cssText(); }
virtual void reattach(StyleRuleBase*) OVERRIDE;
String keyText() const { return m_keyframe->keyText(); }
void setKeyText(const String& s) { m_keyframe->setKeyText(s); }
CSSStyleDeclaration* style() const;
virtual void trace(Visitor*) OVERRIDE;
private:
CSSKeyframeRule(StyleKeyframe*, CSSKeyframesRule* parent);
RefPtrWillBeMember<StyleKeyframe> m_keyframe;
mutable RefPtrWillBeMember<StyleRuleCSSStyleDeclaration> m_propertiesCSSOMWrapper;
friend class CSSKeyframesRule;
};
DEFINE_CSS_RULE_TYPE_CASTS(CSSKeyframeRule, KEYFRAME_RULE);
} // namespace WebCore
#endif // CSSKeyframeRule_h
| [
"[email protected]"
] | |
654b92ab3b3cce21a96953d89cdb322112f5b294 | 4c626c943b6af56524c6599b64451722ee2e9629 | /common_tools/utils/default_visitor.hpp | a1c38230d5b74f98e9713a33e5b14bc7081084f5 | [] | no_license | kirillPshenychnyi/AEP | 96cec51a4c579b2430b8c93cace5e25003c64219 | 07d9f3deb47514043a8a1cb0c5ff6091737c3d47 | refs/heads/master | 2018-08-31T16:59:08.415648 | 2018-06-10T22:21:04 | 2018-06-10T22:21:04 | 117,731,321 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,698 | hpp | #ifndef __COMMON_TOOLS_DEFAULT_VISITOR_HPP__
#define __COMMON_TOOLS_DEFAULT_VISITOR_HPP__
/***************************************************************************/
namespace Tools {
/***************************************************************************/
// base
template < typename _BaseVisitor, typename... _Types >
struct DefaultVisitor;
// single
template < typename _BaseVisitor, typename _Type >
struct DefaultVisitor< _BaseVisitor, _Type >
: public _BaseVisitor
{
/***************************************************************************/
void visit( _Type const & _type ) override
{
}
/***************************************************************************/
};
/***************************************************************************/
// multiple
template < typename _BaseVisitor, typename _Type, typename ... _Other >
struct DefaultVisitor< _BaseVisitor, _Type, _Other... >
: public DefaultVisitor< _BaseVisitor, _Other ... >
{
/***************************************************************************/
using DefaultVisitor< _BaseVisitor, _Other ... >::visit;
void visit( _Type const & _inst ) override {}
/***************************************************************************/
};
/***************************************************************************/
#define DECLARE_DEFAULT_VISITOR( Name, ... ) \
struct Name##DefaultVisitor \
: public Tools::DefaultVisitor< Name##Visitor, __VA_ARGS__ > \
{};
/***************************************************************************/
}
/***************************************************************************/
#endif // !__COMMON_TOOLS_DEFAULT_VISITOR_HPP__
| [
"[email protected]"
] | |
015a4e9d85dbda0d3c691182927ebc10e76bc64a | 3907daeec7e645284133c5f286bd5b6f8c456de9 | /project2/jinn/deque.cpp | 675dfbc4b6439c5b6300332531da4a4491f51742 | [] | no_license | nanxinjin/CS251 | bc45c3906d4af5ca6dc2854c3febc66e09ceb4e8 | 3f68cc47529d51e7534df9a9128e518ef5e0ccfa | refs/heads/master | 2021-01-22T01:55:40.491840 | 2016-09-20T20:27:22 | 2016-09-20T20:27:22 | 68,748,655 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,574 | cpp | #include <iostream>
#include "deque.h"
using namespace std;
Deque::Deque()
{
//TODO: Write the Deque constructor
//NOTE: Start with an array of size 10!
size = 10;
deq = new int[size];
head = 0;
tail = 0;
count = 0;
}
void Deque::enqueue_front(int n)
{
//TODO: Front enqueue method
if (is_full() == true){
reallocate();
}
head--;
if(head < 0){
head = size - 1;
}
deq[head] = n;
count ++;
}
void Deque::enqueue_back(int n)
{
//TODO: Back enqueue
if(is_full() == true){
reallocate();
}
is_full();
deq[tail] = n;
tail++;
if(tail >= size){
tail = 0;
}
count++;
}
int Deque::dequeue_front()
{
//TODO: front dequeue
if(count <= 0){
return -1;
}
int pop = deq[head];
head ++;
if(head >= size){
head = 0;
}
count--;
return pop;
}
int Deque::dequeue_back()
{
//TODO: back dequeue
if(count <= 0){
return -1;
}
tail--;
if(tail < 0){
tail = size-1;
}
int pop = deq[tail];
count--;
return pop;
}
bool Deque::is_full()
{
//TODO: Determine if you need to double the array
if(count == size){
return true;
}else{
return false;
}
}
void Deque::reallocate()
{
//TODO: Correctly reallocate memory for the deque. Use the doubling strategy.
int i = head;
int j = tail;
int k = size;
size = size * 2;
int * temp = deq;
deq = new int[size];
int copy = 0;
for(i; i < k; i++){
deq[copy] = temp[i];
copy++;
}
i = 0;
for(i;i<j;i++){
deq[copy] = temp[i];
copy++;
}
head = 0;
tail = k;
}
int Deque::return_size(){
int a = size;
return a;
}
| [
"[email protected]"
] | |
26945d5517ae71d8e737bd4943dcd5887af9e900 | e44098d9ea19ddf93d26a9d263f3265528ef0a2e | /Public/Source/GacUIReflection.cpp | 0ab7f04cedd9bdf5c31088b427977ef2f2368417 | [] | no_license | zhangf911/XGac | 2c26b3dbd9ae7a1560bd2dde38bedab2b84d94a4 | 5a00f65f4c17e76e843ca6b037fcdcfc7fe84c4c | refs/heads/master | 2021-01-16T22:41:28.452455 | 2015-02-01T09:08:17 | 2015-02-01T09:08:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 465,321 | cpp | /***********************************************************************
THIS FILE IS AUTOMATICALLY GENERATED. DO NOT MODIFY
DEVELOPER: Zihan Chen(vczh)
***********************************************************************/
#include "GacUIReflection.h"
/***********************************************************************
GuiInstanceHelperTypes.cpp
***********************************************************************/
namespace vl
{
namespace presentation
{
namespace helper_types
{
}
}
#ifndef VCZH_DEBUG_NO_REFLECTION
namespace reflection
{
namespace description
{
using namespace presentation::helper_types;
/***********************************************************************
Type Declaration
***********************************************************************/
GUIREFLECTIONHELPERTYPES_TYPELIST(IMPL_TYPE_INFO)
#define _ ,
BEGIN_STRUCT_MEMBER(SiteValue)
STRUCT_MEMBER(row)
STRUCT_MEMBER(column)
STRUCT_MEMBER(rowSpan)
STRUCT_MEMBER(columnSpan)
END_STRUCT_MEMBER(SiteValue)
BEGIN_ENUM_ITEM(ListViewViewType)
ENUM_ITEM_NAMESPACE(ListViewViewType)
ENUM_NAMESPACE_ITEM(BigIcon)
ENUM_NAMESPACE_ITEM(SmallIcon)
ENUM_NAMESPACE_ITEM(List)
ENUM_NAMESPACE_ITEM(Tile)
ENUM_NAMESPACE_ITEM(Information)
ENUM_NAMESPACE_ITEM(Detail)
END_ENUM_ITEM(ListViewViewType)
#undef _
}
}
namespace presentation
{
using namespace reflection::description;
using namespace controls;
/***********************************************************************
Type Loader
***********************************************************************/
class GuiHelperTypesLoader : public Object, public ITypeLoader
{
public:
void Load(ITypeManager* manager)
{
GUIREFLECTIONHELPERTYPES_TYPELIST(ADD_TYPE_INFO)
}
void Unload(ITypeManager* manager)
{
}
};
/***********************************************************************
GuiHelperTypesLoaderPlugin
***********************************************************************/
class GuiHelperTypesLoaderPlugin : public Object, public IGuiPlugin
{
public:
void Load()override
{
ITypeManager* manager=GetGlobalTypeManager();
if(manager)
{
Ptr<ITypeLoader> loader=new GuiHelperTypesLoader;
manager->AddTypeLoader(loader);
}
}
void AfterLoad()override
{
}
void Unload()override
{
}
};
GUI_REGISTER_PLUGIN(GuiHelperTypesLoaderPlugin)
}
#endif
}
/***********************************************************************
GuiInstanceLoader.cpp
***********************************************************************/
namespace vl
{
namespace presentation
{
using namespace collections;
using namespace parsing;
using namespace parsing::xml;
using namespace parsing::tabling;
using namespace controls;
using namespace regex;
using namespace reflection::description;
using namespace stream;
/***********************************************************************
GuiInstancePropertyInfo
***********************************************************************/
GuiInstancePropertyInfo::GuiInstancePropertyInfo()
:support(NotSupport)
, tryParent(false)
, required(false)
, constructorParameter(false)
{
}
GuiInstancePropertyInfo::~GuiInstancePropertyInfo()
{
}
Ptr<GuiInstancePropertyInfo> GuiInstancePropertyInfo::Unsupported()
{
return new GuiInstancePropertyInfo;
}
Ptr<GuiInstancePropertyInfo> GuiInstancePropertyInfo::Assign(description::ITypeDescriptor* typeDescriptor)
{
Ptr<GuiInstancePropertyInfo> info = new GuiInstancePropertyInfo;
info->support = SupportAssign;
if (typeDescriptor) info->acceptableTypes.Add(typeDescriptor);
return info;
}
Ptr<GuiInstancePropertyInfo> GuiInstancePropertyInfo::AssignWithParent(description::ITypeDescriptor* typeDescriptor)
{
Ptr<GuiInstancePropertyInfo> info = Assign(typeDescriptor);
info->tryParent = true;
return info;
}
Ptr<GuiInstancePropertyInfo> GuiInstancePropertyInfo::Collection(description::ITypeDescriptor* typeDescriptor)
{
Ptr<GuiInstancePropertyInfo> info = Assign(typeDescriptor);
info->support = SupportCollection;
return info;
}
Ptr<GuiInstancePropertyInfo> GuiInstancePropertyInfo::CollectionWithParent(description::ITypeDescriptor* typeDescriptor)
{
Ptr<GuiInstancePropertyInfo> info = Collection(typeDescriptor);
info->tryParent = true;
return info;
}
Ptr<GuiInstancePropertyInfo> GuiInstancePropertyInfo::Set(description::ITypeDescriptor* typeDescriptor)
{
Ptr<GuiInstancePropertyInfo> info = new GuiInstancePropertyInfo;
info->support = SupportSet;
if (typeDescriptor) info->acceptableTypes.Add(typeDescriptor);
return info;
}
Ptr<GuiInstancePropertyInfo> GuiInstancePropertyInfo::Array(description::ITypeDescriptor* typeDescriptor)
{
Ptr<GuiInstancePropertyInfo> info = new GuiInstancePropertyInfo;
info->support = SupportArray;
if (typeDescriptor) info->acceptableTypes.Add(typeDescriptor);
return info;
}
/***********************************************************************
GuiInstanceEventInfo
***********************************************************************/
GuiInstanceEventInfo::GuiInstanceEventInfo()
:support(NotSupport)
, argumentType(0)
{
}
GuiInstanceEventInfo::~GuiInstanceEventInfo()
{
}
Ptr<GuiInstanceEventInfo> GuiInstanceEventInfo::Unsupported()
{
return new GuiInstanceEventInfo;
}
Ptr<GuiInstanceEventInfo> GuiInstanceEventInfo::Assign(description::ITypeDescriptor* typeDescriptor)
{
Ptr<GuiInstanceEventInfo> info = new GuiInstanceEventInfo;
info->support = SupportAssign;
info->argumentType = typeDescriptor;
return info;
}
/***********************************************************************
IGuiInstanceLoader
***********************************************************************/
bool IGuiInstanceLoader::IsDeserializable(const TypeInfo& typeInfo)
{
return false;
}
description::Value IGuiInstanceLoader::Deserialize(const TypeInfo& typeInfo, const WString& text)
{
return Value();
}
bool IGuiInstanceLoader::IsCreatable(const TypeInfo& typeInfo)
{
return false;
}
description::Value IGuiInstanceLoader::CreateInstance(Ptr<GuiInstanceEnvironment> env, const TypeInfo& typeInfo, collections::Group<GlobalStringKey, description::Value>& constructorArguments)
{
return Value();
}
bool IGuiInstanceLoader::IsInitializable(const TypeInfo& typeInfo)
{
return false;
}
Ptr<GuiInstanceContextScope> IGuiInstanceLoader::InitializeInstance(const TypeInfo& typeInfo, description::Value instance)
{
return 0;
}
void IGuiInstanceLoader::GetPropertyNames(const TypeInfo& typeInfo, List<GlobalStringKey>& propertyNames)
{
}
void IGuiInstanceLoader::GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)
{
}
Ptr<GuiInstancePropertyInfo> IGuiInstanceLoader::GetPropertyType(const PropertyInfo& propertyInfo)
{
return 0;
}
bool IGuiInstanceLoader::GetPropertyValue(PropertyValue& propertyValue)
{
return false;
}
bool IGuiInstanceLoader::SetPropertyValue(PropertyValue& propertyValue)
{
return false;
}
void IGuiInstanceLoader::GetEventNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& eventNames)
{
}
Ptr<GuiInstanceEventInfo> IGuiInstanceLoader::GetEventType(const PropertyInfo& eventInfo)
{
return 0;
}
bool IGuiInstanceLoader::SetEventValue(PropertyValue& propertyValue)
{
return false;
}
/***********************************************************************
GuiInstanceContext::ElementName Parser
***********************************************************************/
class GuiInstanceContextElementNameParser : public Object, public IGuiParser<GuiInstanceContext::ElementName>
{
typedef GuiInstanceContext::ElementName ElementName;
public:
Regex regexElementName;
GuiInstanceContextElementNameParser()
:regexElementName(L"((<namespaceName>[a-zA-Z_]/w*):)?((<category>[a-zA-Z_]/w*).)?(<name>[a-zA-Z_]/w*)(-(<binding>[a-zA-Z_]/w*))?")
{
}
Ptr<ElementName> TypedParse(const WString& text, collections::List<WString>& errors)override
{
Ptr<RegexMatch> match = regexElementName.MatchHead(text);
if (!match || match->Result().Length() != text.Length())
{
errors.Add(L"Failed to parse an element name \"" + text + L"\".");
return 0;
}
Ptr<ElementName> elementName = new ElementName;
if (match->Groups().Keys().Contains(L"namespaceName"))
{
elementName->namespaceName = match->Groups()[L"namespaceName"][0].Value();
}
if (match->Groups().Keys().Contains(L"category"))
{
elementName->category = match->Groups()[L"category"][0].Value();
}
if (match->Groups().Keys().Contains(L"name"))
{
elementName->name = match->Groups()[L"name"][0].Value();
}
if (match->Groups().Keys().Contains(L"binding"))
{
elementName->binding = match->Groups()[L"binding"][0].Value();
}
return elementName;
}
};
/***********************************************************************
Instance Type Resolver
***********************************************************************/
class GuiResourceInstanceTypeResolver
: public Object
, public IGuiResourceTypeResolver
, private IGuiResourceTypeResolver_DirectLoadStream
, private IGuiResourceTypeResolver_IndirectLoad
{
public:
WString GetType()override
{
return L"Instance";
}
WString GetPreloadType()override
{
return L"Xml";
}
bool IsDelayLoad()override
{
return false;
}
void Precompile(Ptr<DescriptableObject> resource, Ptr<GuiResourcePathResolver> resolver, collections::List<WString>& errors)override
{
if (auto obj = resource.Cast<GuiInstanceContext>())
{
obj->ApplyStyles(resolver, errors);
Workflow_PrecompileInstanceContext(obj, errors);
}
}
IGuiResourceTypeResolver_DirectLoadStream* DirectLoadStream()override
{
return this;
}
IGuiResourceTypeResolver_IndirectLoad* IndirectLoad()override
{
return this;
}
void SerializePrecompiled(Ptr<DescriptableObject> resource, stream::IStream& stream)override
{
auto obj = resource.Cast<GuiInstanceContext>();
obj->SavePrecompiledBinary(stream);
}
Ptr<DescriptableObject> ResolveResourcePrecompiled(stream::IStream& stream, collections::List<WString>& errors)override
{
return GuiInstanceContext::LoadPrecompiledBinary(stream, errors);
}
Ptr<DescriptableObject> Serialize(Ptr<DescriptableObject> resource, bool serializePrecompiledResource)override
{
if (auto obj = resource.Cast<GuiInstanceContext>())
{
return obj->SaveToXml(serializePrecompiledResource);
}
return 0;
}
Ptr<DescriptableObject> ResolveResource(Ptr<DescriptableObject> resource, Ptr<GuiResourcePathResolver> resolver, collections::List<WString>& errors)override
{
Ptr<XmlDocument> xml = resource.Cast<XmlDocument>();
if (xml)
{
Ptr<GuiInstanceContext> context = GuiInstanceContext::LoadFromXml(xml, errors);
return context;
}
return 0;
}
};
/***********************************************************************
Instance Style Resolver
***********************************************************************/
class GuiResourceInstanceStyleResolver
: public Object
, public IGuiResourceTypeResolver
, private IGuiResourceTypeResolver_IndirectLoad
{
public:
WString GetType()override
{
return L"InstanceStyle";
}
WString GetPreloadType()override
{
return L"Xml";
}
bool IsDelayLoad()override
{
return false;
}
void Precompile(Ptr<DescriptableObject> resource, Ptr<GuiResourcePathResolver> resolver, collections::List<WString>& errors)override
{
}
IGuiResourceTypeResolver_IndirectLoad* IndirectLoad()override
{
return this;
}
Ptr<DescriptableObject> Serialize(Ptr<DescriptableObject> resource, bool serializePrecompiledResource)override
{
if (!serializePrecompiledResource)
{
if (auto obj = resource.Cast<GuiInstanceStyleContext>())
{
return obj->SaveToXml();
}
}
return 0;
}
Ptr<DescriptableObject> ResolveResource(Ptr<DescriptableObject> resource, Ptr<GuiResourcePathResolver> resolver, collections::List<WString>& errors)override
{
Ptr<XmlDocument> xml = resource.Cast<XmlDocument>();
if (xml)
{
Ptr<GuiInstanceStyleContext> context = GuiInstanceStyleContext::LoadFromXml(xml, errors);
return context;
}
return 0;
}
};
/***********************************************************************
Instance Schema Type Resolver
***********************************************************************/
class GuiResourceInstanceSchemaTypeResolver
: public Object
, public IGuiResourceTypeResolver
, private IGuiResourceTypeResolver_IndirectLoad
{
public:
WString GetType()override
{
return L"InstanceSchema";
}
WString GetPreloadType()override
{
return L"Xml";
}
bool IsDelayLoad()override
{
return false;
}
void Precompile(Ptr<DescriptableObject> resource, Ptr<GuiResourcePathResolver> resolver, collections::List<WString>& errors)override
{
}
IGuiResourceTypeResolver_IndirectLoad* IndirectLoad()override
{
return this;
}
Ptr<DescriptableObject> Serialize(Ptr<DescriptableObject> resource, bool serializePrecompiledResource)override
{
if (!serializePrecompiledResource)
{
if (auto obj = resource.Cast<GuiInstanceSchema>())
{
return obj->SaveToXml();
}
}
return 0;
}
Ptr<DescriptableObject> ResolveResource(Ptr<DescriptableObject> resource, Ptr<GuiResourcePathResolver> resolver, collections::List<WString>& errors)override
{
Ptr<XmlDocument> xml = resource.Cast<XmlDocument>();
if (xml)
{
Ptr<GuiInstanceSchema> schema = GuiInstanceSchema::LoadFromXml(xml, errors);
return schema;
}
return 0;
}
};
/***********************************************************************
GuiDefaultInstanceLoader
***********************************************************************/
class GuiDefaultInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
typedef Tuple<ITypeDescriptor*, GlobalStringKey> FieldKey;
typedef Tuple<Ptr<GuiInstancePropertyInfo>, IPropertyInfo*> PropertyType;
typedef Tuple<Ptr<GuiInstanceEventInfo>, IEventInfo*> EventType;
Dictionary<FieldKey, PropertyType> propertyTypes;
Dictionary<FieldKey, EventType> eventTypes;
public:
static IMethodInfo* GetDefaultConstructor(ITypeDescriptor* typeDescriptor)
{
if (auto ctors = typeDescriptor->GetConstructorGroup())
{
vint count = ctors->GetMethodCount();
for (vint i = 0; i < count; i++)
{
IMethodInfo* method = ctors->GetMethod(i);
if (method->GetParameterCount() == 0)
{
return method;
}
}
}
return 0;
}
GlobalStringKey GetTypeName()override
{
return GlobalStringKey::Empty;
}
//***********************************************************************************
bool IsDeserializable(const TypeInfo& typeInfo)override
{
return typeInfo.typeDescriptor->GetValueSerializer() != 0;
}
description::Value Deserialize(const TypeInfo& typeInfo, const WString& text)override
{
if (IValueSerializer* serializer = typeInfo.typeDescriptor->GetValueSerializer())
{
Value loadedValue;
if (serializer->Parse(text, loadedValue))
{
return loadedValue;
}
}
return Value();
}
bool IsCreatable(const TypeInfo& typeInfo)override
{
return GetDefaultConstructor(typeInfo.typeDescriptor) != 0;
}
description::Value CreateInstance(Ptr<GuiInstanceEnvironment> env, const TypeInfo& typeInfo, collections::Group<GlobalStringKey, description::Value>& constructorArguments)override
{
if (IMethodInfo* method = GetDefaultConstructor(typeInfo.typeDescriptor))
{
return method->Invoke(Value(), (Value_xs()));
}
else
{
env->scope->errors.Add(L"Failed to create \"" + typeInfo.typeName.ToString() + L"\" because no there is no default constructor.");
return Value();
}
}
bool IsInitializable(const TypeInfo& typeInfo)override
{
return false;
}
Ptr<GuiInstanceContextScope> InitializeInstance(const TypeInfo& typeInfo, description::Value instance)override
{
return 0;
}
//***********************************************************************************
void ProcessGenericType(ITypeInfo* propType, ITypeInfo*& genericType, ITypeInfo*& elementType, bool& readableList, bool& writableList, bool& collectionType)
{
genericType = 0;
elementType = 0;
readableList = false;
writableList = false;
collectionType = false;
if (propType->GetDecorator() == ITypeInfo::SharedPtr && propType->GetElementType()->GetDecorator() == ITypeInfo::Generic)
{
propType = propType->GetElementType();
genericType = propType->GetElementType();
if (genericType->GetTypeDescriptor() == description::GetTypeDescriptor<IValueList>())
{
elementType = propType->GetGenericArgument(0);
readableList = true;
writableList = true;
collectionType = true;
}
else if (genericType->GetTypeDescriptor() == description::GetTypeDescriptor<IValueEnumerator>())
{
collectionType = true;
}
else if (genericType->GetTypeDescriptor() == description::GetTypeDescriptor<IValueEnumerable>())
{
elementType = propType->GetGenericArgument(0);
readableList = true;
collectionType = true;
}
else if (genericType->GetTypeDescriptor() == description::GetTypeDescriptor<IValueReadonlyList>())
{
elementType = propType->GetGenericArgument(0);
readableList = true;
collectionType = true;
}
else if (genericType->GetTypeDescriptor() == description::GetTypeDescriptor<IValueReadonlyDictionary>())
{
collectionType = true;
}
else if (genericType->GetTypeDescriptor() == description::GetTypeDescriptor<IValueDictionary>())
{
collectionType = true;
}
}
}
ITypeInfo* GetPropertyReflectionTypeInfo(const PropertyInfo& propertyInfo, GuiInstancePropertyInfo::Support& support)
{
support = GuiInstancePropertyInfo::NotSupport;
IPropertyInfo* prop = propertyInfo.typeInfo.typeDescriptor->GetPropertyByName(propertyInfo.propertyName.ToString(), true);
if (prop)
{
ITypeInfo* propType = prop->GetReturn();
ITypeInfo* genericType = 0;
ITypeInfo* elementType = 0;
bool readableList = false;
bool writableList = false;
bool collectionType = false;
ProcessGenericType(propType, genericType, elementType, readableList, writableList, collectionType);
if (prop->IsWritable())
{
if (collectionType)
{
if (readableList)
{
support = GuiInstancePropertyInfo::SupportArray;
return elementType;
}
}
else if (genericType)
{
support = GuiInstancePropertyInfo::SupportAssign;
return genericType;
}
else
{
support = GuiInstancePropertyInfo::SupportAssign;
return propType;
}
}
else if (prop->IsReadable())
{
if (collectionType)
{
if (writableList)
{
support = GuiInstancePropertyInfo::SupportCollection;
return elementType;
}
}
else if (!genericType)
{
if (propType->GetDecorator() == ITypeInfo::SharedPtr || propType->GetDecorator() == ITypeInfo::RawPtr)
{
support = GuiInstancePropertyInfo::SupportSet;
return propType;
}
}
}
}
return 0;
}
bool FillPropertyInfo(Ptr<GuiInstancePropertyInfo> propertyInfo, ITypeInfo* propType)
{
switch (propType->GetDecorator())
{
case ITypeInfo::RawPtr:
case ITypeInfo::SharedPtr:
case ITypeInfo::Nullable:
FillPropertyInfo(propertyInfo, propType->GetElementType());
return true;
case ITypeInfo::TypeDescriptor:
propertyInfo->acceptableTypes.Add(propType->GetTypeDescriptor());
return true;
default:;
}
return false;
}
void CollectPropertyNames(const TypeInfo& typeInfo, ITypeDescriptor* typeDescriptor, collections::List<GlobalStringKey>& propertyNames)
{
vint propertyCount = typeDescriptor->GetPropertyCount();
for (vint i = 0; i < propertyCount; i++)
{
GlobalStringKey propertyName = GlobalStringKey::Get(typeDescriptor->GetProperty(i)->GetName());
if (!propertyNames.Contains(propertyName))
{
auto info = GetPropertyType(PropertyInfo(typeInfo, propertyName));
if (info && info->support != GuiInstancePropertyInfo::NotSupport)
{
propertyNames.Add(propertyName);
}
}
}
vint parentCount = typeDescriptor->GetBaseTypeDescriptorCount();
for (vint i = 0; i < parentCount; i++)
{
CollectPropertyNames(typeInfo, typeDescriptor->GetBaseTypeDescriptor(i), propertyNames);
}
}
//***********************************************************************************
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
CollectPropertyNames(typeInfo, typeInfo.typeDescriptor, propertyNames);
}
void GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
}
PropertyType GetPropertyTypeCached(const PropertyInfo& propertyInfo)
{
FieldKey key(propertyInfo.typeInfo.typeDescriptor, propertyInfo.propertyName);
vint index = propertyTypes.Keys().IndexOf(key);
if (index == -1)
{
GuiInstancePropertyInfo::Support support = GuiInstancePropertyInfo::NotSupport;
if (ITypeInfo* propType = GetPropertyReflectionTypeInfo(propertyInfo, support))
{
Ptr<GuiInstancePropertyInfo> result = new GuiInstancePropertyInfo;
result->support = support;
if (FillPropertyInfo(result, propType))
{
IPropertyInfo* prop = propertyInfo.typeInfo.typeDescriptor->GetPropertyByName(propertyInfo.propertyName.ToString(), true);
PropertyType value(result, prop);
propertyTypes.Add(key, value);
return value;
}
}
PropertyType value(GuiInstancePropertyInfo::Unsupported(), 0);
propertyTypes.Add(key, value);
return value;
}
else
{
return propertyTypes.Values()[index];
}
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
return GetPropertyTypeCached(propertyInfo).f0;
}
bool GetPropertyValue(PropertyValue& propertyValue)override
{
if (IPropertyInfo* prop = GetPropertyTypeCached(propertyValue).f1)
{
if (prop->IsReadable())
{
propertyValue.propertyValue = prop->GetValue(propertyValue.instanceValue);
return true;
}
}
return false;
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
PropertyType propertyType = GetPropertyTypeCached(propertyValue);
if (propertyType.f1)
{
switch (propertyType.f0->support)
{
case GuiInstancePropertyInfo::SupportCollection:
{
Value value = propertyType.f1->GetValue(propertyValue.instanceValue);
if (auto list = dynamic_cast<IValueList*>(value.GetRawPtr()))
{
list->Add(propertyValue.propertyValue);
return true;
}
}
break;
case GuiInstancePropertyInfo::SupportAssign:
case GuiInstancePropertyInfo::SupportArray:
propertyValue.instanceValue.SetProperty(propertyValue.propertyName.ToString(), propertyValue.propertyValue);
propertyType.f1->SetValue(propertyValue.instanceValue, propertyValue.propertyValue);
return true;
default:;
}
}
return false;
}
//***********************************************************************************
void CollectEventNames(const TypeInfo& typeInfo, ITypeDescriptor* typeDescriptor, collections::List<GlobalStringKey>& eventNames)
{
vint eventCount = typeDescriptor->GetEventCount();
for (vint i = 0; i < eventCount; i++)
{
GlobalStringKey eventName = GlobalStringKey::Get(typeDescriptor->GetEvent(i)->GetName());
if (!eventNames.Contains(eventName))
{
auto info = GetEventType(PropertyInfo(typeInfo, eventName));
if (info && info->support != GuiInstanceEventInfo::NotSupport)
{
eventNames.Add(eventName);
}
}
}
vint parentCount = typeDescriptor->GetBaseTypeDescriptorCount();
for (vint i = 0; i < parentCount; i++)
{
CollectEventNames(typeInfo, typeDescriptor->GetBaseTypeDescriptor(i), eventNames);
}
}
//***********************************************************************************
void GetEventNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& eventNames)override
{
CollectEventNames(typeInfo, typeInfo.typeDescriptor, eventNames);
}
EventType GetEventTypeCached(const PropertyInfo& eventInfo)
{
FieldKey key(eventInfo.typeInfo.typeDescriptor, eventInfo.propertyName);
vint index = eventTypes.Keys().IndexOf(key);
if (index == -1)
{
if (IEventInfo* ev = eventInfo.typeInfo.typeDescriptor->GetEventByName(eventInfo.propertyName.ToString(), true))
{
#ifndef VCZH_DEBUG_NO_REFLECTION
ITypeInfo *handlerType = 0,
*genericType = 0,
*functionType = 0,
*returnType = 0,
*senderType = 0,
*argumentType = 0;
handlerType = ev->GetHandlerType();
if (handlerType->GetDecorator() != ITypeInfo::SharedPtr) goto UNSUPPORTED;
genericType = handlerType->GetElementType();
if (genericType->GetDecorator() != ITypeInfo::Generic) goto UNSUPPORTED;
functionType = genericType->GetElementType();
if (functionType->GetDecorator() != ITypeInfo::TypeDescriptor) goto UNSUPPORTED;
if (functionType->GetTypeDescriptor() != description::GetTypeDescriptor<IValueFunctionProxy>()) goto UNSUPPORTED;
if (genericType->GetGenericArgumentCount() != 3) goto UNSUPPORTED;
returnType = genericType->GetGenericArgument(0);
senderType = genericType->GetGenericArgument(1);
argumentType = genericType->GetGenericArgument(2);
if (returnType->GetDecorator() != ITypeInfo::TypeDescriptor) goto UNSUPPORTED;
if (returnType->GetTypeDescriptor() != description::GetTypeDescriptor<VoidValue>()) goto UNSUPPORTED;
if (senderType->GetDecorator() != ITypeInfo::RawPtr) goto UNSUPPORTED;
senderType = senderType->GetElementType();
if (senderType->GetDecorator() != ITypeInfo::TypeDescriptor) goto UNSUPPORTED;
if (senderType->GetTypeDescriptor() != description::GetTypeDescriptor<compositions::GuiGraphicsComposition>()) goto UNSUPPORTED;
if (argumentType->GetDecorator() != ITypeInfo::RawPtr) goto UNSUPPORTED;
argumentType = argumentType->GetElementType();
if (argumentType->GetDecorator() != ITypeInfo::TypeDescriptor) goto UNSUPPORTED;
if (!argumentType->GetTypeDescriptor()->CanConvertTo(description::GetTypeDescriptor<compositions::GuiEventArgs>())) goto UNSUPPORTED;
{
auto result = GuiInstanceEventInfo::Assign(argumentType->GetTypeDescriptor());
EventType value(result, ev);
eventTypes.Add(key, value);
return value;
}
UNSUPPORTED:
{
auto result = GuiInstanceEventInfo::Unsupported();
EventType value(result, ev);
eventTypes.Add(key, value);
return value;
}
#endif
}
EventType value(0, 0);
eventTypes.Add(key, value);
return value;
}
else
{
return eventTypes.Values()[index];
}
}
Ptr<GuiInstanceEventInfo> GetEventType(const PropertyInfo& eventInfo)override
{
return GetEventTypeCached(eventInfo).f0;
}
bool SetEventValue(PropertyValue& propertyValue)override
{
EventType eventType = GetEventTypeCached(propertyValue);
if (eventType.f0 && eventType.f0->support == GuiInstanceEventInfo::SupportAssign)
{
Ptr<IValueFunctionProxy> proxy=UnboxValue<Ptr<IValueFunctionProxy>>(propertyValue.propertyValue, Description<IValueFunctionProxy>::GetAssociatedTypeDescriptor(), L"function");
eventType.f1->Attach(propertyValue.instanceValue, proxy);
return true;
}
return false;
}
};
/***********************************************************************
GuiResourceInstanceLoader
***********************************************************************/
class GuiResourceInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
Ptr<GuiResource> resource;
Ptr<GuiInstanceContext> context;
GlobalStringKey contextClassName;
void InitializeContext(Ptr<GuiResourcePathResolver> resolver, List<WString>& errors)
{
context->ApplyStyles(resolver, errors);
}
public:
GuiResourceInstanceLoader(Ptr<GuiResource> _resource, Ptr<GuiInstanceContext> _context)
:resource(_resource)
, context(_context)
{
if (context->className)
{
contextClassName = GlobalStringKey::Get(context->className.Value());
}
}
GlobalStringKey GetTypeName()override
{
return contextClassName;
}
bool IsCreatable(const TypeInfo& typeInfo)override
{
return typeInfo.typeName == contextClassName;
}
description::Value CreateInstance(Ptr<GuiInstanceEnvironment> env, const TypeInfo& typeInfo, collections::Group<GlobalStringKey, description::Value>& constructorArguments)override
{
if (typeInfo.typeName == contextClassName)
{
if (auto typeDescriptor = GetGlobalTypeManager()->GetTypeDescriptor(typeInfo.typeName.ToString()))
{
InitializeContext(env->resolver, env->scope->errors);
SortedList<GlobalStringKey> argumentNames;
{
List<GlobalStringKey> names;
GetConstructorParameters(typeInfo, names);
CopyFrom(argumentNames, names);
}
auto group = typeDescriptor->GetConstructorGroup();
for (vint i = 0; i < group->GetMethodCount(); i++)
{
auto method = group->GetMethod(i);
List<GlobalStringKey> parameterNames;
for (vint j = 0; j < method->GetParameterCount(); j++)
{
parameterNames.Add(GlobalStringKey::Get(method->GetParameter(j)->GetName()));
}
auto f = [](GlobalStringKey a, GlobalStringKey b){return GlobalStringKey::Compare(a, b); };
if (CompareEnumerable(argumentNames, From(parameterNames).OrderBy(f)) == 0)
{
Array<Value> arguments(constructorArguments.Count());
for (vint j = 0; j < arguments.Count(); j++)
{
arguments[j] = constructorArguments[parameterNames[j]][0];
}
Value result = method->Invoke(Value(), arguments);
if (auto partialClass = dynamic_cast<IGuiInstancePartialClass*>(result.GetRawPtr()))
{
if (auto partialScope = partialClass->GetScope())
{
CopyFrom(env->scope->errors, partialScope->errors, true);
}
}
return result;
}
}
}
Ptr<GuiResourcePathResolver> resolver = new GuiResourcePathResolver(resource, resource->GetWorkingDirectory());
auto scope = LoadInstanceFromContext(context, resolver);
if (scope)
{
CopyFrom(env->scope->errors, scope->errors, true);
return scope->rootInstance;
}
}
return Value();
}
bool IsInitializable(const TypeInfo& typeInfo)override
{
return typeInfo.typeName == contextClassName;
}
Ptr<GuiInstanceContextScope> InitializeInstance(const TypeInfo& typeInfo, description::Value instance)override
{
if (typeInfo.typeName == contextClassName)
{
Ptr<GuiResourcePathResolver> resolver = new GuiResourcePathResolver(resource, resource->GetWorkingDirectory());
List<WString> errors;
InitializeContext(resolver, errors);
auto scope = InitializeInstanceFromContext(context, resolver, instance);
if (scope)
{
for (vint i = 0; i < errors.Count(); i++)
{
scope->errors.Insert(i, errors[i]);
}
}
return scope;
}
return 0;
}
void GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)
{
if (typeInfo.typeName == contextClassName)
{
FOREACH(Ptr<GuiInstanceParameter>, parameter, context->parameters)
{
if (description::GetTypeDescriptor(parameter->className.ToString()))
{
propertyNames.Add(parameter->name);
}
}
}
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)
{
if (propertyInfo.typeInfo.typeName == contextClassName)
{
FOREACH(Ptr<GuiInstanceParameter>, parameter, context->parameters)
{
if (parameter->name == propertyInfo.propertyName)
{
if (auto td = description::GetTypeDescriptor(parameter->className.ToString()))
{
auto info = GuiInstancePropertyInfo::Assign(td);
info->required = true;
info->constructorParameter = true;
return info;
}
}
}
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
};
/***********************************************************************
GuiInstanceLoaderManager
***********************************************************************/
IGuiInstanceLoaderManager* instanceLoaderManager = 0;
IGuiInstanceLoaderManager* GetInstanceLoaderManager()
{
return instanceLoaderManager;
}
class GuiInstanceLoaderManager : public Object, public IGuiInstanceLoaderManager, public IGuiPlugin
{
protected:
typedef Dictionary<GlobalStringKey, Ptr<IGuiInstanceBinder>> BinderMap;
typedef Dictionary<GlobalStringKey, Ptr<IGuiInstanceEventBinder>> EventBinderMap;
typedef Dictionary<GlobalStringKey, Ptr<IGuiInstanceBindingContextFactory>> BindingContextFactoryMap;
typedef Dictionary<GlobalStringKey, Ptr<IGuiInstanceCacheResolver>> CacheResolverMap;
struct VirtualTypeInfo
{
GlobalStringKey typeName;
ITypeDescriptor* typeDescriptor;
GlobalStringKey parentTypeName; // for virtual type only
Ptr<IGuiInstanceLoader> loader;
List<ITypeDescriptor*> parentTypes; // all direct or indirect base types that does not has a type info
List<VirtualTypeInfo*> parentTypeInfos; // type infos for all registered direct or indirect base types
VirtualTypeInfo()
:typeDescriptor(0)
{
}
};
typedef Dictionary<GlobalStringKey, Ptr<VirtualTypeInfo>> VirtualTypeInfoMap;
typedef Dictionary<WString, Ptr<GuiResource>> ResourceMap;
Ptr<IGuiInstanceLoader> rootLoader;
BinderMap binders;
EventBinderMap eventBinders;
BindingContextFactoryMap bindingContextFactories;
CacheResolverMap cacheResolvers;
VirtualTypeInfoMap typeInfos;
ResourceMap resources;
bool IsTypeExists(GlobalStringKey name)
{
return GetGlobalTypeManager()->GetTypeDescriptor(name.ToString()) != 0 || typeInfos.Keys().Contains(name);
}
void FindParentTypeInfos(Ptr<VirtualTypeInfo> typeInfo, ITypeDescriptor* searchType)
{
if (searchType != typeInfo->typeDescriptor)
{
vint index = typeInfos.Keys().IndexOf(GlobalStringKey::Get(searchType->GetTypeName()));
if (index == -1)
{
typeInfo->parentTypes.Add(searchType);
}
else
{
typeInfo->parentTypeInfos.Add(typeInfos.Values()[index].Obj());
return;
}
}
vint count = searchType->GetBaseTypeDescriptorCount();
for (vint i = 0; i < count; i++)
{
ITypeDescriptor* baseType = searchType->GetBaseTypeDescriptor(i);
FindParentTypeInfos(typeInfo, baseType);
}
}
void FillParentTypeInfos(Ptr<VirtualTypeInfo> typeInfo)
{
typeInfo->parentTypes.Clear();
typeInfo->parentTypeInfos.Clear();
ITypeDescriptor* searchType = typeInfo->typeDescriptor;
if (!searchType)
{
vint index = typeInfos.Keys().IndexOf(typeInfo->parentTypeName);
if (index == -1)
{
searchType = GetGlobalTypeManager()->GetTypeDescriptor(typeInfo->parentTypeName.ToString());
typeInfo->typeDescriptor = searchType;
typeInfo->parentTypes.Add(searchType);
}
else
{
VirtualTypeInfo* parentTypeInfo = typeInfos.Values()[index].Obj();
typeInfo->typeDescriptor = parentTypeInfo->typeDescriptor;
typeInfo->parentTypeInfos.Add(parentTypeInfo);
return;
}
}
if (searchType)
{
FindParentTypeInfos(typeInfo, searchType);
}
}
IGuiInstanceLoader* GetLoaderFromType(ITypeDescriptor* typeDescriptor)
{
vint index = typeInfos.Keys().IndexOf(GlobalStringKey::Get(typeDescriptor->GetTypeName()));
if (index == -1)
{
vint count = typeDescriptor->GetBaseTypeDescriptorCount();
for (vint i = 0; i < count; i++)
{
ITypeDescriptor* baseType = typeDescriptor->GetBaseTypeDescriptor(i);
IGuiInstanceLoader* loader = GetLoaderFromType(baseType);
if (loader) return loader;
}
return 0;
}
else
{
return typeInfos.Values()[index]->loader.Obj();
}
}
void GetClassesInResource(Ptr<GuiResourceFolder> folder, Dictionary<GlobalStringKey, Ptr<GuiInstanceContext>>& classes)
{
FOREACH(Ptr<GuiResourceItem>, item, folder->GetItems())
{
if (auto context = item->GetContent().Cast<GuiInstanceContext>())
{
if (context->className)
{
auto contextClassName = GlobalStringKey::Get(context->className.Value());
if (!classes.Keys().Contains(contextClassName))
{
classes.Add(contextClassName, context);
}
}
}
}
FOREACH(Ptr<GuiResourceFolder>, subFolder, folder->GetFolders())
{
GetClassesInResource(subFolder, classes);
}
}
public:
GuiInstanceLoaderManager()
{
rootLoader = new GuiDefaultInstanceLoader;
}
void Load()override
{
instanceLoaderManager = this;
}
void AfterLoad()override
{
{
IGuiResourceResolverManager* manager = GetResourceResolverManager();
manager->SetTypeResolver(new GuiResourceInstanceTypeResolver);
manager->SetTypeResolver(new GuiResourceInstanceStyleResolver);
manager->SetTypeResolver(new GuiResourceInstanceSchemaTypeResolver);
}
{
IGuiParserManager* manager = GetParserManager();
manager->SetParser(L"INSTANCE-ELEMENT-NAME", new GuiInstanceContextElementNameParser);
}
}
void Unload()override
{
instanceLoaderManager = 0;
}
bool AddInstanceBindingContextFactory(Ptr<IGuiInstanceBindingContextFactory> factory)override
{
if (bindingContextFactories.Keys().Contains(factory->GetContextName())) return false;
bindingContextFactories.Add(factory->GetContextName(), factory);
return true;
}
IGuiInstanceBindingContextFactory* GetInstanceBindingContextFactory(GlobalStringKey contextName)override
{
vint index = bindingContextFactories.Keys().IndexOf(contextName);
return index == -1 ? 0 : bindingContextFactories.Values()[index].Obj();
}
bool AddInstanceBinder(Ptr<IGuiInstanceBinder> binder)override
{
if (binders.Keys().Contains(binder->GetBindingName())) return false;
binders.Add(binder->GetBindingName(), binder);
return true;
}
IGuiInstanceBinder* GetInstanceBinder(GlobalStringKey bindingName)override
{
vint index = binders.Keys().IndexOf(bindingName);
return index == -1 ? 0 : binders.Values()[index].Obj();
}
bool AddInstanceEventBinder(Ptr<IGuiInstanceEventBinder> binder)override
{
if (eventBinders.Keys().Contains(binder->GetBindingName())) return false;
eventBinders.Add(binder->GetBindingName(), binder);
return true;
}
IGuiInstanceEventBinder* GetInstanceEventBinder(GlobalStringKey bindingName)override
{
vint index = eventBinders.Keys().IndexOf(bindingName);
return index == -1 ? 0 : eventBinders.Values()[index].Obj();
}
bool AddInstanceCacheResolver(Ptr<IGuiInstanceCacheResolver> cacheResolver)override
{
if (cacheResolvers.Keys().Contains(cacheResolver->GetCacheTypeName())) return false;
cacheResolvers.Add(cacheResolver->GetCacheTypeName(), cacheResolver);
return true;
}
IGuiInstanceCacheResolver* GetInstanceCacheResolver(GlobalStringKey cacheTypeName)override
{
vint index = cacheResolvers.Keys().IndexOf(cacheTypeName);
return index == -1 ? 0 : cacheResolvers.Values()[index].Obj();
}
bool CreateVirtualType(GlobalStringKey parentType, Ptr<IGuiInstanceLoader> loader)override
{
if (IsTypeExists(loader->GetTypeName()) || !IsTypeExists(parentType)) return false;
Ptr<VirtualTypeInfo> typeInfo = new VirtualTypeInfo;
typeInfo->typeName = loader->GetTypeName();
typeInfo->parentTypeName = parentType;
typeInfo->loader = loader;
typeInfos.Add(loader->GetTypeName(), typeInfo);
FillParentTypeInfos(typeInfo);
return true;
}
bool SetLoader(Ptr<IGuiInstanceLoader> loader)override
{
vint index = typeInfos.Keys().IndexOf(loader->GetTypeName());
if (index != -1) return false;
ITypeDescriptor* typeDescriptor = GetGlobalTypeManager()->GetTypeDescriptor(loader->GetTypeName().ToString());
if (typeDescriptor == 0) return false;
Ptr<VirtualTypeInfo> typeInfo = new VirtualTypeInfo;
typeInfo->typeName = loader->GetTypeName();
typeInfo->typeDescriptor = typeDescriptor;
typeInfo->loader = loader;
typeInfos.Add(typeInfo->typeName, typeInfo);
FillParentTypeInfos(typeInfo);
FOREACH(Ptr<VirtualTypeInfo>, derived, typeInfos.Values())
{
if (derived->parentTypes.Contains(typeInfo->typeDescriptor))
{
FillParentTypeInfos(derived);
}
}
return true;
}
IGuiInstanceLoader* GetLoader(GlobalStringKey typeName)override
{
vint index = typeInfos.Keys().IndexOf(typeName);
if (index != -1)
{
return typeInfos.Values()[index]->loader.Obj();
}
ITypeDescriptor* typeDescriptor = GetGlobalTypeManager()->GetTypeDescriptor(typeName.ToString());
if (typeDescriptor)
{
IGuiInstanceLoader* loader = GetLoaderFromType(typeDescriptor);
return loader ? loader : rootLoader.Obj();
}
return 0;
}
IGuiInstanceLoader* GetParentLoader(IGuiInstanceLoader* loader)override
{
vint index = typeInfos.Keys().IndexOf(loader->GetTypeName());
if (index != -1)
{
Ptr<VirtualTypeInfo> typeInfo = typeInfos.Values()[index];
if (typeInfo->parentTypeInfos.Count() > 0)
{
return typeInfo->parentTypeInfos[0]->loader.Obj();
}
return rootLoader.Obj();
}
return 0;
}
description::ITypeDescriptor* GetTypeDescriptorForType(GlobalStringKey typeName)override
{
vint index = typeInfos.Keys().IndexOf(typeName);
return index == -1
? GetGlobalTypeManager()->GetTypeDescriptor(typeName.ToString())
: typeInfos.Values()[index]->typeDescriptor;
}
void GetVirtualTypes(collections::List<GlobalStringKey>& typeNames)override
{
for (vint i = 0; i < typeInfos.Count(); i++)
{
if (typeInfos.Values()[i]->parentTypeName != GlobalStringKey::Empty)
{
typeNames.Add(typeInfos.Keys()[i]);
}
}
}
GlobalStringKey GetParentTypeForVirtualType(GlobalStringKey virtualType)override
{
vint index = typeInfos.Keys().IndexOf(virtualType);
if (index != -1)
{
auto typeInfo = typeInfos.Values()[index];
return typeInfo->parentTypeName;
}
return GlobalStringKey::Empty;
}
bool SetResource(const WString& name, Ptr<GuiResource> resource)override
{
vint index = resources.Keys().IndexOf(name);
if (index != -1) return false;
Ptr<GuiResourcePathResolver> resolver = new GuiResourcePathResolver(resource, resource->GetWorkingDirectory());
Dictionary<GlobalStringKey, Ptr<GuiInstanceContext>> classes;
Dictionary<GlobalStringKey, GlobalStringKey> parentTypes;
GetClassesInResource(resource, classes);
FOREACH(Ptr<GuiInstanceContext>, context, classes.Values())
{
auto contextClassName = GlobalStringKey::Get(context->className.Value());
if (typeInfos.Keys().Contains(contextClassName))
{
return false;
}
Ptr<GuiInstanceEnvironment> env = new GuiInstanceEnvironment(context, resolver);
auto loadingSource = FindInstanceLoadingSource(env->context, context->instance.Obj());
if (loadingSource.loader)
{
parentTypes.Add(contextClassName, loadingSource.typeName);
}
}
FOREACH(GlobalStringKey, className, classes.Keys())
{
auto context = classes[className];
vint index = parentTypes.Keys().IndexOf(className);
if (index == -1) continue;
auto parentType = parentTypes.Values()[index];
Ptr<IGuiInstanceLoader> loader = new GuiResourceInstanceLoader(resource, context);
if (GetGlobalTypeManager()->GetTypeDescriptor(context->className.Value()))
{
SetLoader(loader);
}
else
{
CreateVirtualType(parentType, loader);
}
}
resources.Add(name, resource);
return true;
}
Ptr<GuiResource> GetResource(const WString& name)override
{
vint index = resources.Keys().IndexOf(name);
return index == -1 ? nullptr : resources.Values()[index];
}
};
GUI_REGISTER_PLUGIN(GuiInstanceLoaderManager)
}
}
/***********************************************************************
GuiInstanceLoader_LoadInstance.cpp
***********************************************************************/
namespace vl
{
namespace presentation
{
using namespace collections;
using namespace reflection::description;
/***********************************************************************
Helper Functions Declarations
***********************************************************************/
struct FillInstanceBindingSetter
{
IGuiInstanceBinder* binder;
IGuiInstanceLoader* loader;
GuiAttSetterRepr* bindingTarget;
IGuiInstanceLoader::PropertyValue propertyValue;
FillInstanceBindingSetter()
:binder(0)
, loader(0)
, bindingTarget(0)
{
}
};
struct FillInstanceEventSetter
{
IGuiInstanceEventBinder* binder;
IGuiInstanceLoader* loader;
GuiAttSetterRepr* bindingTarget;
Ptr<GuiInstanceEventInfo> eventInfo;
IGuiInstanceLoader::PropertyValue propertyValue;
WString handlerName;
FillInstanceEventSetter()
:binder(0)
, loader(0)
, bindingTarget(0)
{
}
};
bool LoadInstancePropertyValue(
Ptr<GuiInstanceEnvironment> env,
GuiAttSetterRepr* attSetter,
GlobalStringKey binding,
IGuiInstanceLoader::PropertyValue propertyValue,
List<Ptr<GuiValueRepr>>& input,
IGuiInstanceLoader* propertyLoader,
bool constructorArgument,
List<Pair<Value, IGuiInstanceLoader*>>& output,
List<FillInstanceBindingSetter>& bindingSetters,
List<FillInstanceEventSetter>& eventSetters
);
void FillInstance(
description::Value createdInstance,
Ptr<GuiInstanceEnvironment> env,
GuiAttSetterRepr* attSetter,
IGuiInstanceLoader* loader,
bool skipDefaultProperty,
GlobalStringKey typeName,
List<FillInstanceBindingSetter>& bindingSetters,
List<FillInstanceEventSetter>& eventSetters
);
description::Value CreateInstance(
Ptr<GuiInstanceEnvironment> env,
GuiConstructorRepr* ctor,
description::ITypeDescriptor* expectedType,
GlobalStringKey& typeName,
List<FillInstanceBindingSetter>& bindingSetters,
List<FillInstanceEventSetter>& eventSetters,
bool isRootInstance
);
void ExecuteParameters(
Ptr<GuiInstanceEnvironment> env
);
bool PrepareBindingContext(
Ptr<GuiInstanceEnvironment> env,
collections::List<GlobalStringKey>& contextNames,
const WString& dependerType,
const GlobalStringKey& dependerName
);
void ExecuteBindingSetters(
Ptr<GuiInstanceEnvironment> env,
List<FillInstanceBindingSetter>& bindingSetters
);
void ExecuteEventSetters(
description::Value createdInstance,
Ptr<GuiInstanceEnvironment> env,
List<FillInstanceEventSetter>& eventSetters
);
void InitializeInstanceFromConstructor(
Ptr<GuiInstanceEnvironment> env,
GuiConstructorRepr* ctor,
IGuiInstanceLoader* instanceLoader,
GlobalStringKey typeName,
description::Value instance,
bool deserialized,
List<FillInstanceBindingSetter>& bindingSetters,
List<FillInstanceEventSetter>& eventSetters
);
namespace visitors
{
/***********************************************************************
LoadValueVisitor
***********************************************************************/
class LoadValueVisitor : public Object, public GuiValueRepr::IVisitor
{
public:
Ptr<GuiInstanceEnvironment> env;
List<ITypeDescriptor*>& acceptableTypes;
List<FillInstanceBindingSetter>& bindingSetters;
List<FillInstanceEventSetter>& eventSetters;
bool result;
Value loadedValue;
LoadValueVisitor(Ptr<GuiInstanceEnvironment> _env, List<ITypeDescriptor*>& _acceptableTypes, List<FillInstanceBindingSetter>& _bindingSetters, List<FillInstanceEventSetter>& _eventSetters)
:env(_env)
, acceptableTypes(_acceptableTypes)
, bindingSetters(_bindingSetters)
, eventSetters(_eventSetters)
, result(false)
{
}
void Visit(GuiTextRepr* repr)override
{
FOREACH(ITypeDescriptor*, typeDescriptor, acceptableTypes)
{
if (IValueSerializer* serializer = typeDescriptor->GetValueSerializer())
{
if (serializer->Parse(repr->text, loadedValue))
{
result = true;
return;
}
}
}
FOREACH(ITypeDescriptor*, typeDescriptor, acceptableTypes)
{
env->scope->errors.Add(
L"Failed to deserialize object of type \"" +
typeDescriptor->GetTypeName() +
L"\" from string \"" +
repr->text +
L"\".");
}
}
void Visit(GuiAttSetterRepr* repr)override
{
}
void Visit(GuiConstructorRepr* repr)override
{
vint errorCount = env->scope->errors.Count();
FOREACH(ITypeDescriptor*, typeDescriptor, acceptableTypes)
{
GlobalStringKey _typeName;
loadedValue = CreateInstance(env, repr, typeDescriptor, _typeName, bindingSetters, eventSetters, false);
if (!loadedValue.IsNull())
{
for (vint i = env->scope->errors.Count() - 1; i >= errorCount; i--)
{
if (wcsstr(env->scope->errors[i].Buffer(), L"because the expected type is"))
{
env->scope->errors.RemoveAt(i);
}
}
result = true;
return;
}
}
}
static bool LoadValue(Ptr<GuiValueRepr> valueRepr, Ptr<GuiInstanceEnvironment> env, List<ITypeDescriptor*>& acceptableTypes, List<FillInstanceBindingSetter>& bindingSetters, List<FillInstanceEventSetter>& eventSetters, Value& loadedValue)
{
LoadValueVisitor visitor(env, acceptableTypes, bindingSetters, eventSetters);
valueRepr->Accept(&visitor);
if (visitor.result)
{
loadedValue = visitor.loadedValue;
}
return visitor.result;
}
};
}
using namespace visitors;
/***********************************************************************
FindInstanceLoadingSource
***********************************************************************/
InstanceLoadingSource FindInstanceLoadingSource(
Ptr<GuiInstanceContext> context,
GuiConstructorRepr* ctor
)
{
vint index=context->namespaces.Keys().IndexOf(ctor->typeNamespace);
if(index!=-1)
{
Ptr<GuiInstanceContext::NamespaceInfo> namespaceInfo=context->namespaces.Values()[index];
FOREACH(Ptr<GuiInstanceNamespace>, ns, namespaceInfo->namespaces)
{
auto fullName = GlobalStringKey::Get(ns->prefix + ctor->typeName.ToString() + ns->postfix);
IGuiInstanceLoader* loader = GetInstanceLoaderManager()->GetLoader(fullName);
if(loader)
{
return InstanceLoadingSource(loader, fullName);
}
}
}
return InstanceLoadingSource();
}
/***********************************************************************
LoadInstancePropertyValue
***********************************************************************/
bool LoadInstancePropertyValue(
Ptr<GuiInstanceEnvironment> env,
GuiAttSetterRepr* attSetter,
GlobalStringKey binding,
IGuiInstanceLoader::PropertyValue propertyValue,
List<Ptr<GuiValueRepr>>& input,
IGuiInstanceLoader* propertyLoader,
bool constructorArgument,
List<Pair<Value, IGuiInstanceLoader*>>& output,
List<FillInstanceBindingSetter>& bindingSetters,
List<FillInstanceEventSetter>& eventSetters
)
{
GlobalStringKey instanceType;
if (propertyValue.instanceValue.IsNull())
{
instanceType = propertyLoader->GetTypeName();
}
else
{
instanceType = GlobalStringKey::Get(propertyValue.instanceValue.GetTypeDescriptor()->GetTypeName());
}
vint loadedValueCount = 0;
// try to look for a loader to handle this property
while (propertyLoader && loadedValueCount < input.Count())
{
if (auto propertyInfo = propertyLoader->GetPropertyType(propertyValue))
{
if (propertyInfo->constructorParameter != constructorArgument)
{
return false;
}
if (propertyInfo->support == GuiInstancePropertyInfo::NotSupport)
{
env->scope->errors.Add(
L"Property \"" +
propertyValue.propertyName.ToString() +
L"\" of type \"" +
propertyValue.instanceValue.GetTypeDescriptor()->GetTypeName() +
L"\" is not supported.");
return false;
}
switch (propertyInfo->support)
{
case GuiInstancePropertyInfo::SupportSet:
if (input.Count() != 1)
{
env->scope->errors.Add(
L"Collection property \"" +
propertyValue.propertyName.ToString() +
L"\" of type \"" +
instanceType.ToString() +
L"\" can only be assigned with a single value.");
return false;
}
if (constructorArgument) return false;
if (binding != GlobalStringKey::_Set)
{
env->scope->errors.Add(
L"Collection property \"" +
propertyValue.propertyName.ToString() +
L"\" of type \"" +
instanceType.ToString() +
L"\" can only be retrived using binding \"set\".");
return false;
}
{
// set binding: get the property value and apply another property list on it
if(Ptr<GuiAttSetterRepr> propertyAttSetter=input[0].Cast<GuiAttSetterRepr>())
{
if(propertyLoader->GetPropertyValue(propertyValue) && propertyValue.propertyValue.GetRawPtr())
{
input[0] = 0;
loadedValueCount++;
ITypeDescriptor* propertyTypeDescriptor=propertyValue.propertyValue.GetRawPtr()->GetTypeDescriptor();
auto propertyTypeKey = GlobalStringKey::Get(propertyTypeDescriptor->GetTypeName());
IGuiInstanceLoader* propertyInstanceLoader=GetInstanceLoaderManager()->GetLoader(propertyTypeKey);
if(propertyInstanceLoader)
{
FillInstance(propertyValue.propertyValue, env, propertyAttSetter.Obj(), propertyInstanceLoader, false, propertyTypeKey, bindingSetters, eventSetters);
}
}
}
}
break;
case GuiInstancePropertyInfo::SupportCollection:
if (binding != GlobalStringKey::Empty)
{
env->scope->errors.Add(
L"Collection property \"" +
propertyValue.propertyName.ToString() +
L"\" of type \"" +
instanceType.ToString() +
L"\" cannot be assigned using binding.");
return false;
}
{
FOREACH_INDEXER(Ptr<GuiValueRepr>, valueRepr, index, input)
{
if (valueRepr)
{
// default binding: set the value directly
vint errorCount = env->scope->errors.Count();
if (LoadValueVisitor::LoadValue(valueRepr, env, propertyInfo->acceptableTypes, bindingSetters, eventSetters, propertyValue.propertyValue))
{
input[index] = 0;
loadedValueCount++;
output.Add(Pair<Value, IGuiInstanceLoader*>(propertyValue.propertyValue, propertyLoader));
}
else if (propertyInfo->tryParent)
{
env->scope->errors.RemoveRange(errorCount, env->scope->errors.Count() - errorCount);
}
}
}
}
break;
case GuiInstancePropertyInfo::SupportAssign:
if (input.Count() != 1)
{
env->scope->errors.Add(
L"Assignable property \"" +
propertyValue.propertyName.ToString() +
L"\" of type \"" +
instanceType.ToString() +
L"\" cannot be assigned using multiple values.");
return false;
}
if (binding == GlobalStringKey::_Set)
{
env->scope->errors.Add(
L"Assignable property \"" +
propertyValue.propertyName.ToString() +
L"\" of type \"" +
instanceType.ToString() +
L"\" cannot be retrived using binding \"set\".");
return false;
}
{
FOREACH_INDEXER(Ptr<GuiValueRepr>, valueRepr, index, input)
{
if (valueRepr)
{
bool canRemoveLoadedValue = false;
if (binding == GlobalStringKey::Empty)
{
// default binding: set the value directly
if (LoadValueVisitor::LoadValue(valueRepr, env, propertyInfo->acceptableTypes, bindingSetters, eventSetters, propertyValue.propertyValue))
{
canRemoveLoadedValue = true;
output.Add(Pair<Value, IGuiInstanceLoader*>(propertyValue.propertyValue, propertyLoader));
}
}
else if (IGuiInstanceBinder* binder=GetInstanceLoaderManager()->GetInstanceBinder(binding))
{
List<GlobalStringKey> contextNames;
binder->GetRequiredContexts(contextNames);
bool success = PrepareBindingContext(env, contextNames, L"property binding", binder->GetBindingName());
if (success)
{
// other binding: provide the property value to the specified binder
List<ITypeDescriptor*> binderExpectedTypes;
binder->GetExpectedValueTypes(binderExpectedTypes);
if (LoadValueVisitor::LoadValue(valueRepr, env, binderExpectedTypes, bindingSetters, eventSetters, propertyValue.propertyValue))
{
canRemoveLoadedValue = true;
if (constructorArgument)
{
auto translatedValue = binder->GetValue(env, propertyValue.propertyValue);
if (translatedValue.IsNull())
{
env->scope->errors.Add(
L"Assignable property \"" +
propertyValue.propertyName.ToString() +
L"\" of type \"" +
instanceType.ToString() +
L"\" cannot be assigned using binding \"" +
binding.ToString() +
L"\" because the value translation failed.");
}
else
{
output.Add(Pair<Value, IGuiInstanceLoader*>(translatedValue, propertyLoader));
}
}
else
{
FillInstanceBindingSetter bindingSetter;
bindingSetter.binder = binder;
bindingSetter.loader = propertyLoader;
bindingSetter.bindingTarget = attSetter;
bindingSetter.propertyValue = propertyValue;
bindingSetters.Add(bindingSetter);
}
}
}
}
else
{
env->scope->errors.Add(
L"Assignable property \"" +
propertyValue.propertyName.ToString() +
L"\" of type \"" +
instanceType.ToString() +
L"\" cannot be assigned using binding \"" +
binding.ToString() +
L"\" because the appropriate IGuiInstanceBinder for this binding cannot be found.");
}
if (canRemoveLoadedValue)
{
input[index] = 0;
loadedValueCount++;
}
}
}
}
break;
case GuiInstancePropertyInfo::SupportArray:
if (binding != GlobalStringKey::Empty)
{
env->scope->errors.Add(
L"Array property \"" +
propertyValue.propertyName.ToString() +
L"\" of type \"" +
instanceType.ToString() +
L"\" cannot be assigned using binding.");
return false;
}
{
auto list = IValueList::Create();
FOREACH_INDEXER(Ptr<GuiValueRepr>, valueRepr, index, input)
{
// default binding: add the value to the list
if (LoadValueVisitor::LoadValue(valueRepr, env, propertyInfo->acceptableTypes, bindingSetters, eventSetters, propertyValue.propertyValue))
{
input[index] = 0;
loadedValueCount++;
list->Add(propertyValue.propertyValue);
}
}
// set the whole list to the property
output.Add(Pair<Value, IGuiInstanceLoader*>(Value::From(list), propertyLoader));
}
break;
default:;
}
if (!propertyInfo->tryParent)
{
break;
}
}
if (constructorArgument)
{
break;
}
else
{
propertyLoader = GetInstanceLoaderManager()->GetParentLoader(propertyLoader);
}
}
return true;
}
/***********************************************************************
FillInstance
***********************************************************************/
void FillInstance(
description::Value createdInstance,
Ptr<GuiInstanceEnvironment> env,
GuiAttSetterRepr* attSetter,
IGuiInstanceLoader* loader,
bool skipDefaultProperty,
GlobalStringKey typeName,
List<FillInstanceBindingSetter>& bindingSetters,
List<FillInstanceEventSetter>& eventSetters
)
{
IGuiInstanceLoader::TypeInfo typeInfo(typeName, createdInstance.GetTypeDescriptor());
// reverse loop to set the default property (name == L"") after all other properties
for (vint i = attSetter->setters.Count() - 1; i >= 0; i--)
{
GlobalStringKey propertyName = attSetter->setters.Keys()[i];
if (propertyName == GlobalStringKey::Empty && skipDefaultProperty)
{
continue;
}
auto propertyValue=attSetter->setters.Values()[i];
IGuiInstanceLoader* propertyLoader=loader;
IGuiInstanceLoader::PropertyValue cachedPropertyValue(
typeInfo,
propertyName,
createdInstance
);
List<Ptr<GuiValueRepr>> input;
List<Pair<Value, IGuiInstanceLoader*>> output;
// extract all loaded property values
CopyFrom(input, propertyValue->values);
LoadInstancePropertyValue(env, attSetter, propertyValue->binding, cachedPropertyValue, input, propertyLoader, false, output, bindingSetters, eventSetters);
// if there is no binding, set all values into the specified property
if (propertyValue->binding == GlobalStringKey::Empty)
{
for (vint i = 0; i < output.Count(); i++)
{
auto value = output[i].key;
auto valueLoader = output[i].value;
cachedPropertyValue.propertyValue = value;
if (!valueLoader->SetPropertyValue(cachedPropertyValue))
{
value.DeleteRawPtr();
}
}
}
}
// attach events
FOREACH_INDEXER(GlobalStringKey, eventName, index, attSetter->eventHandlers.Keys())
{
auto handler = attSetter->eventHandlers.Values()[index];
IGuiInstanceLoader::PropertyInfo propertyInfo(
typeInfo,
eventName
);
// get the loader to attach the event
Ptr<GuiInstanceEventInfo> eventInfo;
IGuiInstanceLoader* eventLoader = loader;
{
while (eventLoader)
{
if ((eventInfo = eventLoader->GetEventType(propertyInfo)))
{
if (eventInfo->support == GuiInstanceEventInfo::NotSupport)
{
eventInfo = 0;
}
break;
}
eventLoader = GetInstanceLoaderManager()->GetParentLoader(eventLoader);
}
}
IGuiInstanceEventBinder* binder = 0;
if (handler->binding != GlobalStringKey::Empty)
{
binder = GetInstanceLoaderManager()->GetInstanceEventBinder(handler->binding);
if (!binder)
{
env->scope->errors.Add(
L"Failed to attach event \"" +
eventName.ToString() +
L"\" of type \"" +
typeName.ToString() +
L"\" with the handler \"" +
handler->value +
L"\" using event binding \"" +
handler->binding.ToString() +
L"\" because the appropriate IGuiInstanceEventBinder for this binding cannot be found.");
continue;
}
}
if (eventInfo)
{
FillInstanceEventSetter eventSetter;
eventSetter.binder = binder;
eventSetter.loader = eventLoader;
eventSetter.bindingTarget = attSetter;
eventSetter.eventInfo = eventInfo;
eventSetter.propertyValue.typeInfo = propertyInfo.typeInfo;
eventSetter.propertyValue.propertyName = propertyInfo.propertyName;
eventSetter.propertyValue.instanceValue = createdInstance;
eventSetter.handlerName = handler->value;
eventSetters.Add(eventSetter);
}
else
{
env->scope->errors.Add(
L"Failed to attach event \"" +
eventName.ToString() +
L"\" of type \"" +
typeName.ToString() +
L"\" with the handler \"" +
handler->value +
L"\" using event binding \"" +
handler->binding.ToString() +
L"\" because no IGuiInstanceLoader supports this event.");
}
}
}
/***********************************************************************
CreateInstance
***********************************************************************/
description::Value CreateInstance(
Ptr<GuiInstanceEnvironment> env,
GuiConstructorRepr* ctor,
description::ITypeDescriptor* expectedType,
GlobalStringKey& typeName,
List<FillInstanceBindingSetter>& bindingSetters,
List<FillInstanceEventSetter>& eventSetters,
bool isRootInstance
)
{
// search for a correct loader
InstanceLoadingSource source=FindInstanceLoadingSource(env->context, ctor);
Value instance;
IGuiInstanceLoader* instanceLoader = 0;
bool deserialized = false;
if(source.loader)
{
// found the correct loader, prepare a TypeInfo
IGuiInstanceLoader* loader=source.loader;
instanceLoader = source.loader;
typeName = source.typeName;
ITypeDescriptor* typeDescriptor = GetInstanceLoaderManager()->GetTypeDescriptorForType(source.typeName);
// see if the constructor contains only a single text value
Ptr<GuiTextRepr> singleTextValue;
{
vint index = ctor->setters.Keys().IndexOf(GlobalStringKey::Empty);
if (index != -1)
{
auto setterValue = ctor->setters.Values()[index];
if (setterValue->values.Count() == 1)
{
singleTextValue = setterValue->values[0].Cast<GuiTextRepr>();
}
}
else
{
singleTextValue = new GuiTextRepr;
singleTextValue->text = L"";
}
}
// if the target type is not the expected type, fail
if (!expectedType || expectedType==GetTypeDescriptor<Value>() || typeDescriptor->CanConvertTo(expectedType))
{
// traverse the loader and all ancestors to load the type
IGuiInstanceLoader::TypeInfo typeInfo(typeName, typeDescriptor);
bool foundLoader = false;
while(!foundLoader && loader && instance.IsNull())
{
if (singleTextValue && loader->IsDeserializable(typeInfo))
{
foundLoader = true;
// if the loader support deserialization and this is a single text value constructor
// then choose deserialization
instance = loader->Deserialize(typeInfo, singleTextValue->text);
if (!instance.IsNull())
{
deserialized = true;
}
else
{
env->scope->errors.Add(
L"Failed to deserialize object of type \"" +
source.typeName.ToString() +
L"\" from string \"" +
singleTextValue->text +
L"\".");
}
}
else if (loader->IsCreatable(typeInfo))
{
foundLoader = true;
// find all constructor parameters
List<GlobalStringKey> constructorParameters;
List<GlobalStringKey> requiredParameters;
loader->GetConstructorParameters(typeInfo, constructorParameters);
// see if all parameters exists
Group<GlobalStringKey, Value> constructorArguments;
FOREACH(GlobalStringKey, propertyName, constructorParameters)
{
IGuiInstanceLoader::PropertyInfo propertyInfo(typeInfo, propertyName);
auto info = loader->GetPropertyType(propertyInfo);
vint index = ctor->setters.Keys().IndexOf(propertyName);
if (info->constructorParameter)
{
if (info->required)
{
if (index == -1)
{
// if a required parameter doesn't exist, fail
env->scope->errors.Add(
L"Failed to create object of type \"" +
source.typeName.ToString() +
L"\" because the required constructor parameter \"" +
propertyName.ToString() +
L"\" is missing.");
goto SKIP_CREATE_INSTANCE;
}
requiredParameters.Add(propertyName);
}
if (index != -1)
{
auto setterValue = ctor->setters.Values()[index];
if (setterValue->binding != GlobalStringKey::Empty)
{
if (IGuiInstanceBinder* binder = GetInstanceLoaderManager()->GetInstanceBinder(setterValue->binding))
{
if (!binder->ApplicableToConstructorArgument())
{
// if the constructor argument uses binding, fail
env->scope->errors.Add(
L"Failed to create object of type \"" +
source.typeName.ToString() +
L"\" because the required constructor parameter \"" +
propertyName.ToString() +
L"\" is not allowed to use binding \"" +
setterValue->binding.ToString() +
L"\" which does not applicable to constructor parameters.");
goto SKIP_CREATE_INSTANCE;
}
}
else
{
env->scope->errors.Add(
L"Failed to create object of type \"" +
source.typeName.ToString() +
L"\" because the required constructor parameter \"" +
propertyName.ToString() +
L"\" is not allowed to use binding \"" +
setterValue->binding.ToString() +
L"\" because the appropriate IGuiInstanceBinder for this binding cannot be found.");
goto SKIP_CREATE_INSTANCE;
}
}
// load the parameter
List<Ptr<GuiValueRepr>> input;
List<Pair<Value, IGuiInstanceLoader*>> output;
IGuiInstanceLoader::PropertyValue propertyValue(typeInfo, propertyName, Value());
CopyFrom(input, setterValue->values);
LoadInstancePropertyValue(env, ctor, setterValue->binding, propertyValue, input, loader, true, output, bindingSetters, eventSetters);
for (vint i = 0; i < output.Count(); i++)
{
constructorArguments.Add(propertyName, output[i].key);
}
}
}
}
// check if all required parameters exist
FOREACH(GlobalStringKey, propertyName, requiredParameters)
{
if (!constructorArguments.Contains(propertyName))
{
env->scope->errors.Add(
L"Failed to create object of type \"" +
source.typeName.ToString() +
L"\" because the required constructor parameter \"" +
propertyName.ToString() +
L"\" is missing.");
goto SKIP_CREATE_INSTANCE;
}
}
// create the instance
instance = loader->CreateInstance(env, typeInfo, constructorArguments);
SKIP_CREATE_INSTANCE:
// delete all arguments if the constructing fails
if (instance.IsNull())
{
for (vint i = 0; i < constructorArguments.Count(); i++)
{
FOREACH(Value, value, constructorArguments.GetByIndex(i))
{
value.DeleteRawPtr();
}
}
}
}
loader = GetInstanceLoaderManager()->GetParentLoader(loader);
}
if (instance.IsNull())
{
env->scope->errors.Add(
L"Failed to create object of type \"" +
source.typeName.ToString() +
L"\".");
}
}
else
{
env->scope->errors.Add(
L"Failed to create object of type \"" +
source.typeName.ToString() +
L"\" because the expected type is \"" +
expectedType->GetTypeName() +
L"\".");
}
}
else if(source.context)
{
// found another instance in the resource
if (Ptr<GuiInstanceContextScope> scope = LoadInstanceFromContext(source.context, env->resolver, expectedType))
{
typeName = scope->typeName;
instance = scope->rootInstance;
instanceLoader = GetInstanceLoaderManager()->GetLoader(typeName);
}
else
{
auto contextCtor = source.context->instance;
env->scope->errors.Add(
L"Failed to find type \"" +
(contextCtor->typeNamespace == GlobalStringKey::Empty
? contextCtor->typeName.ToString()
: contextCtor->typeNamespace.ToString() + L":" + contextCtor->typeName.ToString()
) +
L"\".");
}
}
else
{
env->scope->errors.Add(
L"Failed to find type \"" +
(ctor->typeNamespace == GlobalStringKey::Empty
? ctor->typeName.ToString()
: ctor->typeNamespace.ToString() + L":" + ctor->typeName.ToString()
) +
L"\".");
}
if(instance.GetRawPtr() && instanceLoader)
{
if (isRootInstance)
{
env->scope->rootInstance = instance;
ExecuteParameters(env);
}
InitializeInstanceFromConstructor(env, ctor, instanceLoader, typeName, instance, deserialized, bindingSetters, eventSetters);
}
return instance;
}
/***********************************************************************
ExecuteBindingSetters
***********************************************************************/
void ExecuteParameters(Ptr<GuiInstanceEnvironment> env)
{
auto td = env->scope->rootInstance.GetTypeDescriptor();
FOREACH(Ptr<GuiInstanceParameter>, parameter, env->context->parameters)
{
auto info = td->GetPropertyByName(parameter->name.ToString(), true);
if (!info)
{
env->scope->errors.Add(L"Cannot find parameter \"" + parameter->name.ToString() + L"\" in properties of \"" + td->GetTypeName() + L"\".");
continue;
}
auto parameterTd = GetTypeDescriptor(parameter->className.ToString());
if (!parameterTd)
{
env->scope->errors.Add(L"Cannot find type \"" + parameter->className.ToString() + L"\" of parameter \"" + parameter->name.ToString() + L"\".");
}
auto value = info->GetValue(env->scope->rootInstance);
if (parameterTd && !value.GetTypeDescriptor()->CanConvertTo(parameterTd))
{
env->scope->errors.Add(L"Value of parameter \"" + parameter->name.ToString() + L"\" is not \"" + parameterTd->GetTypeName() + L"\" which is required.");
}
if (env->scope->referenceValues.Keys().Contains(parameter->name))
{
env->scope->errors.Add(L"Parameter \"" + parameter->name.ToString() + L"\" conflict with an existing named object.");
}
else
{
env->scope->referenceValues.Add(parameter->name, value);
}
}
}
/***********************************************************************
ExecuteBindingSetters
***********************************************************************/
bool PrepareBindingContext(
Ptr<GuiInstanceEnvironment> env,
collections::List<GlobalStringKey>& contextNames,
const WString& dependerType,
const GlobalStringKey& dependerName
)
{
bool success = true;
FOREACH(GlobalStringKey, contextName, contextNames)
{
if (!env->scope->bindingContexts.Keys().Contains(contextName))
{
auto factory = GetInstanceLoaderManager()->GetInstanceBindingContextFactory(contextName);
if (factory)
{
env->scope->bindingContexts.Add(contextName, factory->CreateContext());
}
else
{
env->scope->errors.Add(
L"Failed to create binding context \"" +
contextName.ToString() +
L"\" which is required by " +
dependerType +
L" \"" +
dependerName.ToString() +
L"\".");
success = false;
}
}
}
return success;
}
void ExecuteBindingSetters(
Ptr<GuiInstanceEnvironment> env,
List<FillInstanceBindingSetter>& bindingSetters
)
{
// set all binding attributes
FOREACH(FillInstanceBindingSetter, bindingSetter, bindingSetters)
{
List<GlobalStringKey> contextNames;
bindingSetter.binder->GetRequiredContexts(contextNames);
bool success = PrepareBindingContext(env, contextNames, L"property binding", bindingSetter.binder->GetBindingName());
if (bindingSetter.binder->RequireInstanceName())
{
if (bindingSetter.bindingTarget->instanceName == GlobalStringKey::Empty)
{
auto name = GlobalStringKey::Get(L"<temp>" + itow(env->scope->referenceValues.Count()));
bindingSetter.bindingTarget->instanceName = name;
}
auto name = bindingSetter.bindingTarget->instanceName;
auto value = bindingSetter.propertyValue.instanceValue;
if (!env->scope->referenceValues.Keys().Contains(bindingSetter.bindingTarget->instanceName))
{
env->scope->referenceValues.Add(name, value);
}
}
if (!success || !bindingSetter.binder->SetPropertyValue(env, bindingSetter.loader, bindingSetter.bindingTarget->instanceName, bindingSetter.propertyValue))
{
auto value = bindingSetter.propertyValue.propertyValue;
env->scope->errors.Add(
L"Failed to set property \"" +
bindingSetter.propertyValue.propertyName.ToString() +
L"\" of \"" +
bindingSetter.propertyValue.instanceValue.GetTypeDescriptor()->GetTypeName() +
L"\" using binding \"" +
bindingSetter.binder->GetBindingName().ToString() +
L"\" and value \"" +
(
value.GetValueType() == Value::Null ? WString(L"null") :
value.GetValueType() == Value::Text ? value.GetText() :
(L"<" + value.GetTypeDescriptor()->GetTypeName() + L">")
) +
L"\".");
bindingSetter.propertyValue.propertyValue.DeleteRawPtr();
}
}
// initialize all binding context
FOREACH(Ptr<IGuiInstanceBindingContext>, context, env->scope->bindingContexts.Values())
{
context->Initialize(env);
}
}
/***********************************************************************
ExecuteBindingSetters
***********************************************************************/
void ExecuteEventSetters(
description::Value createdInstance,
Ptr<GuiInstanceEnvironment> env,
List<FillInstanceEventSetter>& eventSetters
)
{
#ifndef VCZH_DEBUG_NO_REFLECTION
// set all event attributes
FOREACH(FillInstanceEventSetter, eventSetter, eventSetters)
{
if (eventSetter.binder)
{
List<GlobalStringKey> contextNames;
eventSetter.binder->GetRequiredContexts(contextNames);
auto propertyValue = eventSetter.propertyValue;
propertyValue.propertyValue = BoxValue(eventSetter.handlerName);
bool success = PrepareBindingContext(env, contextNames, L"event binding", eventSetter.binder->GetBindingName());
if (eventSetter.binder->RequireInstanceName())
{
if (eventSetter.bindingTarget->instanceName == GlobalStringKey::Empty)
{
auto name = GlobalStringKey::Get(L"<temp>" + itow(env->scope->referenceValues.Count()));
eventSetter.bindingTarget->instanceName = name;
}
auto name = eventSetter.bindingTarget->instanceName;
auto value = eventSetter.propertyValue.instanceValue;
if (!env->scope->referenceValues.Keys().Contains(eventSetter.bindingTarget->instanceName))
{
env->scope->referenceValues.Add(name, value);
}
}
if (!success || !eventSetter.binder->AttachEvent(env, eventSetter.loader, eventSetter.bindingTarget->instanceName, propertyValue))
{
env->scope->errors.Add(
L"Failed to attach event \"" +
propertyValue.propertyName.ToString() +
L"\" of type \"" +
propertyValue.instanceValue.GetTypeDescriptor()->GetTypeName() +
L"\" with the handler \"" +
propertyValue.propertyValue.GetText() +
L"\" using event binding \"" +
eventSetter.binder->GetBindingName().ToString() +
L"\".");
}
}
else if (auto group = createdInstance.GetTypeDescriptor()->GetMethodGroupByName(eventSetter.handlerName, true))
{
// find a correct method
vint count = group->GetMethodCount();
IMethodInfo* selectedMethod = 0;
for (vint i = 0; i < count; i++)
{
auto method = group->GetMethod(i);
if (method->GetParameterCount() != 2) goto UNSUPPORTED;
{
auto returnType = method->GetReturn();
auto senderType = method->GetParameter(0)->GetType();
auto argumentType = method->GetParameter(1)->GetType();
if (returnType->GetDecorator() != ITypeInfo::TypeDescriptor) goto UNSUPPORTED;
if (returnType->GetTypeDescriptor() != description::GetTypeDescriptor<VoidValue>()) goto UNSUPPORTED;
if (senderType->GetDecorator() != ITypeInfo::RawPtr) goto UNSUPPORTED;
senderType = senderType->GetElementType();
if (senderType->GetDecorator() != ITypeInfo::TypeDescriptor) goto UNSUPPORTED;
if (senderType->GetTypeDescriptor() != description::GetTypeDescriptor<compositions::GuiGraphicsComposition>()) goto UNSUPPORTED;
if (argumentType->GetDecorator() != ITypeInfo::RawPtr) goto UNSUPPORTED;
argumentType = argumentType->GetElementType();
if (argumentType->GetDecorator() != ITypeInfo::TypeDescriptor) goto UNSUPPORTED;
if (argumentType->GetTypeDescriptor() != eventSetter.eventInfo->argumentType) goto UNSUPPORTED;
selectedMethod = method;
break;
}
UNSUPPORTED:
continue;
}
if (selectedMethod)
{
Value proxy = selectedMethod->CreateFunctionProxy(createdInstance);
if (!proxy.IsNull())
{
auto propertyValue = eventSetter.propertyValue;
propertyValue.propertyValue = proxy;
eventSetter.loader->SetEventValue(propertyValue);
}
}
else
{
env->scope->errors.Add(
L"Event handler \"" +
eventSetter.handlerName +
L"\" exists but the type does not match the event \"" +
eventSetter.propertyValue.propertyName.ToString() +
L"\" of \"" +
env->context->instance->typeName.ToString() +
L"\".");
}
}
else
{
env->scope->errors.Add(
L"Failed to find event handler \"" +
eventSetter.handlerName +
L"\" when setting event \"" +
eventSetter.propertyValue.propertyName.ToString() +
L"\" of \"" +
env->context->instance->typeName.ToString() +
L"\".");
}
}
#endif
}
/***********************************************************************
LoadInstance
***********************************************************************/
Ptr<GuiInstanceContextScope> LoadInstanceFromContext(
Ptr<GuiInstanceContext> context,
Ptr<GuiResourcePathResolver> resolver,
description::ITypeDescriptor* expectedType
)
{
Ptr<GuiInstanceEnvironment> env = new GuiInstanceEnvironment(context, resolver);
List<FillInstanceBindingSetter> bindingSetters;
List<FillInstanceEventSetter> eventSetters;
Value instance = CreateInstance(env, context->instance.Obj(), expectedType, env->scope->typeName, bindingSetters, eventSetters, true);
if (!instance.IsNull())
{
ExecuteBindingSetters(env, bindingSetters);
ExecuteEventSetters(instance, env, eventSetters);
return env->scope;
}
return 0;
}
Ptr<GuiInstanceContextScope> LoadInstance(
Ptr<GuiResource> resource,
const WString& instancePath,
description::ITypeDescriptor* expectedType
)
{
Ptr<GuiInstanceContext> context=resource->GetValueByPath(instancePath).Cast<GuiInstanceContext>();
if (context)
{
Ptr<GuiResourcePathResolver> resolver = new GuiResourcePathResolver(resource, resource->GetWorkingDirectory());
return LoadInstanceFromContext(context, resolver, expectedType);
}
return 0;
}
/***********************************************************************
InitializeInstance
***********************************************************************/
void InitializeInstanceFromConstructor(
Ptr<GuiInstanceEnvironment> env,
GuiConstructorRepr* ctor,
IGuiInstanceLoader* instanceLoader,
GlobalStringKey typeName,
description::Value instance,
bool deserialized,
List<FillInstanceBindingSetter>& bindingSetters,
List<FillInstanceEventSetter>& eventSetters
)
{
// fill all attributes
FillInstance(instance, env, ctor, instanceLoader, deserialized, typeName, bindingSetters, eventSetters);
if (ctor->instanceName != GlobalStringKey::Empty)
{
if (env->scope->referenceValues.Keys().Contains(ctor->instanceName))
{
env->scope->errors.Add(L"Parameter \"" + ctor->instanceName.ToString() + L"\" conflict with an existing named object.");
}
else
{
env->scope->referenceValues.Add(ctor->instanceName, instance);
}
}
}
Ptr<GuiInstanceContextScope> InitializeInstanceFromContext(
Ptr<GuiInstanceContext> context,
Ptr<GuiResourcePathResolver> resolver,
description::Value instance
)
{
List<FillInstanceBindingSetter> bindingSetters;
List<FillInstanceEventSetter> eventSetters;
// search for a correct loader
GuiConstructorRepr* ctor = context->instance.Obj();
Ptr<GuiInstanceEnvironment> env = new GuiInstanceEnvironment(context, resolver);
InstanceLoadingSource source = FindInstanceLoadingSource(env->context, ctor);
// initialize the instance
if(source.loader)
{
env->scope->rootInstance = instance;
ExecuteParameters(env);
InitializeInstanceFromConstructor(env, ctor, source.loader, source.typeName, instance, false, bindingSetters, eventSetters);
ExecuteBindingSetters(env, bindingSetters);
ExecuteEventSetters(instance, env, eventSetters);
return env->scope;
}
return 0;
}
Ptr<GuiInstanceContextScope> InitializeInstance(
Ptr<GuiResource> resource,
const WString& instancePath,
description::Value instance
)
{
if (instance.GetRawPtr())
{
Ptr<GuiInstanceContext> context=resource->GetValueByPath(instancePath).Cast<GuiInstanceContext>();
if (context)
{
Ptr<GuiResourcePathResolver> resolver = new GuiResourcePathResolver(resource, resource->GetWorkingDirectory());
return InitializeInstanceFromContext(context, resolver, instance);
}
}
return 0;
}
}
}
/***********************************************************************
GuiInstanceLoader_Log.cpp
***********************************************************************/
namespace vl
{
namespace presentation
{
using namespace collections;
using namespace reflection::description;
/***********************************************************************
LogInstanceLoaderManager_GetParentTypes
***********************************************************************/
void LogInstanceLoaderManager_GetParentTypes(const WString& typeName, List<WString>& parentTypes)
{
if (ITypeDescriptor* type = GetGlobalTypeManager()->GetTypeDescriptor(typeName))
{
vint parentCount = type->GetBaseTypeDescriptorCount();
for (vint j = 0; j < parentCount; j++)
{
ITypeDescriptor* parent = type->GetBaseTypeDescriptor(j);
parentTypes.Add(parent->GetTypeName());
}
}
else
{
parentTypes.Add(GetInstanceLoaderManager()->GetParentTypeForVirtualType(GlobalStringKey::Get(typeName)).ToString());
}
}
/***********************************************************************
LogInstanceLoaderManager_PrintParentTypes
***********************************************************************/
void LogInstanceLoaderManager_PrintParentTypes(stream::TextWriter& writer, const WString& typeName)
{
List<WString> parentTypes;
LogInstanceLoaderManager_GetParentTypes(typeName, parentTypes);
FOREACH_INDEXER(WString, parentType, index, parentTypes)
{
writer.WriteLine(L" " + WString(index == 0 ? L": " : L", ") + parentType);
}
}
/***********************************************************************
LogInstanceLoaderManager_PrintFieldName
***********************************************************************/
void LogInstanceLoaderManager_PrintFieldName(stream::TextWriter& writer, const WString& name)
{
writer.WriteString(L" " + name);
for (vint i = name.Length(); i < 24; i++)
{
writer.WriteChar(L' ');
}
writer.WriteString(L" : ");
}
/***********************************************************************
LogInstanceLoaderManager_PrintProperties
***********************************************************************/
void LogInstanceLoaderManager_PrintProperties(stream::TextWriter& writer, const WString& typeName)
{
List<IGuiInstanceLoader*> loaders;
{
IGuiInstanceLoader* loader = GetInstanceLoaderManager()->GetLoader(GlobalStringKey::Get(typeName));
while (loader)
{
loaders.Add(loader);
loader = GetInstanceLoaderManager()->GetParentLoader(loader);
}
}
IGuiInstanceLoader::TypeInfo typeInfo(GlobalStringKey::Get(typeName), GetInstanceLoaderManager()->GetTypeDescriptorForType(GlobalStringKey::Get(typeName)));
Dictionary<GlobalStringKey, IGuiInstanceLoader*> propertyLoaders;
FOREACH(IGuiInstanceLoader*, loader, loaders)
{
List<GlobalStringKey> propertyNames;
loader->GetPropertyNames(typeInfo, propertyNames);
FOREACH(GlobalStringKey, propertyName, propertyNames)
{
if (!propertyLoaders.Keys().Contains(propertyName))
{
propertyLoaders.Add(propertyName, loader);
}
}
}
FOREACH_INDEXER(GlobalStringKey, propertyName, index, propertyLoaders.Keys())
{
SortedList<WString> acceptableTypes;
Ptr<GuiInstancePropertyInfo> firstInfo;
IGuiInstanceLoader* loader = propertyLoaders.Values()[index];
IGuiInstanceLoader::PropertyInfo propertyInfo(typeInfo, propertyName);
while (loader)
{
if (auto info = loader->GetPropertyType(propertyInfo))
{
if (firstInfo)
{
if (info->support != firstInfo->support)
{
break;
}
}
else
{
firstInfo = info;
}
if (info->support!=GuiInstancePropertyInfo::NotSupport)
{
FOREACH(ITypeDescriptor*, type, info->acceptableTypes)
{
if (!acceptableTypes.Contains(type->GetTypeName()))
{
acceptableTypes.Add(type->GetTypeName());
}
}
if (!info->tryParent)
{
break;
}
}
else
{
break;
}
}
vint index = loaders.IndexOf(loader);
loader = index == loaders.Count() - 1 ? 0 : loaders[index + 1];
}
if (firstInfo->support == GuiInstancePropertyInfo::NotSupport)
{
continue;
}
LogInstanceLoaderManager_PrintFieldName(writer, (propertyName == GlobalStringKey::Empty? L"<DEFAULT-PROPERTY>" : propertyName.ToString()));
if (firstInfo->constructorParameter)
{
writer.WriteString(firstInfo->required ? L"+" : L"*");
}
else
{
writer.WriteString(L" ");
}
switch (firstInfo->support)
{
case GuiInstancePropertyInfo::SupportAssign:
writer.WriteString(L"[assign] ");
break;
case GuiInstancePropertyInfo::SupportCollection:
writer.WriteString(L"[collection] ");
break;
case GuiInstancePropertyInfo::SupportArray:
writer.WriteString(L"[array] ");
break;
case GuiInstancePropertyInfo::SupportSet:
writer.WriteString(L"[set] ");
break;
default:;
}
switch (acceptableTypes.Count())
{
case 0:
writer.WriteLine(L"<UNKNOWN-TYPE>");
break;
case 1:
writer.WriteLine(acceptableTypes[0]);
break;
default:
writer.WriteLine(L"{");
FOREACH(WString, typeName, acceptableTypes)
{
writer.WriteLine(L" " + typeName + L",");
}
writer.WriteLine(L" }");
}
}
}
/***********************************************************************
LogInstanceLoaderManager_PrintProperties
***********************************************************************/
void LogInstanceLoaderManager_PrintEvents(stream::TextWriter& writer, const WString& typeName)
{
List<IGuiInstanceLoader*> loaders;
{
IGuiInstanceLoader* loader = GetInstanceLoaderManager()->GetLoader(GlobalStringKey::Get(typeName));
while (loader)
{
loaders.Add(loader);
loader = GetInstanceLoaderManager()->GetParentLoader(loader);
}
}
IGuiInstanceLoader::TypeInfo typeInfo(GlobalStringKey::Get(typeName), GetInstanceLoaderManager()->GetTypeDescriptorForType(GlobalStringKey::Get(typeName)));
Dictionary<GlobalStringKey, IGuiInstanceLoader*> eventLoaders;
FOREACH(IGuiInstanceLoader*, loader, loaders)
{
List<GlobalStringKey> eventNames;
loader->GetEventNames(typeInfo, eventNames);
FOREACH(GlobalStringKey, eventName, eventNames)
{
if (!eventLoaders.Keys().Contains(eventName))
{
eventLoaders.Add(eventName, loader);
}
}
}
FOREACH_INDEXER(GlobalStringKey, eventName, index, eventLoaders.Keys())
{
IGuiInstanceLoader* loader = eventLoaders.Values()[index];
IGuiInstanceLoader::PropertyInfo propertyInfo(typeInfo, eventName);
auto info = loader->GetEventType(propertyInfo);
if (info->support == GuiInstanceEventInfo::NotSupport)
{
continue;
}
LogInstanceLoaderManager_PrintFieldName(writer, eventName.ToString());
writer.WriteString(L" [event] ");
writer.WriteLine(info->argumentType->GetTypeName());
}
}
/***********************************************************************
LogInstanceLoaderManager_PrintSerializableType
***********************************************************************/
void LogInstanceLoaderManager_PrintSerializableType(stream::TextWriter& writer, const WString& typeName)
{
if (ITypeDescriptor* type = GetGlobalTypeManager()->GetTypeDescriptor(typeName))
{
if (IValueSerializer* serializer = type->GetValueSerializer())
{
if (serializer->HasCandidate())
{
if (serializer->CanMergeCandidate())
{
writer.WriteLine(L" enum " + typeName + L" = {" + serializer->GetDefaultText() + L"}");
}
else
{
writer.WriteLine(L" flags " + typeName + L" = {" + serializer->GetDefaultText() + L"}");
}
writer.WriteLine(L" {");
vint count = serializer->GetCandidateCount();
for (vint i = 0; i < count; i++)
{
writer.WriteLine(L" " + serializer->GetCandidate(i) + L",");
}
writer.WriteLine(L" }");
return;
}
else if (type->GetPropertyCount() > 0)
{
writer.WriteLine(L" struct "+ typeName + + L" = {" + serializer->GetDefaultText() + L"}");
writer.WriteLine(L" {");
vint count = type->GetPropertyCount();
for (vint i = 0; i < count; i++)
{
IPropertyInfo* prop = type->GetProperty(i);
LogInstanceLoaderManager_PrintFieldName(writer, prop->GetName());
writer.WriteLine(prop->GetReturn()->GetTypeFriendlyName() + L";");
}
writer.WriteLine(L" }");
return;
}
else
{
writer.WriteLine(L" data "+ typeName + + L" = {" + serializer->GetDefaultText() + L"}");
return;
}
}
}
writer.WriteLine(L" serializable " + typeName);
}
/***********************************************************************
LogInstanceLoaderManager_PrintConstructableType
***********************************************************************/
void LogInstanceLoaderManager_PrintConstructableType(stream::TextWriter& writer, const WString& typeName)
{
writer.WriteLine(L" class " + typeName);
LogInstanceLoaderManager_PrintParentTypes(writer, typeName);
writer.WriteLine(L" {");
LogInstanceLoaderManager_PrintProperties(writer, typeName);
LogInstanceLoaderManager_PrintEvents(writer, typeName);
writer.WriteLine(L" }");
}
/***********************************************************************
LogInstanceLoaderManager_PrintUnconstructableParentType
***********************************************************************/
void LogInstanceLoaderManager_PrintUnconstructableParentType(stream::TextWriter& writer, const WString& typeName)
{
writer.WriteLine(L" abstract class " + typeName);
LogInstanceLoaderManager_PrintParentTypes(writer, typeName);
writer.WriteLine(L" {");
writer.WriteLine(L" }");
}
/***********************************************************************
LogInstanceLoaderManager_Others
***********************************************************************/
void LogInstanceLoaderManager_PrintVirtualizedType(stream::TextWriter& writer, const WString& typeName)
{
writer.WriteLine(L" abstract class " + typeName);
}
void LogInstanceLoaderManager_PrintUnconstructableType(stream::TextWriter& writer, const WString& typeName)
{
writer.WriteLine(L" abstract class " + typeName);
}
void LogInstanceLoaderManager_PrintInterfaceType(stream::TextWriter& writer, const WString& typeName)
{
writer.WriteLine(L" interface " + typeName);
}
void LogInstanceLoaderManager_PrintInterfaceConstructableType(stream::TextWriter& writer, const WString& typeName)
{
writer.WriteLine(L" interface " + typeName);
}
/***********************************************************************
LogInstanceLoaderManager
***********************************************************************/
void LogInstanceLoaderManager(stream::TextWriter& writer)
{
SortedList<WString> allTypes, virtualizedTypes;
Group<WString, WString> typeParents, typeChildren;
// collect types
{
vint typeCount = GetGlobalTypeManager()->GetTypeDescriptorCount();
for (vint i = 0; i < typeCount; i++)
{
ITypeDescriptor* type = GetGlobalTypeManager()->GetTypeDescriptor(i);
allTypes.Add(type->GetTypeName());
vint parentCount = type->GetBaseTypeDescriptorCount();
for (vint j = 0; j < parentCount; j++)
{
ITypeDescriptor* parent = type->GetBaseTypeDescriptor(j);
typeParents.Add(type->GetTypeName(), parent->GetTypeName());
typeChildren.Add(parent->GetTypeName(), type->GetTypeName());
}
}
List<GlobalStringKey> virtualTypes;
GetInstanceLoaderManager()->GetVirtualTypes(virtualTypes);
FOREACH(GlobalStringKey, typeName, virtualTypes)
{
GlobalStringKey parentType = GetInstanceLoaderManager()->GetParentTypeForVirtualType(typeName);
if (description::GetTypeDescriptor(parentType.ToString()) && !virtualizedTypes.Contains(parentType.ToString()))
{
virtualizedTypes.Add(parentType.ToString());
}
allTypes.Add(typeName.ToString());
typeParents.Add(typeName.ToString(), parentType.ToString());
typeChildren.Add(parentType.ToString(), typeName.ToString());
}
}
// sort types
List<WString> sortedTypes;
{
FOREACH(WString, typeName, allTypes)
{
if (!typeParents.Contains(typeName))
{
sortedTypes.Add(typeName);
}
}
for (vint i = 0; i < sortedTypes.Count(); i++)
{
WString selectedType = sortedTypes[i];
vint index = typeChildren.Keys().IndexOf(selectedType);
if (index != -1)
{
FOREACH(WString, childType, typeChildren.GetByIndex(index))
{
typeParents.Remove(childType, selectedType);
if (!typeParents.Contains(childType))
{
sortedTypes.Add(childType);
}
}
typeChildren.Remove(selectedType);
}
}
}
// categorize types
List<WString> serializableTypes;
List<WString> constructableTypes;
List<WString> unconstructableParentTypes;
List<WString> unconstructableTypes;
List<WString> interfaceTypes;
List<WString> interfaceConstructableTypes;
{
FOREACH(WString, typeName, sortedTypes)
{
auto typeKey = GlobalStringKey::Get(typeName);
auto typeDescriptor = GetInstanceLoaderManager()->GetTypeDescriptorForType(typeKey);
IGuiInstanceLoader::TypeInfo typeInfo(typeKey, typeDescriptor);
auto loader = GetInstanceLoaderManager()->GetLoader(typeKey);
while (loader)
{
if (loader->IsDeserializable(typeInfo))
{
serializableTypes.Add(typeName);
break;
}
else if (loader->IsCreatable(typeInfo))
{
constructableTypes.Add(typeName);
break;
}
else
{
loader = GetInstanceLoaderManager()->GetParentLoader(loader);
}
}
if (!loader && !virtualizedTypes.Contains(typeName))
{
bool acceptProxy = false;
if (typeDescriptor->GetTypeName() == typeName && IsInterfaceType(typeDescriptor, acceptProxy))
{
if (acceptProxy)
{
interfaceConstructableTypes.Add(typeName);
}
else
{
interfaceTypes.Add(typeName);
}
}
else
{
unconstructableTypes.Add(typeName);
}
}
}
List<WString> parentTypes;
FOREACH(WString, typeName, constructableTypes)
{
parentTypes.Add(typeName);
}
for (vint i = 0; i < parentTypes.Count(); i++)
{
LogInstanceLoaderManager_GetParentTypes(parentTypes[i], parentTypes);
}
for (vint i = unconstructableTypes.Count() - 1; i >= 0; i--)
{
WString selectedType = unconstructableTypes[i];
if (parentTypes.Contains(selectedType))
{
unconstructableTypes.RemoveAt(i);
unconstructableParentTypes.Insert(0, selectedType);
}
}
}
writer.WriteLine(L"/***********************************************************************");
writer.WriteLine(L"Serializable Types");
writer.WriteLine(L"***********************************************************************/");
FOREACH(WString, typeName, serializableTypes)
{
writer.WriteLine(L"");
LogInstanceLoaderManager_PrintSerializableType(writer, typeName);
}
writer.WriteLine(L"");
writer.WriteLine(L"/***********************************************************************");
writer.WriteLine(L"Constructable Types");
writer.WriteLine(L"***********************************************************************/");
FOREACH(WString, typeName, constructableTypes)
{
writer.WriteLine(L"");
LogInstanceLoaderManager_PrintConstructableType(writer, typeName);
}
writer.WriteLine(L"");
writer.WriteLine(L"/***********************************************************************");
writer.WriteLine(L"Unconstructable Parent Types");
writer.WriteLine(L"***********************************************************************/");
FOREACH(WString, typeName, unconstructableParentTypes)
{
writer.WriteLine(L"");
LogInstanceLoaderManager_PrintUnconstructableParentType(writer, typeName);
}
writer.WriteLine(L"");
writer.WriteLine(L"/***********************************************************************");
writer.WriteLine(L"Unconstructable Virtualized Types");
writer.WriteLine(L"***********************************************************************/");
FOREACH(WString, typeName, virtualizedTypes)
{
writer.WriteLine(L"");
LogInstanceLoaderManager_PrintVirtualizedType(writer, typeName);
}
writer.WriteLine(L"");
writer.WriteLine(L"/***********************************************************************");
writer.WriteLine(L"Unconstructable Types");
writer.WriteLine(L"***********************************************************************/");
FOREACH(WString, typeName, unconstructableTypes)
{
writer.WriteLine(L"");
LogInstanceLoaderManager_PrintUnconstructableType(writer, typeName);
}
writer.WriteLine(L"");
writer.WriteLine(L"/***********************************************************************");
writer.WriteLine(L"Interface Types");
writer.WriteLine(L"***********************************************************************/");
FOREACH(WString, typeName, interfaceTypes)
{
writer.WriteLine(L"");
LogInstanceLoaderManager_PrintInterfaceType(writer, typeName);
}
writer.WriteLine(L"");
writer.WriteLine(L"/***********************************************************************");
writer.WriteLine(L"Interface Constructable Types");
writer.WriteLine(L"***********************************************************************/");
FOREACH(WString, typeName, interfaceConstructableTypes)
{
writer.WriteLine(L"");
LogInstanceLoaderManager_PrintInterfaceConstructableType(writer, typeName);
}
writer.WriteLine(L"");
}
}
}
/***********************************************************************
GuiInstanceLoader_PredefinedInstanceBinders.cpp
***********************************************************************/
namespace vl
{
namespace presentation
{
using namespace collections;
using namespace reflection::description;
using namespace workflow;
using namespace workflow::analyzer;
using namespace workflow::runtime;
using namespace controls;
/***********************************************************************
GuiTextInstanceBinderBase
***********************************************************************/
class GuiTextInstanceBinderBase : public Object, public IGuiInstanceBinder
{
protected:
ITypeDescriptor* stringTypeDescriptor;
public:
GuiTextInstanceBinderBase()
:stringTypeDescriptor(description::GetTypeDescriptor<WString>())
{
}
bool ApplicableToConstructorArgument()override
{
return false;
}
bool RequireInstanceName()override
{
return false;
}
void GetRequiredContexts(collections::List<GlobalStringKey>& contextNames)override
{
}
void GetExpectedValueTypes(collections::List<description::ITypeDescriptor*>& expectedTypes)override
{
expectedTypes.Add(stringTypeDescriptor);
}
description::Value GetValue(Ptr<GuiInstanceEnvironment> env, const description::Value& propertyValue)override
{
return Value();
}
};
/***********************************************************************
GuiResourceInstanceBinder
***********************************************************************/
class GuiResourceInstanceBinder : public GuiTextInstanceBinderBase
{
public:
GlobalStringKey GetBindingName()override
{
return GlobalStringKey::_Uri;
}
bool SetPropertyValue(Ptr<GuiInstanceEnvironment> env, IGuiInstanceLoader* loader, GlobalStringKey instanceName, IGuiInstanceLoader::PropertyValue& propertyValue)override
{
if (propertyValue.propertyValue.GetValueType() == Value::Text)
{
WString protocol, path;
if (IsResourceUrl(propertyValue.propertyValue.GetText(), protocol, path))
{
if(Ptr<DescriptableObject> resource=env->resolver->ResolveResource(protocol, path))
{
Value value;
if(Ptr<GuiTextData> text=resource.Cast<GuiTextData>())
{
value=Value::From(text->GetText(), stringTypeDescriptor);
}
else if(Ptr<DescriptableObject> obj=resource.Cast<DescriptableObject>())
{
if (auto image = obj.Cast<GuiImageData>())
{
auto td = propertyValue.typeInfo.typeDescriptor;
if (auto prop = td->GetPropertyByName(propertyValue.propertyName.ToString(), true))
{
if (prop->GetReturn() && prop->GetReturn()->GetTypeDescriptor()->GetTypeName() == L"presentation::INativeImage")
{
obj = image->GetImage();
}
}
}
value = Value::From(obj);
}
if(!value.IsNull())
{
IGuiInstanceLoader::PropertyValue newValue = propertyValue;
newValue.propertyValue = value;
return loader->SetPropertyValue(newValue);
}
}
}
}
return false;
}
};
/***********************************************************************
GuiReferenceInstanceBinder
***********************************************************************/
class GuiReferenceInstanceBinder : public GuiTextInstanceBinderBase
{
public:
GlobalStringKey GetBindingName()override
{
return GlobalStringKey::_Ref;
}
bool SetPropertyValue(Ptr<GuiInstanceEnvironment> env, IGuiInstanceLoader* loader, GlobalStringKey instanceName, IGuiInstanceLoader::PropertyValue& propertyValue)override
{
if (propertyValue.propertyValue.GetValueType() == Value::Text)
{
GlobalStringKey name = GlobalStringKey::Get(propertyValue.propertyValue.GetText());
vint index = env->scope->referenceValues.Keys().IndexOf(name);
if (index != -1)
{
IGuiInstanceLoader::PropertyValue newValue = propertyValue;
newValue.propertyValue = env->scope->referenceValues.Values()[index];
if (!newValue.propertyValue.IsNull())
{
return loader->SetPropertyValue(newValue);
}
}
}
return false;
}
};
/***********************************************************************
GuiWorkflowGlobalContext
***********************************************************************/
class GuiWorkflowGlobalContext : public Object, public IGuiInstanceBindingContext
{
public:
List<WorkflowDataBinding> dataBindings;
Ptr<WfRuntimeGlobalContext> globalContext;
GuiWorkflowGlobalContext()
{
}
GlobalStringKey GetContextName()override
{
return GuiWorkflowCache::CacheContextName;
}
void Initialize(Ptr<GuiInstanceEnvironment> env)override
{
Ptr<WfAssembly> assembly;
vint cacheIndex = env->context->precompiledCaches.Keys().IndexOf(GetContextName());
if (cacheIndex != -1)
{
assembly = env->context->precompiledCaches.Values()[cacheIndex].Cast<GuiWorkflowCache>()->assembly;
}
else
{
types::VariableTypeMap types;
ITypeDescriptor* thisType = env->scope->rootInstance.GetTypeDescriptor();
Workflow_GetVariableTypes(env, types);
assembly = Workflow_CompileDataBinding(types, thisType, env->scope->errors, dataBindings);
env->context->precompiledCaches.Add(GetContextName(), new GuiWorkflowCache(assembly));
}
if (assembly)
{
globalContext = new WfRuntimeGlobalContext(assembly);
LoadFunction<void()>(globalContext, L"<initialize>")();
Workflow_SetVariablesForReferenceValues(globalContext, env);
{
vint index = assembly->variableNames.IndexOf(L"<this>");
globalContext->globalVariables->variables[index] = env->scope->rootInstance;
}
LoadFunction<void()>(globalContext, L"<initialize-data-binding>")();
}
}
};
/***********************************************************************
GuiScriptInstanceBinder
***********************************************************************/
class GuiScriptInstanceBinder : public GuiTextInstanceBinderBase
{
public:
virtual WString TranslateExpression(const WString& input) = 0;
bool RequireInstanceName()override
{
return true;
}
void GetRequiredContexts(collections::List<GlobalStringKey>& contextNames)override
{
contextNames.Add(GuiWorkflowCache::CacheContextName);
}
bool SetPropertyValue(Ptr<GuiInstanceEnvironment> env, IGuiInstanceLoader* loader, GlobalStringKey instanceName, IGuiInstanceLoader::PropertyValue& propertyValue)override
{
auto context = env->scope->bindingContexts[GuiWorkflowCache::CacheContextName].Cast<GuiWorkflowGlobalContext>();
WorkflowDataBinding dataBinding;
dataBinding.variableName = instanceName;
if (env->context->precompiledCaches.Keys().Contains(GuiWorkflowCache::CacheContextName))
{
goto SUCCESS;
}
if (propertyValue.propertyValue.GetValueType() == Value::Text)
{
WString expressionCode = TranslateExpression(propertyValue.propertyValue.GetText());
Ptr<WfExpression> expression;
types::VariableTypeMap types;
Workflow_GetVariableTypes(env, types);
if (Workflow_ValidateExpression(types, env->scope->errors, propertyValue, expressionCode, expression))
{
auto expr = expression;
if (auto bind = expr.Cast<WfBindExpression>())
{
bind->expandedExpression = 0;
expr = bind->expression;
}
if (auto format = expr.Cast<WfFormatExpression>())
{
format->expandedExpression = 0;
}
auto td = propertyValue.typeInfo.typeDescriptor;
auto propertyInfo = td->GetPropertyByName(propertyValue.propertyName.ToString(), true);
dataBinding.propertyInfo = propertyInfo;
dataBinding.bindExpression = expression;
goto SUCCESS;
}
else
{
goto FAILED;
}
}
FAILED:
context->dataBindings.Add(dataBinding);
return false;
SUCCESS:
context->dataBindings.Add(dataBinding);
return true;
}
};
/***********************************************************************
GuiEvalInstanceBinder
***********************************************************************/
class GuiEvalInstanceBinder : public GuiScriptInstanceBinder
{
public:
GlobalStringKey GetBindingName()override
{
return GlobalStringKey::_Eval;
}
bool ApplicableToConstructorArgument()override
{
return true;
}
description::Value GetValue(Ptr<GuiInstanceEnvironment> env, const description::Value& propertyValue)override
{
if (propertyValue.GetValueType() == Value::Text)
{
Ptr<WfAssembly> assembly;
WString expressionCode = TranslateExpression(propertyValue.GetText());
GlobalStringKey cacheKey = GlobalStringKey::Get(L"<att.eval>" + expressionCode);
vint cacheIndex = env->context->precompiledCaches.Keys().IndexOf(cacheKey);
if (cacheIndex != -1)
{
assembly = env->context->precompiledCaches.Values()[cacheIndex].Cast<GuiWorkflowCache>()->assembly;
}
else
{
types::VariableTypeMap types;
Workflow_GetVariableTypes(env, types);
assembly = Workflow_CompileExpression(types, env->scope->errors, expressionCode);
env->context->precompiledCaches.Add(cacheKey, new GuiWorkflowCache(assembly));
}
if (assembly)
{
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly);
LoadFunction<void()>(globalContext, L"<initialize>")();
Workflow_SetVariablesForReferenceValues(globalContext, env);
vint variableIndex = assembly->variableNames.IndexOf(L"<initialize-data-binding>");
auto variable = globalContext->globalVariables->variables[variableIndex];
auto proxy = UnboxValue<Ptr<IValueFunctionProxy>>(variable);
auto translated = proxy->Invoke(IValueList::Create());
// the global context contains a closure variable <initialize-data-binding> which captured the context
// clear all variables to break the circle references
globalContext->globalVariables = 0;
return translated;
}
}
return Value();
}
WString TranslateExpression(const WString& input)override
{
return input;
}
};
/***********************************************************************
GuiEvalInstanceEventBinder
***********************************************************************/
class GuiEvalInstanceEventBinder : public Object, public IGuiInstanceEventBinder
{
public:
GlobalStringKey GetBindingName()override
{
return GlobalStringKey::_Eval;
}
bool RequireInstanceName()override
{
return true;
}
void GetRequiredContexts(collections::List<GlobalStringKey>& contextNames)override
{
}
bool AttachEvent(Ptr<GuiInstanceEnvironment> env, IGuiInstanceLoader* loader, GlobalStringKey instanceName, IGuiInstanceLoader::PropertyValue& propertyValue)
{
auto handler = propertyValue.propertyValue;
if (handler.GetValueType() == Value::Text)
{
Ptr<WfAssembly> assembly;
WString statementCode = handler.GetText();
GlobalStringKey cacheKey = GlobalStringKey::Get(L"<ev.eval><" + instanceName.ToString() + L"><" + propertyValue.propertyName.ToString() + L">" + statementCode);
vint cacheIndex = env->context->precompiledCaches.Keys().IndexOf(cacheKey);
if (cacheIndex != -1)
{
assembly = env->context->precompiledCaches.Values()[cacheIndex].Cast<GuiWorkflowCache>()->assembly;
}
else
{
types::VariableTypeMap types;
Workflow_GetVariableTypes(env, types);
assembly = Workflow_CompileEventHandler(types, env->scope->errors, propertyValue, statementCode);
env->context->precompiledCaches.Add(cacheKey, new GuiWorkflowCache(assembly));
}
if (assembly)
{
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly);
LoadFunction<void()>(globalContext, L"<initialize>")();
Workflow_SetVariablesForReferenceValues(globalContext, env);
auto eventHandler = LoadFunction(globalContext, L"<event-handler>");
handler = BoxValue(eventHandler);
propertyValue.propertyValue = handler;
return loader->SetEventValue(propertyValue);
}
}
return false;
}
};
/***********************************************************************
GuiBindInstanceBinder
***********************************************************************/
class GuiBindInstanceBinder : public GuiScriptInstanceBinder
{
public:
GlobalStringKey GetBindingName()override
{
return GlobalStringKey::_Bind;
}
WString TranslateExpression(const WString& input)override
{
return L"bind(" + input + L")";
}
};
/***********************************************************************
GuiFormatInstanceBinder
***********************************************************************/
class GuiFormatInstanceBinder : public GuiScriptInstanceBinder
{
public:
GlobalStringKey GetBindingName()override
{
return GlobalStringKey::_Format;
}
WString TranslateExpression(const WString& input)override
{
return L"bind($\"" + input + L"\")";
}
};
/***********************************************************************
GuiPredefinedInstanceBindersPlugin
***********************************************************************/
class GuiPredefinedInstanceBindersPlugin : public Object, public IGuiPlugin
{
public:
GuiPredefinedInstanceBindersPlugin()
{
}
void Load()override
{
WfLoadTypes();
}
void AfterLoad()override
{
{
IGuiParserManager* manager = GetParserManager();
manager->SetParsingTable(L"WORKFLOW", &WfLoadTable);
manager->SetTableParser(L"WORKFLOW", L"WORKFLOW-EXPRESSION", &WfParseExpression);
manager->SetTableParser(L"WORKFLOW", L"WORKFLOW-STATEMENT", &WfParseStatement);
manager->SetTableParser(L"WORKFLOW", L"WORKFLOW-MODULE", &WfParseModule);
manager->SetParsingTable(L"INSTANCE-QUERY", &GuiIqLoadTable);
manager->SetTableParser(L"INSTANCE-QUERY", L"INSTANCE-QUERY", &GuiIqParse);
}
{
IGuiInstanceLoaderManager* manager=GetInstanceLoaderManager();
manager->AddInstanceBindingContextFactory(new GuiInstanceBindingContextFactory<GuiWorkflowGlobalContext>(GuiWorkflowCache::CacheContextName));
manager->AddInstanceBinder(new GuiResourceInstanceBinder);
manager->AddInstanceBinder(new GuiReferenceInstanceBinder);
manager->AddInstanceBinder(new GuiEvalInstanceBinder);
manager->AddInstanceEventBinder(new GuiEvalInstanceEventBinder);
manager->AddInstanceBinder(new GuiBindInstanceBinder);
manager->AddInstanceBinder(new GuiFormatInstanceBinder);
}
}
void Unload()override
{
}
};
GUI_REGISTER_PLUGIN(GuiPredefinedInstanceBindersPlugin)
}
}
/***********************************************************************
GuiInstanceLoader_PredefinedInstanceLoaders.cpp
***********************************************************************/
namespace vl
{
namespace presentation
{
using namespace collections;
using namespace reflection::description;
using namespace controls;
using namespace compositions;
using namespace theme;
using namespace helper_types;
#ifndef VCZH_DEBUG_NO_REFLECTION
/***********************************************************************
GuiVrtualTypeInstanceLoader
***********************************************************************/
class GuiTemplateControlInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
Func<Value()> defaultConstructor;
Func<Value(Ptr<GuiTemplate::IFactory>)> templateConstructor;
public:
GuiTemplateControlInstanceLoader(const WString& _typeName, const Func<Value()>& _defaultConstructor, const Func<Value(Ptr<GuiTemplate::IFactory>)>& _templateConstructor)
:typeName(GlobalStringKey::Get(_typeName))
, defaultConstructor(_defaultConstructor)
, templateConstructor(_templateConstructor)
{
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
bool IsCreatable(const TypeInfo& typeInfo)override
{
return typeName == typeInfo.typeName;
}
description::Value CreateInstance(Ptr<GuiInstanceEnvironment> env, const TypeInfo& typeInfo, collections::Group<GlobalStringKey, description::Value>& constructorArguments)override
{
if(typeName==typeInfo.typeName)
{
vint indexControlTemplate = constructorArguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
if (indexControlTemplate == -1)
{
return defaultConstructor();
}
else
{
auto factory = CreateTemplateFactory(constructorArguments.GetByIndex(indexControlTemplate)[0].GetText());
return templateConstructor(factory);
}
}
return Value();
}
void GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::_ControlTemplate);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == GlobalStringKey::_ControlTemplate)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<WString>());
info->constructorParameter = true;
return info;
}
return 0;
}
};
/***********************************************************************
GuiControlInstanceLoader
***********************************************************************/
class GuiControlInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
public:
GuiControlInstanceLoader()
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiControl>()->GetTypeName());
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::Empty);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == GlobalStringKey::Empty)
{
auto info = GuiInstancePropertyInfo::Collection();
info->acceptableTypes.Add(description::GetTypeDescriptor<GuiControl>());
info->acceptableTypes.Add(description::GetTypeDescriptor<GuiGraphicsComposition>());
if (propertyInfo.typeInfo.typeDescriptor->CanConvertTo(description::GetTypeDescriptor<GuiInstanceRootObject>()))
{
info->acceptableTypes.Add(description::GetTypeDescriptor<GuiComponent>());
}
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
if (auto container = dynamic_cast<GuiInstanceRootObject*>(propertyValue.instanceValue.GetRawPtr()))
{
if (propertyValue.propertyName == GlobalStringKey::Empty)
{
if (auto component = dynamic_cast<GuiComponent*>(propertyValue.propertyValue.GetRawPtr()))
{
container->AddComponent(component);
return true;
}
else if (auto controlHost = dynamic_cast<GuiControlHost*>(propertyValue.propertyValue.GetRawPtr()))
{
container->AddComponent(new GuiObjectComponent<GuiControlHost>(controlHost));
return true;
}
}
}
if (auto container = dynamic_cast<GuiControl*>(propertyValue.instanceValue.GetRawPtr()))
{
if (propertyValue.propertyName == GlobalStringKey::Empty)
{
if (auto control = dynamic_cast<GuiControl*>(propertyValue.propertyValue.GetRawPtr()))
{
container->AddChild(control);
return true;
}
else if (auto composition = dynamic_cast<GuiGraphicsComposition*>(propertyValue.propertyValue.GetRawPtr()))
{
container->GetContainerComposition()->AddChild(composition);
return true;
}
}
}
return false;
}
};
/***********************************************************************
GuiTabInstanceLoader
***********************************************************************/
class GuiTabInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
public:
GuiTabInstanceLoader()
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiTab>()->GetTypeName());
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
bool IsCreatable(const TypeInfo& typeInfo)override
{
return GetTypeName() == typeInfo.typeName;
}
description::Value CreateInstance(Ptr<GuiInstanceEnvironment> env, const TypeInfo& typeInfo, collections::Group<GlobalStringKey, description::Value>& constructorArguments)override
{
if(GetTypeName() == typeInfo.typeName)
{
vint indexControlTemplate = constructorArguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
if (indexControlTemplate == -1)
{
return Value::From(g::NewTab());
}
else
{
auto factory = CreateTemplateFactory(constructorArguments.GetByIndex(indexControlTemplate)[0].GetText());
return Value::From(new GuiTab(new GuiTabTemplate_StyleProvider(factory)));
}
}
return Value();
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::Empty);
}
void GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::_ControlTemplate);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == GlobalStringKey::Empty)
{
return GuiInstancePropertyInfo::CollectionWithParent(description::GetTypeDescriptor<GuiTabPage>());
}
else if (propertyInfo.propertyName == GlobalStringKey::_ControlTemplate)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<WString>());
info->constructorParameter = true;
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
if (GuiTab* container = dynamic_cast<GuiTab*>(propertyValue.instanceValue.GetRawPtr()))
{
if (propertyValue.propertyName == GlobalStringKey::Empty)
{
if (auto tabPage = dynamic_cast<GuiTabPage*>(propertyValue.propertyValue.GetRawPtr()))
{
container->CreatePage(tabPage);
return true;
}
}
}
return false;
}
};
/***********************************************************************
GuiTabPageInstanceLoader
***********************************************************************/
class GuiTabPageInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
public:
GuiTabPageInstanceLoader()
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiTabPage>()->GetTypeName());
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::Empty);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == GlobalStringKey::Empty)
{
auto info = GuiInstancePropertyInfo::Collection();
info->acceptableTypes.Add(description::GetTypeDescriptor<GuiControl>());
info->acceptableTypes.Add(description::GetTypeDescriptor<GuiGraphicsComposition>());
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
if (GuiTabPage* container = dynamic_cast<GuiTabPage*>(propertyValue.instanceValue.GetRawPtr()))
{
if (propertyValue.propertyName == GlobalStringKey::Empty)
{
if (auto control = dynamic_cast<GuiControl*>(propertyValue.propertyValue.GetRawPtr()))
{
container->GetContainerComposition()->AddChild(control->GetBoundsComposition());
return true;
}
else if (auto composition = dynamic_cast<GuiGraphicsComposition*>(propertyValue.propertyValue.GetRawPtr()))
{
container->GetContainerComposition()->AddChild(composition);
return true;
}
}
}
return false;
}
};
/***********************************************************************
GuiToolstripMenuInstanceLoader
***********************************************************************/
class GuiToolstripMenuInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
public:
GuiToolstripMenuInstanceLoader()
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiToolstripMenu>()->GetTypeName());
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
bool IsCreatable(const TypeInfo& typeInfo)override
{
return GetTypeName() == typeInfo.typeName;
}
description::Value CreateInstance(Ptr<GuiInstanceEnvironment> env, const TypeInfo& typeInfo, collections::Group<GlobalStringKey, description::Value>& constructorArguments)override
{
if(GetTypeName() == typeInfo.typeName)
{
vint indexControlTemplate = constructorArguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
if (indexControlTemplate == -1)
{
return Value::From(g::NewMenu(0));
}
else
{
auto factory = CreateTemplateFactory(constructorArguments.GetByIndex(indexControlTemplate)[0].GetText());
return Value::From(new GuiToolstripMenu(new GuiMenuTemplate_StyleProvider(factory), 0));
}
}
return Value();
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::Empty);
}
void GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::_ControlTemplate);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == GlobalStringKey::Empty)
{
return GuiInstancePropertyInfo::CollectionWithParent(description::GetTypeDescriptor<GuiControl>());
}
else if (propertyInfo.propertyName == GlobalStringKey::_ControlTemplate)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<WString>());
info->constructorParameter = true;
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
if (GuiToolstripMenu* container = dynamic_cast<GuiToolstripMenu*>(propertyValue.instanceValue.GetRawPtr()))
{
if (propertyValue.propertyName == GlobalStringKey::Empty)
{
if (auto control = dynamic_cast<GuiControl*>(propertyValue.propertyValue.GetRawPtr()))
{
container->GetToolstripItems().Add(control);
return true;
}
}
}
return false;
}
};
/***********************************************************************
GuiToolstripMenuBarInstanceLoader
***********************************************************************/
class GuiToolstripMenuBarInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
public:
GuiToolstripMenuBarInstanceLoader()
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiToolstripMenuBar>()->GetTypeName());
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
bool IsCreatable(const TypeInfo& typeInfo)override
{
return GetTypeName() == typeInfo.typeName;
}
description::Value CreateInstance(Ptr<GuiInstanceEnvironment> env, const TypeInfo& typeInfo, collections::Group<GlobalStringKey, description::Value>& constructorArguments)override
{
if(GetTypeName() == typeInfo.typeName)
{
vint indexControlTemplate = constructorArguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
if (indexControlTemplate == -1)
{
return Value::From(new GuiToolstripMenuBar(GetCurrentTheme()->CreateMenuBarStyle()));
}
else
{
auto factory = CreateTemplateFactory(constructorArguments.GetByIndex(indexControlTemplate)[0].GetText());
return Value::From(new GuiToolstripMenuBar(new GuiControlTemplate_StyleProvider(factory)));
}
}
return Value();
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::Empty);
}
void GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::_ControlTemplate);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == GlobalStringKey::Empty)
{
return GuiInstancePropertyInfo::CollectionWithParent(description::GetTypeDescriptor<GuiControl>());
}
else if (propertyInfo.propertyName == GlobalStringKey::_ControlTemplate)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<WString>());
info->constructorParameter = true;
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
if (GuiToolstripMenuBar* container = dynamic_cast<GuiToolstripMenuBar*>(propertyValue.instanceValue.GetRawPtr()))
{
if (propertyValue.propertyName == GlobalStringKey::Empty)
{
if (auto control = dynamic_cast<GuiControl*>(propertyValue.propertyValue.GetRawPtr()))
{
container->GetToolstripItems().Add(control);
return true;
}
}
}
return false;
}
};
/***********************************************************************
GuiToolstripToolBarInstanceLoader
***********************************************************************/
class GuiToolstripToolBarInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
public:
GuiToolstripToolBarInstanceLoader()
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiToolstripToolBar>()->GetTypeName());
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
bool IsCreatable(const TypeInfo& typeInfo)override
{
return GetTypeName() == typeInfo.typeName;
}
description::Value CreateInstance(Ptr<GuiInstanceEnvironment> env, const TypeInfo& typeInfo, collections::Group<GlobalStringKey, description::Value>& constructorArguments)override
{
if(GetTypeName() == typeInfo.typeName)
{
vint indexControlTemplate = constructorArguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
if (indexControlTemplate == -1)
{
return Value::From(new GuiToolstripToolBar(GetCurrentTheme()->CreateToolBarStyle()));
}
else
{
auto factory = CreateTemplateFactory(constructorArguments.GetByIndex(indexControlTemplate)[0].GetText());
return Value::From(new GuiToolstripToolBar(new GuiControlTemplate_StyleProvider(factory)));
}
}
return Value();
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::Empty);
}
void GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::_ControlTemplate);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == GlobalStringKey::Empty)
{
return GuiInstancePropertyInfo::CollectionWithParent(description::GetTypeDescriptor<GuiControl>());
}
else if (propertyInfo.propertyName == GlobalStringKey::_ControlTemplate)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<WString>());
info->constructorParameter = true;
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
if (GuiToolstripToolBar* container = dynamic_cast<GuiToolstripToolBar*>(propertyValue.instanceValue.GetRawPtr()))
{
if (propertyValue.propertyName == GlobalStringKey::Empty)
{
if (auto control = dynamic_cast<GuiControl*>(propertyValue.propertyValue.GetRawPtr()))
{
container->GetToolstripItems().Add(control);
return true;
}
}
}
return false;
}
};
/***********************************************************************
GuiToolstripButtonInstanceLoader
***********************************************************************/
class GuiToolstripButtonInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
GlobalStringKey _SubMenu;
public:
GuiToolstripButtonInstanceLoader()
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiToolstripButton>()->GetTypeName());
_SubMenu = GlobalStringKey::Get(L"SubMenu");
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
bool IsCreatable(const TypeInfo& typeInfo)override
{
return typeInfo.typeName == GetTypeName();
}
description::Value CreateInstance(Ptr<GuiInstanceEnvironment> env, const TypeInfo& typeInfo, collections::Group<GlobalStringKey, description::Value>& constructorArguments)override
{
if (typeInfo.typeName == GetTypeName())
{
vint indexControlTemplate = constructorArguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
if (indexControlTemplate == -1)
{
return Value::From(g::NewToolBarButton());
}
else
{
auto factory = CreateTemplateFactory(constructorArguments.GetByIndex(indexControlTemplate)[0].GetText());
return Value::From(new GuiToolstripButton(new GuiToolstripButtonTemplate_StyleProvider(factory)));
}
}
return Value();
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(_SubMenu);
}
void GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::_ControlTemplate);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == GlobalStringKey::_ControlTemplate)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<WString>());
info->constructorParameter = true;
return info;
}
else if (propertyInfo.propertyName == _SubMenu)
{
return GuiInstancePropertyInfo::Set(description::GetTypeDescriptor<GuiToolstripMenu>());
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool GetPropertyValue(PropertyValue& propertyValue)override
{
if (GuiToolstripButton* container = dynamic_cast<GuiToolstripButton*>(propertyValue.instanceValue.GetRawPtr()))
{
if (propertyValue.propertyName == _SubMenu)
{
if (!container->GetToolstripSubMenu())
{
container->CreateToolstripSubMenu();
}
propertyValue.propertyValue = Value::From(container->GetToolstripSubMenu());
return true;
}
}
return false;
}
};
/***********************************************************************
GuiSelectableListControlInstanceLoader
***********************************************************************/
class GuiSelectableListControlInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
public:
GuiSelectableListControlInstanceLoader()
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiSelectableListControl>()->GetTypeName());
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::_ItemTemplate);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == GlobalStringKey::_ItemTemplate)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<WString>());
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
if (GuiSelectableListControl* container = dynamic_cast<GuiSelectableListControl*>(propertyValue.instanceValue.GetRawPtr()))
{
if (propertyValue.propertyName == GlobalStringKey::_ItemTemplate)
{
auto factory = CreateTemplateFactory(propertyValue.propertyValue.GetText());
auto styleProvider = new GuiListItemTemplate_ItemStyleProvider(factory);
container->SetStyleProvider(styleProvider);
return true;
}
}
return false;
}
};
/***********************************************************************
GuiVirtualTreeViewInstanceLoader
***********************************************************************/
class GuiVirtualTreeViewInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
public:
GuiVirtualTreeViewInstanceLoader()
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiVirtualTreeView>()->GetTypeName());
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::_ItemTemplate);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == GlobalStringKey::_ItemTemplate)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<WString>());
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
if (propertyValue.propertyName == GlobalStringKey::_ItemTemplate)
{
return true;
}
return false;
}
};
/***********************************************************************
GuiVirtualDataGridInstanceLoader
***********************************************************************/
class GuiVirtualDataGridInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
public:
GuiVirtualDataGridInstanceLoader()
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiVirtualDataGrid>()->GetTypeName());
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::_ItemTemplate);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == GlobalStringKey::_ItemTemplate)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<WString>());
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
if (propertyValue.propertyName == GlobalStringKey::_ItemTemplate)
{
return true;
}
return false;
}
};
/***********************************************************************
GuiListViewInstanceLoader
***********************************************************************/
class GuiListViewInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
bool bindable;
GlobalStringKey typeName;
GlobalStringKey _View, _IconSize, _ItemSource;
public:
GuiListViewInstanceLoader(bool _bindable)
:bindable(_bindable)
{
if (bindable)
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiBindableListView>()->GetTypeName());
}
else
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiListView>()->GetTypeName());
}
_View = GlobalStringKey::Get(L"View");
_IconSize = GlobalStringKey::Get(L"IconSize");
_ItemSource = GlobalStringKey::Get(L"ItemSource");
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
bool IsCreatable(const TypeInfo& typeInfo)override
{
return typeInfo.typeName == GetTypeName();
}
description::Value CreateInstance(Ptr<GuiInstanceEnvironment> env, const TypeInfo& typeInfo, collections::Group<GlobalStringKey, description::Value>& constructorArguments)override
{
if (typeInfo.typeName == GetTypeName())
{
Ptr<IValueEnumerable> itemSource;
ListViewViewType viewType = ListViewViewType::Detail;
GuiListViewBase::IStyleProvider* styleProvider = 0;
Size iconSize;
{
vint itemSourceIndex = constructorArguments.Keys().IndexOf(_ItemSource);
if (itemSourceIndex != -1)
{
itemSource = UnboxValue<Ptr<IValueEnumerable>>(constructorArguments.GetByIndex(itemSourceIndex)[0]);
}
else if (bindable)
{
return Value();
}
vint indexView = constructorArguments.Keys().IndexOf(_View);
if (indexView != -1)
{
viewType = UnboxValue<ListViewViewType>(constructorArguments.GetByIndex(indexView)[0]);
}
vint indexIconSize = constructorArguments.Keys().IndexOf(_IconSize);
if (indexIconSize != -1)
{
iconSize = UnboxValue<Size>(constructorArguments.GetByIndex(indexIconSize)[0]);
}
vint indexControlTemplate = constructorArguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
if (indexControlTemplate == -1)
{
styleProvider = GetCurrentTheme()->CreateListViewStyle();
}
else
{
auto factory = CreateTemplateFactory(constructorArguments.GetByIndex(indexControlTemplate)[0].GetText());
styleProvider = new GuiListViewTemplate_StyleProvider(factory);
}
}
GuiVirtualListView* listView = 0;
if (bindable)
{
listView = new GuiBindableListView(styleProvider, itemSource);
}
else
{
listView = new GuiListView(styleProvider);
}
switch (viewType)
{
#define VIEW_TYPE_CASE(NAME)\
case ListViewViewType::NAME:\
if (iconSize == Size())\
{\
listView->ChangeItemStyle(new list::ListView##NAME##ContentProvider);\
}\
else\
{\
listView->ChangeItemStyle(new list::ListView##NAME##ContentProvider(iconSize, false));\
}\
break;\
VIEW_TYPE_CASE(BigIcon)
VIEW_TYPE_CASE(SmallIcon)
VIEW_TYPE_CASE(List)
VIEW_TYPE_CASE(Tile)
VIEW_TYPE_CASE(Information)
VIEW_TYPE_CASE(Detail)
#undef VIEW_TYPE_CASE
}
return Value::From(listView);
}
return Value();
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
}
void GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
if (typeInfo.typeName == GetTypeName())
{
propertyNames.Add(GlobalStringKey::_ControlTemplate);
propertyNames.Add(_View);
propertyNames.Add(_IconSize);
if (bindable)
{
propertyNames.Add(_ItemSource);
}
}
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == GlobalStringKey::_ControlTemplate)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<WString>());
info->constructorParameter = true;
return info;
}
else if (propertyInfo.propertyName == _View)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<ListViewViewType>());
info->constructorParameter = true;
return info;
}
else if (propertyInfo.propertyName == _IconSize)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<Size>());
info->constructorParameter = true;
return info;
}
else if (propertyInfo.propertyName == _ItemSource)
{
if (bindable)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<IValueEnumerable>());
info->constructorParameter = true;
info->required = true;
return info;
}
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
return false;
}
};
/***********************************************************************
GuiTreeViewInstanceLoader
***********************************************************************/
class GuiTreeViewInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
bool bindable;
GlobalStringKey typeName;
GlobalStringKey _IconSize, _ItemSource, _Nodes;
public:
GuiTreeViewInstanceLoader(bool _bindable)
:bindable(_bindable)
{
if (bindable)
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiBindableTreeView>()->GetTypeName());
}
else
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiTreeView>()->GetTypeName());
}
_IconSize = GlobalStringKey::Get(L"IconSize");
_ItemSource = GlobalStringKey::Get(L"ItemSource");
_Nodes = GlobalStringKey::Get(L"Nodes");
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
bool IsCreatable(const TypeInfo& typeInfo)override
{
return typeInfo.typeName == GetTypeName();
}
description::Value CreateInstance(Ptr<GuiInstanceEnvironment> env, const TypeInfo& typeInfo, collections::Group<GlobalStringKey, description::Value>& constructorArguments)override
{
if (typeInfo.typeName == GetTypeName())
{
vint indexItemSource = constructorArguments.Keys().IndexOf(_ItemSource);
GuiVirtualTreeView::IStyleProvider* styleProvider = 0;
{
vint indexControlTemplate = constructorArguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
if (indexControlTemplate == -1)
{
styleProvider = GetCurrentTheme()->CreateTreeViewStyle();
}
else
{
auto factory = CreateTemplateFactory(constructorArguments.GetByIndex(indexControlTemplate)[0].GetText());
styleProvider = new GuiTreeViewTemplate_StyleProvider(factory);
}
}
GuiVirtualTreeView* treeView = 0;
if (bindable)
{
if (indexItemSource == -1)
{
return Value();
}
auto itemSource = constructorArguments.GetByIndex(indexItemSource)[0];
treeView = new GuiBindableTreeView(styleProvider, itemSource);
}
else
{
treeView = new GuiTreeView(styleProvider);
}
vint indexIconSize = constructorArguments.Keys().IndexOf(_IconSize);
if (indexIconSize != -1)
{
auto iconSize = UnboxValue<Size>(constructorArguments.GetByIndex(indexIconSize)[0]);
treeView->SetNodeStyleProvider(new tree::TreeViewNodeItemStyleProvider(iconSize, false));
}
return Value::From(treeView);
}
return Value();
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
if (!bindable)
{
propertyNames.Add(_Nodes);
}
}
void GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
if (typeInfo.typeName == GetTypeName())
{
propertyNames.Add(GlobalStringKey::_ControlTemplate);
propertyNames.Add(_IconSize);
if (bindable)
{
propertyNames.Add(_ItemSource);
}
}
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == _Nodes)
{
if (!bindable)
{
return GuiInstancePropertyInfo::Collection(description::GetTypeDescriptor<tree::MemoryNodeProvider>());
}
}
else if (propertyInfo.propertyName == GlobalStringKey::_ControlTemplate)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<WString>());
info->constructorParameter = true;
return info;
}
else if (propertyInfo.propertyName == _ItemSource)
{
if (bindable)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<Value>());
info->constructorParameter = true;
info->required = true;
return info;
}
}
else if (propertyInfo.propertyName == _IconSize)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<Size>());
info->constructorParameter = true;
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
if (GuiTreeView* container = dynamic_cast<GuiTreeView*>(propertyValue.instanceValue.GetRawPtr()))
{
if (propertyValue.propertyName == _Nodes)
{
auto item = UnboxValue<Ptr<tree::MemoryNodeProvider>>(propertyValue.propertyValue);
container->Nodes()->Children().Add(item);
return true;
}
}
return false;
}
};
/***********************************************************************
GuiComboBoxInstanceLoader
***********************************************************************/
class GuiComboBoxInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
GlobalStringKey _ListControl;
public:
GuiComboBoxInstanceLoader()
:typeName(GlobalStringKey::Get(L"presentation::controls::GuiComboBox"))
{
_ListControl = GlobalStringKey::Get(L"ListControl");
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
bool IsCreatable(const TypeInfo& typeInfo)override
{
return typeInfo.typeName == GetTypeName();
}
description::Value CreateInstance(Ptr<GuiInstanceEnvironment> env, const TypeInfo& typeInfo, collections::Group<GlobalStringKey, description::Value>& constructorArguments)override
{
if (typeInfo.typeName == GetTypeName())
{
vint indexListControl = constructorArguments.Keys().IndexOf(_ListControl);
vint indexControlTemplate = constructorArguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
if (indexListControl != -1)
{
Ptr<GuiTemplate::IFactory> factory;
if (indexControlTemplate != -1)
{
factory = CreateTemplateFactory(constructorArguments.GetByIndex(indexControlTemplate)[0].GetText());
}
GuiComboBoxBase::IStyleController* styleController = 0;
if (factory)
{
styleController = new GuiComboBoxTemplate_StyleProvider(factory);
}
else
{
styleController = GetCurrentTheme()->CreateComboBoxStyle();
}
auto listControl = UnboxValue<GuiSelectableListControl*>(constructorArguments.GetByIndex(indexListControl)[0]);
auto comboBox = new GuiComboBoxListControl(styleController, listControl);
return Value::From(comboBox);
}
}
return Value();
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
if (typeInfo.typeName == GetTypeName())
{
propertyNames.Add(_ListControl);
}
}
void GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
if (typeInfo.typeName == GetTypeName())
{
propertyNames.Add(GlobalStringKey::_ControlTemplate);
propertyNames.Add(_ListControl);
}
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == _ListControl)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<GuiSelectableListControl>());
info->constructorParameter = true;
info->required = true;
return info;
}
else if (propertyInfo.propertyName == GlobalStringKey::_ControlTemplate)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<WString>());
info->constructorParameter = true;
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
};
/***********************************************************************
GuiBindableTextListInstanceLoader
***********************************************************************/
class GuiBindableTextListInstanceLoader : public Object, public IGuiInstanceLoader
{
typedef Func<list::TextItemStyleProvider::ITextItemStyleProvider*()> ItemStyleProviderFactory;
protected:
GlobalStringKey typeName;
ItemStyleProviderFactory itemStyleProviderFactory;
GlobalStringKey _ItemSource;
public:
GuiBindableTextListInstanceLoader(const WString& type, const ItemStyleProviderFactory& factory)
:typeName(GlobalStringKey::Get(L"presentation::controls::GuiBindable" + type + L"TextList"))
, itemStyleProviderFactory(factory)
{
_ItemSource = GlobalStringKey::Get(L"ItemSource");
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
bool IsCreatable(const TypeInfo& typeInfo)override
{
return typeInfo.typeName == GetTypeName();
}
description::Value CreateInstance(Ptr<GuiInstanceEnvironment> env, const TypeInfo& typeInfo, collections::Group<GlobalStringKey, description::Value>& constructorArguments)override
{
if (typeInfo.typeName == GetTypeName())
{
vint indexItemSource = constructorArguments.Keys().IndexOf(_ItemSource);
if (indexItemSource != -1)
{
GuiTextListTemplate_StyleProvider* styleProvider = 0;
{
vint indexControlTemplate = constructorArguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
if (indexControlTemplate != -1)
{
auto factory = CreateTemplateFactory(constructorArguments.GetByIndex(indexControlTemplate)[0].GetText());
styleProvider = new GuiTextListTemplate_StyleProvider(factory);
}
}
auto itemSource = UnboxValue<Ptr<IValueEnumerable>>(constructorArguments.GetByIndex(indexItemSource)[0]);
GuiBindableTextList* control = 0;
if (styleProvider)
{
control = new GuiBindableTextList(styleProvider, styleProvider->CreateArgument(), itemSource);
}
else
{
control = new GuiBindableTextList(GetCurrentTheme()->CreateTextListStyle(), itemStyleProviderFactory(), itemSource);
}
return Value::From(control);
}
}
return Value();
}
void GetConstructorParameters(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
if (typeInfo.typeName == GetTypeName())
{
propertyNames.Add(GlobalStringKey::_ControlTemplate);
propertyNames.Add(_ItemSource);
}
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == GlobalStringKey::_ControlTemplate)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<WString>());
info->constructorParameter = true;
return info;
}
if (propertyInfo.propertyName == _ItemSource)
{
auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<IValueEnumerable>());
info->constructorParameter = true;
info->required = true;
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
};
/***********************************************************************
GuiCompositionInstanceLoader
***********************************************************************/
class GuiCompositionInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
public:
GuiCompositionInstanceLoader()
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiGraphicsComposition>()->GetTypeName());
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(GlobalStringKey::Empty);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == GlobalStringKey::Empty)
{
auto info = GuiInstancePropertyInfo::Collection();
info->acceptableTypes.Add(description::GetTypeDescriptor<GuiControl>());
info->acceptableTypes.Add(description::GetTypeDescriptor<GuiGraphicsComposition>());
info->acceptableTypes.Add(description::GetTypeDescriptor<IGuiGraphicsElement>());
return info;
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
if (GuiGraphicsComposition* container = dynamic_cast<GuiGraphicsComposition*>(propertyValue.instanceValue.GetRawPtr()))
{
if (propertyValue.propertyName == GlobalStringKey::Empty)
{
if (auto control = dynamic_cast<GuiControl*>(propertyValue.propertyValue.GetRawPtr()))
{
container->AddChild(control->GetBoundsComposition());
return true;
}
else if(auto composition = dynamic_cast<GuiGraphicsComposition*>(propertyValue.propertyValue.GetRawPtr()))
{
container->AddChild(composition);
return true;
}
else if (Ptr<IGuiGraphicsElement> element = propertyValue.propertyValue.GetSharedPtr().Cast<IGuiGraphicsElement>())
{
container->SetOwnedElement(element);
return true;
}
}
}
return false;
}
};
/***********************************************************************
GuiTableCompositionInstanceLoader
***********************************************************************/
class GuiTableCompositionInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
GlobalStringKey _Rows, _Columns;
public:
GuiTableCompositionInstanceLoader()
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiTableComposition>()->GetTypeName());
_Rows = GlobalStringKey::Get(L"Rows");
_Columns = GlobalStringKey::Get(L"Columns");
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(_Rows);
propertyNames.Add(_Columns);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == _Rows || propertyInfo.propertyName == _Columns)
{
return GuiInstancePropertyInfo::Array(description::GetTypeDescriptor<GuiCellOption>());
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
if (GuiTableComposition* container = dynamic_cast<GuiTableComposition*>(propertyValue.instanceValue.GetRawPtr()))
{
if (propertyValue.propertyName == _Rows)
{
List<GuiCellOption> options;
CopyFrom(options, GetLazyList<GuiCellOption>(UnboxValue<Ptr<IValueList>>(propertyValue.propertyValue)));
container->SetRowsAndColumns(options.Count(), container->GetColumns());
FOREACH_INDEXER(GuiCellOption, option, index, options)
{
container->SetRowOption(index, option);
}
return true;
}
else if (propertyValue.propertyName == _Columns)
{
List<GuiCellOption> options;
CopyFrom(options, GetLazyList<GuiCellOption>(UnboxValue<Ptr<IValueList>>(propertyValue.propertyValue)));
container->SetRowsAndColumns(container->GetRows(), options.Count());
FOREACH_INDEXER(GuiCellOption, option, index, options)
{
container->SetColumnOption(index, option);
}
return true;
}
}
return false;
}
};
/***********************************************************************
GuiCellCompositionInstanceLoader
***********************************************************************/
class GuiCellCompositionInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
GlobalStringKey _Site;
public:
GuiCellCompositionInstanceLoader()
{
typeName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiCellComposition>()->GetTypeName());
_Site = GlobalStringKey::Get(L"Site");
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(_Site);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == _Site)
{
return GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<SiteValue>());
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
if (GuiCellComposition* container = dynamic_cast<GuiCellComposition*>(propertyValue.instanceValue.GetRawPtr()))
{
if (propertyValue.propertyName == _Site)
{
SiteValue site = UnboxValue<SiteValue>(propertyValue.propertyValue);
container->SetSite(site.row, site.column, site.rowSpan, site.columnSpan);
return true;
}
}
return false;
}
};
/***********************************************************************
GuiTreeNodeInstanceLoader
***********************************************************************/
class GuiTreeNodeInstanceLoader : public Object, public IGuiInstanceLoader
{
protected:
GlobalStringKey typeName;
GlobalStringKey _Text, _Image, _Tag;
public:
GuiTreeNodeInstanceLoader()
:typeName(GlobalStringKey::Get(L"presentation::controls::tree::TreeNode"))
{
_Text = GlobalStringKey::Get(L"Text");
_Image = GlobalStringKey::Get(L"Image");
_Tag = GlobalStringKey::Get(L"Tag");
}
GlobalStringKey GetTypeName()override
{
return typeName;
}
bool IsCreatable(const TypeInfo& typeInfo)override
{
return typeInfo.typeName == GetTypeName();
}
description::Value CreateInstance(Ptr<GuiInstanceEnvironment> env, const TypeInfo& typeInfo, collections::Group<GlobalStringKey, description::Value>& constructorArguments)override
{
if (typeInfo.typeName == GetTypeName())
{
Ptr<tree::TreeViewItem> item = new tree::TreeViewItem;
Ptr<tree::MemoryNodeProvider> node = new tree::MemoryNodeProvider(item);
return Value::From(node);
}
return Value();
}
void GetPropertyNames(const TypeInfo& typeInfo, collections::List<GlobalStringKey>& propertyNames)override
{
propertyNames.Add(_Text);
propertyNames.Add(_Image);
propertyNames.Add(_Tag);
propertyNames.Add(GlobalStringKey::Empty);
}
Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo)override
{
if (propertyInfo.propertyName == _Text)
{
return GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<WString>());
}
else if (propertyInfo.propertyName == _Image)
{
return GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<GuiImageData>());
}
else if (propertyInfo.propertyName == _Tag)
{
return GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor<Value>());
}
else if (propertyInfo.propertyName == GlobalStringKey::Empty)
{
return GuiInstancePropertyInfo::Collection(description::GetTypeDescriptor<tree::MemoryNodeProvider>());
}
return IGuiInstanceLoader::GetPropertyType(propertyInfo);
}
bool SetPropertyValue(PropertyValue& propertyValue)override
{
if (tree::MemoryNodeProvider* container = dynamic_cast<tree::MemoryNodeProvider*>(propertyValue.instanceValue.GetRawPtr()))
{
if (propertyValue.propertyName == _Text)
{
if (auto item = container->GetData().Cast<tree::TreeViewItem>())
{
item->text = UnboxValue<WString>(propertyValue.propertyValue);
container->NotifyDataModified();
return true;
}
}
else if (propertyValue.propertyName == _Image)
{
if (auto item = container->GetData().Cast<tree::TreeViewItem>())
{
item->image = UnboxValue<Ptr<GuiImageData>>(propertyValue.propertyValue);
container->NotifyDataModified();
return true;
}
}
else if (propertyValue.propertyName == _Tag)
{
if (auto item = container->GetData().Cast<tree::TreeViewItem>())
{
item->tag = propertyValue.propertyValue;
return true;
}
}
else if (propertyValue.propertyName == GlobalStringKey::Empty)
{
auto item = UnboxValue<Ptr<tree::MemoryNodeProvider>>(propertyValue.propertyValue);
container->Children().Add(item);
return true;
}
}
return false;
}
};
#endif
/***********************************************************************
GuiPredefinedInstanceLoadersPlugin
***********************************************************************/
void InitializeTrackerProgressBar(GuiScroll* control)
{
control->SetPageSize(0);
}
class GuiPredefinedInstanceLoadersPlugin : public Object, public IGuiPlugin
{
public:
void Load()override
{
}
void AfterLoad()override
{
#ifndef VCZH_DEBUG_NO_REFLECTION
IGuiInstanceLoaderManager* manager=GetInstanceLoaderManager();
#define ADD_VIRTUAL_TYPE_LOADER(TYPENAME, LOADER)\
manager->CreateVirtualType(\
GlobalStringKey::Get(description::GetTypeDescriptor<TYPENAME>()->GetTypeName()),\
new LOADER\
)
#define ADD_TEMPLATE_CONTROL(TYPENAME, CONSTRUCTOR, TEMPLATE)\
manager->SetLoader(\
new GuiTemplateControlInstanceLoader(\
L"presentation::controls::" L ## #TYPENAME,\
[](){return Value::From(CONSTRUCTOR());},\
[](Ptr<GuiTemplate::IFactory> factory){return Value::From(new TYPENAME(new TEMPLATE##_StyleProvider(factory))); }\
)\
)
#define ADD_TEMPLATE_CONTROL_2(TYPENAME, CONSTRUCTOR, TEMPLATE)\
manager->SetLoader(\
new GuiTemplateControlInstanceLoader(\
L"presentation::controls::" L ## #TYPENAME,\
[](){return Value::From(CONSTRUCTOR());},\
[](Ptr<GuiTemplate::IFactory> factory)\
{\
auto style = new TEMPLATE##_StyleProvider(factory);\
auto argument = style->CreateArgument();\
return Value::From(new TYPENAME(style, argument));\
}\
)\
)
#define ADD_VIRTUAL_CONTROL(VIRTUALTYPENAME, TYPENAME, CONSTRUCTOR, TEMPLATE)\
manager->CreateVirtualType(\
GlobalStringKey::Get(description::GetTypeDescriptor<TYPENAME>()->GetTypeName()),\
new GuiTemplateControlInstanceLoader(\
L"presentation::controls::Gui" L ## #VIRTUALTYPENAME,\
[](){return Value::From(CONSTRUCTOR());},\
[](Ptr<GuiTemplate::IFactory> factory){return Value::From(new TYPENAME(new TEMPLATE##_StyleProvider(factory))); }\
)\
)
#define ADD_VIRTUAL_CONTROL_2(VIRTUALTYPENAME, TYPENAME, CONSTRUCTOR, TEMPLATE)\
manager->CreateVirtualType(\
GlobalStringKey::Get(description::GetTypeDescriptor<TYPENAME>()->GetTypeName()),\
new GuiTemplateControlInstanceLoader(\
L"presentation::controls::Gui" L ## #VIRTUALTYPENAME,\
[](){return Value::From(CONSTRUCTOR());},\
[](Ptr<GuiTemplate::IFactory> factory)\
{\
auto style = new TEMPLATE##_StyleProvider(factory);\
auto argument = style->CreateArgument();\
return Value::From(new TYPENAME(style, argument));\
}\
)\
)
#define ADD_VIRTUAL_CONTROL_F(VIRTUALTYPENAME, TYPENAME, CONSTRUCTOR, TEMPLATE, FUNCTION)\
manager->CreateVirtualType(\
GlobalStringKey::Get(description::GetTypeDescriptor<TYPENAME>()->GetTypeName()),\
new GuiTemplateControlInstanceLoader(\
L"presentation::controls::Gui" L ## #VIRTUALTYPENAME,\
[](){return Value::From(CONSTRUCTOR());},\
[](Ptr<GuiTemplate::IFactory> factory)\
{\
auto control = new TYPENAME(new TEMPLATE##_StyleProvider(factory));\
FUNCTION(control);\
return Value::From(control);\
}\
)\
)
manager->SetLoader(new GuiControlInstanceLoader);
manager->SetLoader(new GuiTabInstanceLoader); // ControlTemplate
manager->SetLoader(new GuiTabPageInstanceLoader);
manager->SetLoader(new GuiToolstripMenuInstanceLoader); // ControlTemplate
manager->SetLoader(new GuiToolstripMenuBarInstanceLoader); // ControlTemplate
manager->SetLoader(new GuiToolstripToolBarInstanceLoader); // ControlTemplate
manager->SetLoader(new GuiToolstripButtonInstanceLoader); // ControlTemplate
manager->SetLoader(new GuiSelectableListControlInstanceLoader); // ItemTemplate
manager->SetLoader(new GuiVirtualTreeViewInstanceLoader); // ItemTemplate
manager->SetLoader(new GuiVirtualDataGridInstanceLoader); // ItemTemplate
manager->SetLoader(new GuiListViewInstanceLoader(false)); // ControlTemplate
manager->SetLoader(new GuiTreeViewInstanceLoader(false)); // ControlTemplate
manager->SetLoader(new GuiBindableTextListInstanceLoader(L"", [](){return GetCurrentTheme()->CreateTextListItemStyle(); })); // ControlTemplate, ItemSource
manager->SetLoader(new GuiListViewInstanceLoader(true)); // ControlTemplate, ItemSource
manager->SetLoader(new GuiTreeViewInstanceLoader(true)); // ControlTemplate, ItemSource
manager->SetLoader(new GuiCompositionInstanceLoader);
manager->SetLoader(new GuiTableCompositionInstanceLoader);
manager->SetLoader(new GuiCellCompositionInstanceLoader);
ADD_VIRTUAL_TYPE_LOADER(GuiComboBoxListControl, GuiComboBoxInstanceLoader); // ControlTemplate
ADD_VIRTUAL_TYPE_LOADER(tree::MemoryNodeProvider, GuiTreeNodeInstanceLoader);
ADD_TEMPLATE_CONTROL ( GuiCustomControl, g::NewCustomControl, GuiControlTemplate); // ControlTemplate
ADD_TEMPLATE_CONTROL ( GuiLabel, g::NewLabel, GuiLabelTemplate); // ControlTemplate
ADD_TEMPLATE_CONTROL ( GuiButton, g::NewButton, GuiButtonTemplate); // ControlTemplate
ADD_TEMPLATE_CONTROL ( GuiScrollContainer, g::NewScrollContainer, GuiScrollViewTemplate); // ControlTemplate
ADD_TEMPLATE_CONTROL ( GuiWindow, g::NewWindow, GuiWindowTemplate); // ControlTemplate
ADD_TEMPLATE_CONTROL_2 ( GuiTextList, g::NewTextList, GuiTextListTemplate); // ControlTemplate
ADD_TEMPLATE_CONTROL ( GuiDocumentViewer, g::NewDocumentViewer, GuiScrollViewTemplate); // ControlTemplate
ADD_TEMPLATE_CONTROL ( GuiDocumentLabel, g::NewDocumentLabel, GuiControlTemplate); // ControlTemplate
ADD_TEMPLATE_CONTROL ( GuiMultilineTextBox, g::NewMultilineTextBox, GuiMultilineTextBoxTemplate); // ControlTemplate
ADD_TEMPLATE_CONTROL ( GuiSinglelineTextBox, g::NewTextBox, GuiSinglelineTextBoxTemplate); // ControlTemplate
ADD_TEMPLATE_CONTROL ( GuiDatePicker, g::NewDatePicker, GuiDatePickerTemplate); // ControlTemplate
ADD_TEMPLATE_CONTROL_2 ( GuiDateComboBox, g::NewDateComboBox, GuiDateComboBoxTemplate); // ControlTemplate
ADD_TEMPLATE_CONTROL ( GuiStringGrid, g::NewStringGrid, GuiListViewTemplate); // ControlTemplate
// ControlTemplate
ADD_VIRTUAL_CONTROL (GroupBox, GuiControl, g::NewGroupBox, GuiControlTemplate); // ControlTemplate
ADD_VIRTUAL_CONTROL (MenuSplitter, GuiControl, g::NewMenuSplitter, GuiControlTemplate); // ControlTemplate
ADD_VIRTUAL_CONTROL (MenuBarButton, GuiToolstripButton, g::NewMenuBarButton, GuiToolstripButtonTemplate); // ControlTemplate
ADD_VIRTUAL_CONTROL (MenuItemButton, GuiToolstripButton, g::NewMenuItemButton, GuiToolstripButtonTemplate); // ControlTemplate
ADD_VIRTUAL_CONTROL (ToolstripDropdownButton, GuiToolstripButton, g::NewToolBarDropdownButton, GuiToolstripButtonTemplate); // ControlTemplate
ADD_VIRTUAL_CONTROL (ToolstripSplitButton, GuiToolstripButton, g::NewToolBarSplitButton, GuiToolstripButtonTemplate); // ControlTemplate
ADD_VIRTUAL_CONTROL (ToolstripSplitter, GuiControl, g::NewToolBarSplitter, GuiControlTemplate); // ControlTemplate
ADD_VIRTUAL_CONTROL (CheckBox, GuiSelectableButton, g::NewCheckBox, GuiSelectableButtonTemplate); // ControlTemplate
ADD_VIRTUAL_CONTROL (RadioButton, GuiSelectableButton, g::NewRadioButton, GuiSelectableButtonTemplate); // ControlTemplate
ADD_VIRTUAL_CONTROL (HScroll, GuiScroll, g::NewHScroll, GuiScrollTemplate); // ControlTemplate
ADD_VIRTUAL_CONTROL (VScroll, GuiScroll, g::NewVScroll, GuiScrollTemplate); // ControlTemplate
ADD_VIRTUAL_CONTROL_F (HTracker, GuiScroll, g::NewHTracker, GuiScrollTemplate, InitializeTrackerProgressBar); // ControlTemplate
ADD_VIRTUAL_CONTROL_F (VTracker, GuiScroll, g::NewVTracker, GuiScrollTemplate, InitializeTrackerProgressBar); // ControlTemplate
ADD_VIRTUAL_CONTROL_F (ProgressBar, GuiScroll, g::NewProgressBar, GuiScrollTemplate, InitializeTrackerProgressBar); // ControlTemplate
ADD_VIRTUAL_CONTROL_2 (CheckTextList, GuiTextList, g::NewCheckTextList, GuiTextListTemplate); // ControlTemplate
ADD_VIRTUAL_CONTROL_2 (RadioTextList, GuiTextList, g::NewRadioTextList, GuiTextListTemplate); // ControlTemplate
auto bindableTextListName = GlobalStringKey::Get(description::GetTypeDescriptor<GuiBindableTextList>()->GetTypeName()); // ControlTemplate, ItemSource
manager->CreateVirtualType(bindableTextListName, new GuiBindableTextListInstanceLoader(L"Check", [](){return GetCurrentTheme()->CreateCheckTextListItemStyle(); }));
manager->CreateVirtualType(bindableTextListName, new GuiBindableTextListInstanceLoader(L"Radio", [](){return GetCurrentTheme()->CreateRadioTextListItemStyle(); }));
#undef ADD_VIRTUAL_TYPE
#undef ADD_VIRTUAL_TYPE_LOADER
#endif
}
void Unload()override
{
}
};
GUI_REGISTER_PLUGIN(GuiPredefinedInstanceLoadersPlugin)
}
}
/***********************************************************************
GuiInstanceLoader_WorkflowCompiler.cpp
***********************************************************************/
namespace vl
{
namespace presentation
{
using namespace workflow;
using namespace workflow::analyzer;
using namespace workflow::runtime;
using namespace reflection::description;
using namespace collections;
#define ERROR_CODE_PREFIX L"================================================================"
/***********************************************************************
Variable
***********************************************************************/
void Workflow_CreatePointerVariable(Ptr<workflow::WfModule> module, GlobalStringKey name, description::ITypeDescriptor* type)
{
auto var = MakePtr<WfVariableDeclaration>();
var->name.value = name.ToString();
{
Ptr<TypeInfoImpl> elementType = new TypeInfoImpl(ITypeInfo::TypeDescriptor);
elementType->SetTypeDescriptor(type);
Ptr<TypeInfoImpl> pointerType = new TypeInfoImpl(ITypeInfo::RawPtr);
pointerType->SetElementType(elementType);
var->type = GetTypeFromTypeInfo(pointerType.Obj());
}
auto literal = MakePtr<WfLiteralExpression>();
literal->value = WfLiteralValue::Null;
var->expression = literal;
module->declarations.Add(var);
}
void Workflow_GetVariableTypes(Ptr<GuiInstanceEnvironment> env, types::VariableTypeMap& types)
{
FOREACH_INDEXER(GlobalStringKey, name, index, env->scope->referenceValues.Keys())
{
auto value = env->scope->referenceValues.Values()[index];
types.Add(name, value.GetTypeDescriptor());
}
}
void Workflow_CreateVariablesForReferenceValues(Ptr<workflow::WfModule> module, types::VariableTypeMap& types)
{
for (vint i = 0; i < types.Count(); i++)
{
auto key = types.Keys()[i];
auto value = types.Values()[i];
Workflow_CreatePointerVariable(module, key, value);
}
}
void Workflow_SetVariablesForReferenceValues(Ptr<workflow::runtime::WfRuntimeGlobalContext> context, Ptr<GuiInstanceEnvironment> env)
{
FOREACH_INDEXER(GlobalStringKey, name, index, env->scope->referenceValues.Keys())
{
vint variableIndex = context->assembly->variableNames.IndexOf(name.ToString());
if (variableIndex != -1)
{
context->globalVariables->variables[variableIndex] = env->scope->referenceValues.Values()[index];
}
}
}
/***********************************************************************
Workflow_ValidateExpression
***********************************************************************/
bool Workflow_ValidateExpression(types::VariableTypeMap& types, types::ErrorList& errors, IGuiInstanceLoader::PropertyInfo& bindingTarget, const WString& expressionCode, Ptr<workflow::WfExpression>& expression)
{
auto parser = GetParserManager()->GetParser<WfExpression>(L"WORKFLOW-EXPRESSION");
expression = parser->TypedParse(expressionCode, errors);
if (!expression)
{
errors.Add(ERROR_CODE_PREFIX L"Failed to parse the workflow expression.");
return false;
}
bool failed = false;
auto td = bindingTarget.typeInfo.typeDescriptor;
auto propertyInfo = td->GetPropertyByName(bindingTarget.propertyName.ToString(), true);
if (!propertyInfo)
{
errors.Add(ERROR_CODE_PREFIX L"Property \"" + bindingTarget.propertyName.ToString() + L"\" does not exist in type \"" + td->GetTypeName() + L"\".");
failed = true;
}
else if (!propertyInfo->IsReadable() || !propertyInfo->IsWritable())
{
errors.Add(ERROR_CODE_PREFIX L"Property \"" + bindingTarget.propertyName.ToString() + L"\" of type \"" + td->GetTypeName() + L"\" should be both readable and writable.");
failed = true;
}
auto module = MakePtr<WfModule>();
Workflow_CreateVariablesForReferenceValues(module, types);
{
auto func = MakePtr<WfFunctionDeclaration>();
func->anonymity = WfFunctionAnonymity::Named;
func->name.value = L"<initialize-data-binding>";
func->returnType = GetTypeFromTypeInfo(TypeInfoRetriver<void>::CreateTypeInfo().Obj());
auto stat = MakePtr<WfExpressionStatement>();
stat->expression = expression;
func->statement = stat;
module->declarations.Add(func);
}
Workflow_GetSharedManager()->Clear(true, true);
Workflow_GetSharedManager()->modules.Add(module);
Workflow_GetSharedManager()->Rebuild(true);
if (Workflow_GetSharedManager()->errors.Count() > 0)
{
errors.Add(ERROR_CODE_PREFIX L"Failed to analyze the workflow expression \"" + expressionCode + L"\".");
FOREACH(Ptr<parsing::ParsingError>, error, Workflow_GetSharedManager()->errors)
{
errors.Add(error->errorMessage);
}
failed = true;
}
else if (propertyInfo)
{
auto bind = expression.Cast<WfBindExpression>();
auto result = Workflow_GetSharedManager()->expressionResolvings[(bind ? bind->expression : expression).Obj()];
if (result.type)
{
ITypeInfo* propertyType = propertyInfo->GetReturn();
if (propertyInfo->GetSetter() && propertyInfo->GetSetter()->GetParameterCount() == 1)
{
propertyType = propertyInfo->GetSetter()->GetParameter(0)->GetType();
}
if (!CanConvertToType(result.type.Obj(), propertyType, false))
{
errors.Add(ERROR_CODE_PREFIX L"Failed to analyze the workflow expression \"" + expressionCode + L"\".");
errors.Add(
WfErrors::ExpressionCannotImplicitlyConvertToType(expression.Obj(), result.type.Obj(), propertyType)
->errorMessage);
failed = true;
}
}
}
return !failed;
}
/***********************************************************************
Workflow_CompileExpression
***********************************************************************/
Ptr<workflow::runtime::WfAssembly> Workflow_CompileExpression(types::VariableTypeMap& types, types::ErrorList& errors, const WString& expressionCode)
{
auto parser = GetParserManager()->GetParser<WfExpression>(L"WORKFLOW-EXPRESSION");
auto expression = parser->TypedParse(expressionCode, errors);
if (!expression)
{
errors.Add(ERROR_CODE_PREFIX L"Failed to parse the workflow expression \"" + expressionCode + L"\".");
return 0;
}
auto module = MakePtr<WfModule>();
Workflow_CreateVariablesForReferenceValues(module, types);
{
auto lambda = MakePtr<WfOrderedLambdaExpression>();
lambda->body = expression;
auto var = MakePtr<WfVariableDeclaration>();
var->name.value = L"<initialize-data-binding>";
var->expression = lambda;
module->declarations.Add(var);
}
Workflow_GetSharedManager()->Clear(true, true);
Workflow_GetSharedManager()->modules.Add(module);
Workflow_GetSharedManager()->Rebuild(true);
if (Workflow_GetSharedManager()->errors.Count() > 0)
{
errors.Add(ERROR_CODE_PREFIX L"Failed to analyze the workflow expression \"" + expressionCode + L"\".");
FOREACH(Ptr<parsing::ParsingError>, error, Workflow_GetSharedManager()->errors)
{
errors.Add(error->errorMessage);
}
return 0;
}
return GenerateAssembly(Workflow_GetSharedManager());
}
/***********************************************************************
Workflow_CompileEventHandler
***********************************************************************/
Ptr<workflow::runtime::WfAssembly> Workflow_CompileEventHandler(types::VariableTypeMap& types, types::ErrorList& errors, IGuiInstanceLoader::PropertyInfo& bindingTarget, const WString& statementCode)
{
auto parser = GetParserManager()->GetParser<WfStatement>(L"WORKFLOW-STATEMENT");
auto statement = parser->TypedParse(statementCode, errors);
if (!statement)
{
errors.Add(ERROR_CODE_PREFIX L"Failed to parse the workflow statement.");
return 0;
}
auto module = MakePtr<WfModule>();
Workflow_CreateVariablesForReferenceValues(module, types);
{
auto func = MakePtr<WfFunctionDeclaration>();
func->anonymity = WfFunctionAnonymity::Named;
func->name.value = L"<event-handler>";
func->returnType = GetTypeFromTypeInfo(TypeInfoRetriver<void>::CreateTypeInfo().Obj());
auto td = bindingTarget.typeInfo.typeDescriptor;
auto eventInfo = td->GetEventByName(bindingTarget.propertyName.ToString(), true);
if (eventInfo)
{
vint count = eventInfo->GetHandlerType()->GetElementType()->GetGenericArgumentCount() - 1;
auto type = TypeInfoRetriver<Value>::CreateTypeInfo();
for (vint i = 0; i < count; i++)
{
auto arg = MakePtr<WfFunctionArgument>();
arg->name.value = L"<argument>" + itow(i + 1);
arg->type = GetTypeFromTypeInfo(type.Obj());
func->arguments.Add(arg);
}
}
auto block = MakePtr<WfBlockStatement>();
block->statements.Add(statement);
func->statement = block;
module->declarations.Add(func);
}
Workflow_GetSharedManager()->Clear(true, true);
Workflow_GetSharedManager()->modules.Add(module);
Workflow_GetSharedManager()->Rebuild(true);
if (Workflow_GetSharedManager()->errors.Count() > 0)
{
errors.Add(ERROR_CODE_PREFIX L"Failed to analyze the workflow statement \"" + statementCode + L"\".");
FOREACH(Ptr<parsing::ParsingError>, error, Workflow_GetSharedManager()->errors)
{
errors.Add(error->errorMessage);
}
return 0;
}
return GenerateAssembly(Workflow_GetSharedManager());
}
/***********************************************************************
Workflow_CompileDataBinding
***********************************************************************/
WString Workflow_ModuleToString(Ptr<workflow::WfModule> module)
{
stream::MemoryStream stream;
{
stream::StreamWriter writer(stream);
WfPrint(module, L"", writer);
}
stream.SeekFromBegin(0);
stream::StreamReader reader(stream);
return reader.ReadToEnd();
}
Ptr<workflow::runtime::WfAssembly> Workflow_CompileDataBinding(types::VariableTypeMap& types, description::ITypeDescriptor* thisType, types::ErrorList& errors, collections::List<WorkflowDataBinding>& dataBindings)
{
auto module = MakePtr<WfModule>();
Workflow_CreateVariablesForReferenceValues(module, types);
Workflow_CreatePointerVariable(module, GlobalStringKey::Get(L"<this>"), thisType);
auto func = MakePtr<WfFunctionDeclaration>();
func->anonymity = WfFunctionAnonymity::Named;
func->name.value = L"<initialize-data-binding>";
func->returnType = GetTypeFromTypeInfo(TypeInfoRetriver<void>::CreateTypeInfo().Obj());
auto block = MakePtr<WfBlockStatement>();
func->statement = block;
module->declarations.Add(func);
FOREACH(WorkflowDataBinding, dataBinding, dataBindings)
{
if (dataBinding.bindExpression.Cast<WfBindExpression>())
{
auto subBlock = MakePtr<WfBlockStatement>();
block->statements.Add(subBlock);
{
auto refThis = MakePtr<WfReferenceExpression>();
refThis->name.value = L"<this>";
auto member = MakePtr<WfMemberExpression>();
member->parent = refThis;
member->name.value = L"AddSubscription";
auto call = MakePtr<WfCallExpression>();
call->function = member;
call->arguments.Add(dataBinding.bindExpression);
auto var = MakePtr<WfVariableDeclaration>();
var->name.value = L"<subscription>";
var->expression = call;
auto stat = MakePtr<WfVariableStatement>();
stat->variable = var;
subBlock->statements.Add(stat);
}
{
auto callback = MakePtr<WfFunctionDeclaration>();
callback->anonymity = WfFunctionAnonymity::Anonymous;
callback->returnType = GetTypeFromTypeInfo(TypeInfoRetriver<void>::CreateTypeInfo().Obj());;
{
auto arg = MakePtr<WfFunctionArgument>();
arg->name.value = L"<value>";
arg->type = GetTypeFromTypeInfo(TypeInfoRetriver<Value>::CreateTypeInfo().Obj());
callback->arguments.Add(arg);
}
auto callbackBlock = MakePtr<WfBlockStatement>();
callback->statement = callbackBlock;
{
auto refSubscribee = MakePtr<WfReferenceExpression>();
refSubscribee->name.value = dataBinding.variableName.ToString();
auto member = MakePtr<WfMemberExpression>();
member->parent = refSubscribee;
member->name.value = dataBinding.propertyInfo->GetName();
auto var = MakePtr<WfVariableDeclaration>();
var->name.value = L"<old>";
var->expression = member;
auto stat = MakePtr<WfVariableStatement>();
stat->variable = var;
callbackBlock->statements.Add(stat);
}
{
ITypeInfo* propertyType = dataBinding.propertyInfo->GetReturn();
if (dataBinding.propertyInfo->GetSetter() && dataBinding.propertyInfo->GetSetter()->GetParameterCount() == 1)
{
propertyType = dataBinding.propertyInfo->GetSetter()->GetParameter(0)->GetType();
}
auto refValue = MakePtr<WfReferenceExpression>();
refValue->name.value = L"<value>";
auto cast = MakePtr<WfTypeCastingExpression>();
cast->strategy = WfTypeCastingStrategy::Strong;
cast->expression = refValue;
cast->type = GetTypeFromTypeInfo(propertyType);
auto var = MakePtr<WfVariableDeclaration>();
var->name.value = L"<new>";
var->expression = cast;
auto stat = MakePtr<WfVariableStatement>();
stat->variable = var;
callbackBlock->statements.Add(stat);
}
{
auto refOld = MakePtr<WfReferenceExpression>();
refOld->name.value = L"<old>";
auto refNew = MakePtr<WfReferenceExpression>();
refNew->name.value = L"<new>";
auto compare = MakePtr<WfBinaryExpression>();
compare->op = WfBinaryOperator::EQ;
compare->first = refOld;
compare->second = refNew;
auto ifStat = MakePtr<WfIfStatement>();
ifStat->expression = compare;
callbackBlock->statements.Add(ifStat);
auto ifBlock = MakePtr<WfBlockStatement>();
ifStat->trueBranch = ifBlock;
auto returnStat = MakePtr<WfReturnStatement>();
ifBlock->statements.Add(returnStat);
}
{
auto refSubscribee = MakePtr<WfReferenceExpression>();
refSubscribee->name.value = dataBinding.variableName.ToString();
auto member = MakePtr<WfMemberExpression>();
member->parent = refSubscribee;
member->name.value = dataBinding.propertyInfo->GetName();
auto refNew = MakePtr<WfReferenceExpression>();
refNew->name.value = L"<new>";
auto assign = MakePtr<WfBinaryExpression>();
assign->op = WfBinaryOperator::Assign;
assign->first = member;
assign->second = refNew;
auto stat = MakePtr<WfExpressionStatement>();
stat->expression = assign;
callbackBlock->statements.Add(stat);
}
auto funcExpr = MakePtr<WfFunctionExpression>();
funcExpr->function = callback;
auto refThis = MakePtr<WfReferenceExpression>();
refThis->name.value = L"<subscription>";
auto member = MakePtr<WfMemberExpression>();
member->parent = refThis;
member->name.value = L"Subscribe";
auto call = MakePtr<WfCallExpression>();
call->function = member;
call->arguments.Add(funcExpr);
auto stat = MakePtr<WfExpressionStatement>();
stat->expression = call;
subBlock->statements.Add(stat);
}
{
auto refThis = MakePtr<WfReferenceExpression>();
refThis->name.value = L"<subscription>";
auto member = MakePtr<WfMemberExpression>();
member->parent = refThis;
member->name.value = L"Update";
auto call = MakePtr<WfCallExpression>();
call->function = member;
auto stat = MakePtr<WfExpressionStatement>();
stat->expression = call;
subBlock->statements.Add(stat);
}
}
else if (dataBinding.bindExpression)
{
auto refSubscribee = MakePtr<WfReferenceExpression>();
refSubscribee->name.value = dataBinding.variableName.ToString();
auto member = MakePtr<WfMemberExpression>();
member->parent = refSubscribee;
member->name.value = dataBinding.propertyInfo->GetName();
auto assign = MakePtr<WfBinaryExpression>();
assign->op = WfBinaryOperator::Assign;
assign->first = member;
assign->second = dataBinding.bindExpression;
auto stat = MakePtr<WfExpressionStatement>();
stat->expression = assign;
block->statements.Add(stat);
}
}
Workflow_GetSharedManager()->Clear(true, true);
Workflow_GetSharedManager()->modules.Add(module);
Workflow_GetSharedManager()->Rebuild(true);
WString moduleCode = Workflow_ModuleToString(module);
if (Workflow_GetSharedManager()->errors.Count() > 0)
{
errors.Add(ERROR_CODE_PREFIX L"Unexpected errors are encountered when initializing data binding.");
FOREACH(Ptr<parsing::ParsingError>, error, Workflow_GetSharedManager()->errors)
{
errors.Add(error->errorMessage);
}
errors.Add(ERROR_CODE_PREFIX L"Print code for reference:");
errors.Add(moduleCode);
return 0;
}
return GenerateAssembly(Workflow_GetSharedManager());
}
/***********************************************************************
Workflow_GetSharedManager
***********************************************************************/
class WorkflowReferenceNamesVisitor : public Object, public GuiValueRepr::IVisitor
{
public:
Ptr<GuiInstanceContext> context;
types::VariableTypeInfoMap& typeInfos;
types::ErrorList& errors;
IGuiInstanceLoader::TypeInfo bindingTargetTypeInfo;
vint generatedNameCount;
ITypeDescriptor* rootTypeDescriptor;
WorkflowReferenceNamesVisitor(Ptr<GuiInstanceContext> _context, types::VariableTypeInfoMap& _typeInfos, types::ErrorList& _errors)
:context(_context)
, typeInfos(_typeInfos)
, errors(_errors)
, generatedNameCount(0)
, rootTypeDescriptor(0)
{
}
void Visit(GuiTextRepr* repr)override
{
}
void Visit(GuiAttSetterRepr* repr)override
{
auto reprTypeInfo = bindingTargetTypeInfo;
auto loader = GetInstanceLoaderManager()->GetLoader(reprTypeInfo.typeName);
if (repr->instanceName != GlobalStringKey::Empty && reprTypeInfo.typeDescriptor)
{
if (typeInfos.Keys().Contains(repr->instanceName))
{
errors.Add(L"Precompile: Parameter \"" + repr->instanceName.ToString() + L"\" conflict with an existing named object.");
}
else
{
typeInfos.Add(repr->instanceName, reprTypeInfo);
}
}
FOREACH_INDEXER(Ptr<GuiAttSetterRepr::SetterValue>, setter, index, repr->setters.Values())
{
IGuiInstanceLoader::TypeInfo propertyTypeInfo;
if (setter->binding != GlobalStringKey::Empty && setter->binding != GlobalStringKey::_Set)
{
auto binder = GetInstanceLoaderManager()->GetInstanceBinder(setter->binding);
if (!binder)
{
errors.Add(L"The appropriate IGuiInstanceBinder of binding \"" + setter->binding.ToString() + L"\" cannot be found.");
}
else if (binder->RequireInstanceName() && repr->instanceName == GlobalStringKey::Empty && reprTypeInfo.typeDescriptor)
{
auto name = GlobalStringKey::Get(L"<precompile>" + itow(generatedNameCount++));
repr->instanceName = name;
typeInfos.Add(name, reprTypeInfo);
}
}
if (setter->binding == GlobalStringKey::_Set)
{
IGuiInstanceLoader::PropertyInfo info;
info.typeInfo = reprTypeInfo;
info.propertyName = repr->setters.Keys()[index];
auto currentLoader = loader;
while (currentLoader)
{
auto typeInfo = currentLoader->GetPropertyType(info);
if (typeInfo && typeInfo->support != GuiInstancePropertyInfo::NotSupport)
{
propertyTypeInfo.typeDescriptor = typeInfo->acceptableTypes[0];
propertyTypeInfo.typeName = GlobalStringKey::Get(typeInfo->acceptableTypes[0]->GetTypeName());
break;
}
currentLoader = GetInstanceLoaderManager()->GetParentLoader(currentLoader);
}
}
FOREACH(Ptr<GuiValueRepr>, value, setter->values)
{
bindingTargetTypeInfo = propertyTypeInfo;
value->Accept(this);
}
}
FOREACH(Ptr<GuiAttSetterRepr::EventValue>, handler, repr->eventHandlers.Values())
{
if (handler->binding != GlobalStringKey::Empty)
{
auto binder = GetInstanceLoaderManager()->GetInstanceEventBinder(handler->binding);
if (!binder)
{
errors.Add(L"The appropriate IGuiInstanceEventBinder of binding \"" + handler->binding.ToString() + L"\" cannot be found.");
}
else if (binder->RequireInstanceName() && repr->instanceName == GlobalStringKey::Empty && reprTypeInfo.typeDescriptor)
{
auto name = GlobalStringKey::Get(L"<precompile>" + itow(generatedNameCount++));
repr->instanceName = name;
typeInfos.Add(name, reprTypeInfo);
}
}
}
}
void Visit(GuiConstructorRepr* repr)override
{
auto source = FindInstanceLoadingSource(context, repr);
bindingTargetTypeInfo.typeName = source.typeName;
bindingTargetTypeInfo.typeDescriptor = GetInstanceLoaderManager()->GetTypeDescriptorForType(source.typeName);
if (!bindingTargetTypeInfo.typeDescriptor)
{
errors.Add(
L"Precompile: Failed to find type \"" +
(repr->typeNamespace == GlobalStringKey::Empty
? repr->typeName.ToString()
: repr->typeNamespace.ToString() + L":" + repr->typeName.ToString()
) +
L"\".");
}
if (context->instance.Obj() == repr)
{
rootTypeDescriptor = bindingTargetTypeInfo.typeDescriptor;
}
Visit((GuiAttSetterRepr*)repr);
}
};
class WorkflowCompileVisitor : public Object, public GuiValueRepr::IVisitor
{
public:
Ptr<GuiInstanceContext> context;
types::VariableTypeInfoMap& typeInfos;
types::ErrorList& errors;
types::VariableTypeMap types;
List<WorkflowDataBinding> dataBindings;
WorkflowCompileVisitor(Ptr<GuiInstanceContext> _context, types::VariableTypeInfoMap& _typeInfos, types::ErrorList& _errors)
:context(_context)
, typeInfos(_typeInfos)
, errors(_errors)
{
for (vint i = 0; i < typeInfos.Count(); i++)
{
auto key = typeInfos.Keys()[i];
auto value = typeInfos.Values()[i];
types.Add(key, value.typeDescriptor);
}
}
void Visit(GuiTextRepr* repr)override
{
}
void Visit(GuiAttSetterRepr* repr)override
{
IGuiInstanceLoader::TypeInfo reprTypeInfo;
if (repr->instanceName != GlobalStringKey::Empty)
{
reprTypeInfo = typeInfos[repr->instanceName];
}
FOREACH_INDEXER(Ptr<GuiAttSetterRepr::SetterValue>, setter, index, repr->setters.Values())
{
if (reprTypeInfo.typeDescriptor)
{
GlobalStringKey propertyName = repr->setters.Keys()[index];
Ptr<GuiInstancePropertyInfo> propertyInfo;
IGuiInstanceLoader::PropertyInfo info;
info.typeInfo = reprTypeInfo;
info.propertyName = propertyName;
{
auto currentLoader = GetInstanceLoaderManager()->GetLoader(info.typeInfo.typeName);
while (currentLoader && !propertyInfo)
{
propertyInfo = currentLoader->GetPropertyType(info);
if (propertyInfo && propertyInfo->support == GuiInstancePropertyInfo::NotSupport)
{
propertyInfo = 0;
}
currentLoader = GetInstanceLoaderManager()->GetParentLoader(currentLoader);
}
}
if (!propertyInfo)
{
errors.Add(L"Precompile: Cannot find property \"" + propertyName.ToString() + L"\" in type \"" + reprTypeInfo.typeName.ToString() + L"\".");
}
else
{
WString expressionCode;
if (auto obj = setter->values[0].Cast<GuiTextRepr>())
{
expressionCode = obj->text;
}
if (setter->binding == GlobalStringKey::_Bind || setter->binding == GlobalStringKey::_Format)
{
WorkflowDataBinding dataBinding;
dataBinding.variableName = repr->instanceName;
if (setter->binding == GlobalStringKey::_Bind)
{
expressionCode = L"bind(" + expressionCode + L")";
}
else if (setter->binding == GlobalStringKey::_Format)
{
expressionCode = L"bind($\"" + expressionCode + L"\")";
}
Ptr<WfExpression> expression;
if (Workflow_ValidateExpression(types, errors, info, expressionCode, expression))
{
dataBinding.propertyInfo = reprTypeInfo.typeDescriptor->GetPropertyByName(propertyName.ToString(), true);
dataBinding.bindExpression = expression;
}
dataBindings.Add(dataBinding);
}
else if (setter->binding == GlobalStringKey::_Eval)
{
if (propertyInfo->constructorParameter)
{
WString cacheKey = L"<att.eval>" + expressionCode;
auto assembly = Workflow_CompileExpression(types, errors, expressionCode);
context->precompiledCaches.Add(GlobalStringKey::Get(cacheKey), new GuiWorkflowCache(assembly));
}
else
{
WorkflowDataBinding dataBinding;
dataBinding.variableName = repr->instanceName;
Ptr<WfExpression> expression;
if (Workflow_ValidateExpression(types, errors, info, expressionCode, expression))
{
dataBinding.propertyInfo = reprTypeInfo.typeDescriptor->GetPropertyByName(propertyName.ToString(), true);
dataBinding.bindExpression = expression;
}
dataBindings.Add(dataBinding);
}
}
}
}
FOREACH(Ptr<GuiValueRepr>, value, setter->values)
{
value->Accept(this);
}
}
FOREACH_INDEXER(Ptr<GuiAttSetterRepr::EventValue>, handler, index, repr->eventHandlers.Values())
{
if (reprTypeInfo.typeDescriptor)
{
GlobalStringKey propertyName = repr->eventHandlers.Keys()[index];
Ptr<GuiInstanceEventInfo> eventInfo;
IGuiInstanceLoader::PropertyInfo info;
info.typeInfo = reprTypeInfo;
info.propertyName = propertyName;
{
auto currentLoader = GetInstanceLoaderManager()->GetLoader(info.typeInfo.typeName);
while (currentLoader && !eventInfo)
{
eventInfo = currentLoader->GetEventType(info);
if (eventInfo && eventInfo->support == GuiInstanceEventInfo::NotSupport)
{
eventInfo = 0;
}
currentLoader = GetInstanceLoaderManager()->GetParentLoader(currentLoader);
}
}
if (!eventInfo)
{
errors.Add(L"Precompile: Cannot find event \"" + propertyName.ToString() + L"\" in type \"" + reprTypeInfo.typeName.ToString() + L"\".");
}
else
{
WString statementCode = handler->value;
if (handler->binding == GlobalStringKey::_Eval)
{
WString cacheKey = L"<ev.eval><" + repr->instanceName.ToString() + L"><" + propertyName.ToString() + L">" + statementCode;
auto assembly = Workflow_CompileEventHandler(types, errors, info, statementCode);
context->precompiledCaches.Add(GlobalStringKey::Get(cacheKey), new GuiWorkflowCache(assembly));
}
}
}
}
}
void Visit(GuiConstructorRepr* repr)override
{
Visit((GuiAttSetterRepr*)repr);
}
};
void Workflow_PrecompileInstanceContext(Ptr<GuiInstanceContext> context, types::ErrorList& errors)
{
ITypeDescriptor* rootTypeDescriptor = 0;
types::VariableTypeInfoMap typeInfos;
{
FOREACH(Ptr<GuiInstanceParameter>, parameter, context->parameters)
{
auto type = GetTypeDescriptor(parameter->className.ToString());
if (!type)
{
errors.Add(L"Precompile: Cannot find type \"" + parameter->className.ToString() + L"\".");
}
else if (typeInfos.Keys().Contains(parameter->name))
{
errors.Add(L"Precompile: Parameter \"" + parameter->name.ToString() + L"\" conflict with an existing named object.");
}
else
{
IGuiInstanceLoader::TypeInfo typeInfo;
typeInfo.typeDescriptor = type;
typeInfo.typeName = GlobalStringKey::Get(type->GetTypeName());
typeInfos.Add(parameter->name, typeInfo);
}
}
WorkflowReferenceNamesVisitor visitor(context, typeInfos, errors);
context->instance->Accept(&visitor);
rootTypeDescriptor = visitor.rootTypeDescriptor;
}
{
WorkflowCompileVisitor visitor(context, typeInfos, errors);
context->instance->Accept(&visitor);
if (visitor.dataBindings.Count() > 0 && rootTypeDescriptor)
{
auto assembly = Workflow_CompileDataBinding(visitor.types, rootTypeDescriptor, errors, visitor.dataBindings);
context->precompiledCaches.Add(GuiWorkflowCache::CacheContextName, new GuiWorkflowCache(assembly));
}
}
}
/***********************************************************************
GuiWorkflowCache
***********************************************************************/
const GlobalStringKey& GuiWorkflowCache::CacheTypeName = GlobalStringKey::_Workflow_Assembly_Cache;
const GlobalStringKey& GuiWorkflowCache::CacheContextName = GlobalStringKey::_Workflow_Global_Context;
GuiWorkflowCache::GuiWorkflowCache()
{
}
GuiWorkflowCache::GuiWorkflowCache(Ptr<workflow::runtime::WfAssembly> _assembly)
:assembly(_assembly)
{
}
GlobalStringKey GuiWorkflowCache::GetCacheTypeName()
{
return CacheTypeName;
}
/***********************************************************************
GuiWorkflowCacheResolver
***********************************************************************/
GlobalStringKey GuiWorkflowCacheResolver::GetCacheTypeName()
{
return GuiWorkflowCache::CacheTypeName;
}
bool GuiWorkflowCacheResolver::Serialize(Ptr<IGuiInstanceCache> cache, stream::IStream& stream)
{
if (auto obj = cache.Cast<GuiWorkflowCache>())
{
obj->assembly->Serialize(stream);
return true;
}
else
{
return false;
}
}
Ptr<IGuiInstanceCache> GuiWorkflowCacheResolver::Deserialize(stream::IStream& stream)
{
auto assembly = new WfAssembly(stream);
return new GuiWorkflowCache(assembly);
}
/***********************************************************************
Workflow_GetSharedManager
***********************************************************************/
#undef ERROR_CODE_PREFIX
class GuiWorkflowSharedManagerPlugin;
GuiWorkflowSharedManagerPlugin* sharedManagerPlugin = 0;
class GuiWorkflowSharedManagerPlugin : public Object, public IGuiPlugin
{
protected:
Ptr<WfLexicalScopeManager> workflowManager;
public:
GuiWorkflowSharedManagerPlugin()
{
}
void Load()override
{
}
void AfterLoad()override
{
sharedManagerPlugin = this;
IGuiInstanceLoaderManager* manager=GetInstanceLoaderManager();
manager->AddInstanceCacheResolver(new GuiWorkflowCacheResolver);
}
void Unload()override
{
sharedManagerPlugin = 0;
}
WfLexicalScopeManager* GetWorkflowManager()
{
if (!workflowManager)
{
workflowManager = new WfLexicalScopeManager(GetParserManager()->GetParsingTable(L"WORKFLOW"));
}
return workflowManager.Obj();
}
};
GUI_REGISTER_PLUGIN(GuiWorkflowSharedManagerPlugin)
WfLexicalScopeManager* Workflow_GetSharedManager()
{
return sharedManagerPlugin->GetWorkflowManager();
}
}
}
/***********************************************************************
GuiInstanceRepresentation.cpp
***********************************************************************/
namespace vl
{
namespace presentation
{
using namespace collections;
using namespace parsing;
using namespace parsing::xml;
using namespace templates;
using namespace stream;
/***********************************************************************
GuiValueRepr
***********************************************************************/
Ptr<GuiValueRepr> GuiValueRepr::LoadPrecompiledBinary(stream::IStream& stream, collections::List<GlobalStringKey>& keys)
{
stream::internal::Reader reader(stream);
vint key = -1;
reader << key;
switch (key)
{
case GuiTextRepr::BinaryKey:
return GuiTextRepr::LoadPrecompiledBinary(stream, keys);
case GuiAttSetterRepr::BinaryKey:
return GuiAttSetterRepr::LoadPrecompiledBinary(stream, keys);
case GuiConstructorRepr::BinaryKey:
return GuiConstructorRepr::LoadPrecompiledBinary(stream, keys);
default:
CHECK_FAIL(L"GuiValueRepr::LoadPrecompiledBinary(stream::IStream&, collections::List<presentation::GlobalStringKey>&)#Internal Error.");
}
}
/***********************************************************************
GuiTextRepr
***********************************************************************/
Ptr<GuiValueRepr> GuiTextRepr::Clone()
{
auto repr = MakePtr<GuiTextRepr>();
repr->fromStyle = fromStyle;
repr->text = text;
return repr;
}
void GuiTextRepr::FillXml(Ptr<parsing::xml::XmlElement> xml, bool serializePrecompiledResource)
{
if (!fromStyle || serializePrecompiledResource)
{
auto xmlText = MakePtr<XmlText>();
xmlText->content.value = text;
xml->subNodes.Add(xmlText);
}
}
void GuiTextRepr::CollectUsedKey(collections::List<GlobalStringKey>& keys)
{
}
void GuiTextRepr::SavePrecompiledBinary(stream::IStream& stream, collections::SortedList<GlobalStringKey>& keys, bool saveKey)
{
stream::internal::Writer writer(stream);
if (saveKey)
{
vint key = BinaryKey;
writer << key;
}
writer << text;
}
Ptr<GuiTextRepr> GuiTextRepr::LoadPrecompiledBinary(stream::IStream& stream, collections::List<GlobalStringKey>& keys, Ptr<GuiTextRepr> repr)
{
stream::internal::Reader reader(stream);
if (!repr)
{
repr = MakePtr<GuiTextRepr>();
}
reader << repr->text;
return repr;
}
/***********************************************************************
GuiAttSetterRepr
***********************************************************************/
void GuiAttSetterRepr::CloneBody(Ptr<GuiAttSetterRepr> repr)
{
CopyFrom(repr->eventHandlers, eventHandlers);
FOREACH_INDEXER(GlobalStringKey, name, index, setters.Keys())
{
Ptr<SetterValue> src = setters.Values()[index];
Ptr<SetterValue> dst = new SetterValue;
dst->binding = src->binding;
FOREACH(Ptr<GuiValueRepr>, value, src->values)
{
dst->values.Add(value->Clone());
}
repr->setters.Add(name, dst);
}
repr->instanceName = instanceName;
}
Ptr<GuiValueRepr> GuiAttSetterRepr::Clone()
{
auto repr = MakePtr<GuiAttSetterRepr>();
repr->fromStyle = fromStyle;
CloneBody(repr);
return repr;
}
void GuiAttSetterRepr::FillXml(Ptr<parsing::xml::XmlElement> xml, bool serializePrecompiledResource)
{
if (!fromStyle || serializePrecompiledResource)
{
if (instanceName != GlobalStringKey::Empty)
{
auto attName = MakePtr<XmlAttribute>();
attName->name.value = L"ref.Name";
attName->value.value = instanceName.ToString();
xml->attributes.Add(attName);
}
for (vint i = 0; i < setters.Count(); i++)
{
auto key = setters.Keys()[i];
auto value = setters.Values()[i];
if (key == GlobalStringKey::Empty)
{
FOREACH(Ptr<GuiValueRepr>, repr, value->values)
{
repr->FillXml(xml, serializePrecompiledResource);
}
}
else
{
bool containsElement = false;
FOREACH(Ptr<GuiValueRepr>, repr, value->values)
{
if (!repr.Cast<GuiTextRepr>())
{
containsElement = true;
break;
}
}
if (containsElement)
{
auto xmlProp = MakePtr<XmlElement>();
xmlProp->name.value = L"att." + key.ToString();
if (value->binding != GlobalStringKey::Empty)
{
xmlProp->name.value += L"-" + value->binding.ToString();
}
FOREACH(Ptr<GuiValueRepr>, repr, value->values)
{
if (!repr.Cast<GuiTextRepr>())
{
repr->FillXml(xmlProp, serializePrecompiledResource);
}
}
xml->subNodes.Add(xmlProp);
}
else if (value->values.Count() > 0)
{
auto att = MakePtr<XmlAttribute>();
att->name.value = key.ToString();
if (value->binding != GlobalStringKey::Empty)
{
att->name.value += L"-" + value->binding.ToString();
}
att->value.value = value->values[0].Cast<GuiTextRepr>()->text;
xml->attributes.Add(att);
}
}
}
for (vint i = 0; i < eventHandlers.Count(); i++)
{
auto key = eventHandlers.Keys()[i];
auto value = eventHandlers.Values()[i];
auto xmlEvent = MakePtr<XmlElement>();
xmlEvent->name.value = L"ev." + key.ToString();
if (value->binding != GlobalStringKey::Empty)
{
xmlEvent->name.value += L"-" + value->binding.ToString();
}
xml->subNodes.Add(xmlEvent);
auto xmlText = MakePtr<XmlText>();
xmlText->content.value = value->value;
xmlEvent->subNodes.Add(xmlText);
}
}
}
void GuiAttSetterRepr::CollectUsedKey(collections::List<GlobalStringKey>& keys)
{
keys.Add(instanceName);
for (vint i = 0; i < setters.Count(); i++)
{
keys.Add(setters.Keys()[i]);
auto value = setters.Values()[i];
keys.Add(value->binding);
for (vint j = 0; j < value->values.Count(); j++)
{
value->values[j]->CollectUsedKey(keys);
}
}
for (vint i = 0; i < eventHandlers.Count(); i++)
{
keys.Add(eventHandlers.Keys()[i]);
keys.Add(eventHandlers.Values()[i]->binding);
}
}
void GuiAttSetterRepr::SavePrecompiledBinary(stream::IStream& stream, collections::SortedList<GlobalStringKey>& keys, bool saveKey)
{
stream::internal::Writer writer(stream);
if (saveKey)
{
vint key = BinaryKey;
writer << key;
}
{
vint count = setters.Count();
writer << count;
for (vint i = 0; i < count; i++)
{
auto keyIndex = keys.IndexOf(setters.Keys()[i]);
auto value = setters.Values()[i];
auto bindingIndex = keys.IndexOf(value->binding);
CHECK_ERROR(keyIndex != -1 && bindingIndex != -1, L"GuiAttSetterRepr::SavePrecompiledBinary(stream::IStream&, collections::SortedList<presentation::GlobalStringKey>&)#Internal Error.");
writer << keyIndex << bindingIndex;
vint valueCount = value->values.Count();
writer << valueCount;
for (vint j = 0; j < valueCount; j++)
{
value->values[j]->SavePrecompiledBinary(stream, keys, true);
}
}
}
{
vint count = eventHandlers.Count();
writer << count;
for (vint i = 0; i < count; i++)
{
auto keyIndex = keys.IndexOf(eventHandlers.Keys()[i]);
auto value = eventHandlers.Values()[i];
auto bindingIndex = keys.IndexOf(value->binding);
CHECK_ERROR(keyIndex != -1 && bindingIndex != -1, L"GuiAttSetterRepr::SavePrecompiledBinary(stream::IStream&, collections::SortedList<presentation::GlobalStringKey>&)#Internal Error.");
writer << keyIndex << bindingIndex << value->value;
}
}
{
vint instanceNameIndex = keys.IndexOf(instanceName);
CHECK_ERROR(instanceNameIndex != -1, L"GuiAttSetterRepr::SavePrecompiledBinary(stream::IStream&, collections::SortedList<presentation::GlobalStringKey>&)#Internal Error.");
writer << instanceNameIndex;
}
}
Ptr<GuiAttSetterRepr> GuiAttSetterRepr::LoadPrecompiledBinary(stream::IStream& stream, collections::List<GlobalStringKey>& keys, Ptr<GuiAttSetterRepr> repr)
{
stream::internal::Reader reader(stream);
if (!repr)
{
repr = MakePtr<GuiAttSetterRepr>();
}
{
vint count = -1;
reader << count;
for (vint i = 0; i < count; i++)
{
vint keyIndex = -1;
vint bindingIndex = -1;
auto value = MakePtr<SetterValue>();
reader << keyIndex << bindingIndex;
auto key = keys[keyIndex];
value->binding = keys[bindingIndex];
repr->setters.Add(key, value);
vint valueCount = -1;
reader << valueCount;
for (vint j = 0; j < valueCount; j++)
{
auto repr = GuiValueRepr::LoadPrecompiledBinary(stream, keys);
value->values.Add(repr);
}
}
}
{
vint count = -1;
reader << count;
for (vint i = 0; i < count; i++)
{
vint keyIndex = -1;
vint bindingIndex = -1;
auto value = MakePtr<EventValue>();
reader << keyIndex << bindingIndex << value->value;
auto key = keys[keyIndex];
value->binding = keys[bindingIndex];
repr->eventHandlers.Add(key, value);
}
}
{
vint instanceNameIndex = -1;
reader << instanceNameIndex;
repr->instanceName = keys[instanceNameIndex];
}
return repr;
}
/***********************************************************************
GuiConstructorRepr
***********************************************************************/
Ptr<GuiValueRepr> GuiConstructorRepr::Clone()
{
auto repr = MakePtr<GuiConstructorRepr>();
repr->fromStyle = fromStyle;
repr->typeNamespace = typeNamespace;
repr->typeName = typeName;
repr->styleName = styleName;
CloneBody(repr);
return repr;
}
void GuiConstructorRepr::FillXml(Ptr<parsing::xml::XmlElement> xml, bool serializePrecompiledResource)
{
if (!fromStyle || serializePrecompiledResource)
{
auto xmlCtor = MakePtr<XmlElement>();
if (typeNamespace == GlobalStringKey::Empty)
{
xmlCtor->name.value = typeName.ToString();
}
else
{
xmlCtor->name.value = typeNamespace.ToString() + L":" + typeName.ToString();
}
if (styleName)
{
auto attStyle = MakePtr<XmlAttribute>();
attStyle->name.value = L"ref.Style";
attStyle->value.value = styleName.Value();
xml->attributes.Add(attStyle);
}
GuiAttSetterRepr::FillXml(xmlCtor, serializePrecompiledResource);
xml->subNodes.Add(xmlCtor);
}
}
void GuiConstructorRepr::CollectUsedKey(collections::List<GlobalStringKey>& keys)
{
GuiAttSetterRepr::CollectUsedKey(keys);
keys.Add(typeNamespace);
keys.Add(typeName);
}
void GuiConstructorRepr::SavePrecompiledBinary(stream::IStream& stream, collections::SortedList<GlobalStringKey>& keys, bool saveKey)
{
stream::internal::Writer writer(stream);
if (saveKey)
{
vint key = BinaryKey;
writer << key;
}
vint typeNamespaceIndex = keys.IndexOf(typeNamespace);
vint typeNameIndex = keys.IndexOf(typeName);
CHECK_ERROR(typeNamespaceIndex != -1 && typeNameIndex != -1, L"GuiConstructorRepr::SavePrecompiledBinary(stream::IStream&, collections::SortedList<presentation::GlobalStringKey>&)#Internal Error.");
writer << typeNamespaceIndex << typeNameIndex << styleName;
GuiAttSetterRepr::SavePrecompiledBinary(stream, keys, false);
}
Ptr<GuiConstructorRepr> GuiConstructorRepr::LoadPrecompiledBinary(stream::IStream& stream, collections::List<GlobalStringKey>& keys, Ptr<GuiConstructorRepr> repr)
{
stream::internal::Reader reader(stream);
if (!repr)
{
repr = MakePtr<GuiConstructorRepr>();
}
vint typeNamespaceIndex = -1;
vint typeNameIndex = -1;
reader << typeNamespaceIndex << typeNameIndex << repr->styleName;
repr->typeNamespace = keys[typeNamespaceIndex];
repr->typeName = keys[typeNameIndex];
GuiAttSetterRepr::LoadPrecompiledBinary(stream, keys, repr);
return repr;
}
/***********************************************************************
GuiInstanceContext
***********************************************************************/
void GuiInstanceContext::CollectDefaultAttributes(GuiAttSetterRepr::ValueList& values, Ptr<parsing::xml::XmlElement> xml, collections::List<WString>& errors)
{
if(auto parser=GetParserManager()->GetParser<ElementName>(L"INSTANCE-ELEMENT-NAME"))
{
// test if there is only one text value in the xml
if(xml->subNodes.Count()==1)
{
if(Ptr<XmlText> text=xml->subNodes[0].Cast<XmlText>())
{
Ptr<GuiTextRepr> value=new GuiTextRepr;
value->text=text->content.value;
values.Add(value);
}
else if(Ptr<XmlCData> text=xml->subNodes[0].Cast<XmlCData>())
{
Ptr<GuiTextRepr> value=new GuiTextRepr;
value->text=text->content.value;
values.Add(value);
}
}
// collect default attributes
FOREACH(Ptr<XmlElement>, element, XmlGetElements(xml))
{
if(auto name=parser->TypedParse(element->name.value, errors))
{
if(name->IsCtorName())
{
// collect constructor values in the default attribute setter
auto ctor=LoadCtor(element, errors);
if(ctor)
{
values.Add(ctor);
}
}
}
}
}
}
void GuiInstanceContext::CollectAttributes(GuiAttSetterRepr::SetteValuerMap& setters, Ptr<parsing::xml::XmlElement> xml, collections::List<WString>& errors)
{
if(auto parser=GetParserManager()->GetParser<ElementName>(L"INSTANCE-ELEMENT-NAME"))
{
Ptr<GuiAttSetterRepr::SetterValue> defaultValue=new GuiAttSetterRepr::SetterValue;
// collect default attributes
CollectDefaultAttributes(defaultValue->values, xml, errors);
if(defaultValue->values.Count()>0)
{
setters.Add(GlobalStringKey::Empty, defaultValue);
}
// collect values
FOREACH(Ptr<XmlElement>, element, XmlGetElements(xml))
{
if (auto name = parser->TypedParse(element->name.value, errors))
{
if(name->IsPropertyElementName())
{
// collect a value as a new attribute setter
if (setters.Keys().Contains(GlobalStringKey::Get(name->name)))
{
errors.Add(L"Duplicated attribute name \"" + name->name + L"\".");
}
else
{
Ptr<GuiAttSetterRepr::SetterValue> sv=new GuiAttSetterRepr::SetterValue;
sv->binding = GlobalStringKey::Get(name->binding);
if(name->binding==L"set")
{
// if the binding is "set", it means that this element is a complete setter element
Ptr<GuiAttSetterRepr> setter=new GuiAttSetterRepr;
FillAttSetter(setter, element, errors);
sv->values.Add(setter);
}
else
{
// if the binding is not "set", then this is a single-value attribute or a colection attribute
// fill all data into this attribute
CollectDefaultAttributes(sv->values, element, errors);
}
if(sv->values.Count()>0)
{
setters.Add(GlobalStringKey::Get(name->name), sv);
}
}
}
}
}
}
}
void GuiInstanceContext::CollectEvents(GuiAttSetterRepr::EventHandlerMap& eventHandlers, Ptr<parsing::xml::XmlElement> xml, collections::List<WString>& errors)
{
if(auto parser=GetParserManager()->GetParser<ElementName>(L"INSTANCE-ELEMENT-NAME"))
{
// collect values
FOREACH(Ptr<XmlElement>, element, XmlGetElements(xml))
{
if(auto name=parser->TypedParse(element->name.value, errors))
{
if(name->IsEventElementName())
{
// collect a value as a new attribute setter
if (eventHandlers.Keys().Contains(GlobalStringKey::Get(name->name)))
{
errors.Add(L"Duplicated event name \"" + name->name + L"\".");
}
else
{
// test if there is only one text value in the xml
if(element->subNodes.Count()==1)
{
if(Ptr<XmlText> text=element->subNodes[0].Cast<XmlText>())
{
auto value = MakePtr<GuiAttSetterRepr::EventValue>();
value->binding = GlobalStringKey::Get(name->binding);
value->value = text->content.value;
eventHandlers.Add(GlobalStringKey::Get(name->name), value);
}
else if(Ptr<XmlCData> text=element->subNodes[0].Cast<XmlCData>())
{
auto value = MakePtr<GuiAttSetterRepr::EventValue>();
value->binding = GlobalStringKey::Get(name->binding);
value->value = text->content.value;
eventHandlers.Add(GlobalStringKey::Get(name->name), value);
}
}
}
}
}
}
}
}
void GuiInstanceContext::FillAttSetter(Ptr<GuiAttSetterRepr> setter, Ptr<parsing::xml::XmlElement> xml, collections::List<WString>& errors)
{
if(auto parser=GetParserManager()->GetParser<ElementName>(L"INSTANCE-ELEMENT-NAME"))
{
// collect attributes as setters
FOREACH(Ptr<XmlAttribute>, att, xml->attributes)
{
if (auto name = parser->TypedParse(att->name.value, errors))
{
if(name->IsReferenceAttributeName())
{
// collect reference attributes
if (name->name == L"Name")
{
setter->instanceName = GlobalStringKey::Get(att->value.value);
}
}
else if(name->IsPropertyAttributeName())
{
// collect attributes setters
if (setter->setters.Keys().Contains(GlobalStringKey::Get(name->name)))
{
errors.Add(L"Duplicated attribute name \"" + name->name + L"\".");
}
else
{
Ptr<GuiAttSetterRepr::SetterValue> sv=new GuiAttSetterRepr::SetterValue;
sv->binding=GlobalStringKey::Get(name->binding);
setter->setters.Add(GlobalStringKey::Get(name->name), sv);
Ptr<GuiTextRepr> value=new GuiTextRepr;
value->text=att->value.value;
sv->values.Add(value);
}
}
else if (name->IsEventAttributeName())
{
// collect event setters
if (!setter->eventHandlers.Keys().Contains(GlobalStringKey::Get(name->name)))
{
auto value = MakePtr<GuiAttSetterRepr::EventValue>();
value->binding = GlobalStringKey::Get(name->binding);
value->value = att->value.value;
setter->eventHandlers.Add(GlobalStringKey::Get(name->name), value);
}
}
}
}
// collect attributes and events
CollectAttributes(setter->setters, xml, errors);
CollectEvents(setter->eventHandlers, xml, errors);
}
}
Ptr<GuiConstructorRepr> GuiInstanceContext::LoadCtor(Ptr<parsing::xml::XmlElement> xml, collections::List<WString>& errors)
{
if (auto parser = GetParserManager()->GetParser<ElementName>(L"INSTANCE-ELEMENT-NAME"))
{
if (auto name = parser->TypedParse(xml->name.value, errors))
{
if(name->IsCtorName())
{
Ptr<GuiConstructorRepr> ctor=new GuiConstructorRepr;
ctor->typeNamespace = GlobalStringKey::Get(name->namespaceName);
ctor->typeName = GlobalStringKey::Get(name->name);
// collect attributes as setters
FOREACH(Ptr<XmlAttribute>, att, xml->attributes)
{
if(auto name=parser->TypedParse(att->name.value, errors))
if(name->IsReferenceAttributeName())
{
if (name->name == L"Style")
{
ctor->styleName = att->value.value;
}
}
}
FillAttSetter(ctor, xml, errors);
return ctor;
}
else
{
errors.Add(L"Wrong constructor name \"" + xml->name.value + L"\".");
}
}
}
return 0;
}
Ptr<GuiInstanceContext> GuiInstanceContext::LoadFromXml(Ptr<parsing::xml::XmlDocument> xml, collections::List<WString>& errors)
{
Ptr<GuiInstanceContext> context=new GuiInstanceContext;
if(xml->rootElement->name.value==L"Instance")
{
// load type name
if (auto classAttr = XmlGetAttribute(xml->rootElement, L"ref.Class"))
{
context->className = classAttr->value.value;
}
// load style names
if (auto styleAttr = XmlGetAttribute(xml->rootElement, L"ref.Styles"))
{
SplitBySemicolon(styleAttr->value.value, context->stylePaths);
}
// load namespaces
List<Ptr<XmlAttribute>> namespaceAttributes;
CopyFrom(namespaceAttributes, xml->rootElement->attributes);
if(!XmlGetAttribute(xml->rootElement, L"xmlns"))
{
Ptr<XmlAttribute> att=new XmlAttribute;
att->name.value=L"xmlns";
att->value.value =
L"presentation::controls::Gui*;"
L"presentation::elements::Gui*Element;"
L"presentation::compositions::Gui*Composition;"
L"presentation::compositions::Gui*;"
L"presentation::templates::Gui*;"
L"system::*;"
L"system::reflection::*;"
L"presentation::*;"
L"presentation::Gui*;"
L"presentation::controls::*;"
L"presentation::controls::list::*;"
L"presentation::controls::tree::*;"
L"presentation::elements::*;"
L"presentation::elements::Gui*;"
L"presentation::elements::text*;"
L"presentation::compositions::*"
L"presentation::templates::*";
namespaceAttributes.Add(att);
}
FOREACH(Ptr<XmlAttribute>, att, namespaceAttributes)
{
// check if the attribute defines a namespace
WString attName=att->name.value;
if(attName.Length()>=5 && attName.Left(5)==L"xmlns")
{
GlobalStringKey ns;
if(attName.Length()>6)
{
if(attName.Left(6)==L"xmlns:")
{
ns = GlobalStringKey::Get(attName.Sub(6, attName.Length() - 6));
}
else
{
continue;
}
}
// create a data structure for the namespace
Ptr<NamespaceInfo> info;
vint index=context->namespaces.Keys().IndexOf(ns);
if(index==-1)
{
info=new NamespaceInfo;
info->name=ns;
context->namespaces.Add(ns, info);
}
else
{
info=context->namespaces.Values()[index];
}
// extract all patterns in the namespace, split the value by ';'
List<WString> patterns;
SplitBySemicolon(att->value.value, patterns);
FOREACH(WString, pattern, patterns)
{
// add the pattern to the namespace
Ptr<GuiInstanceNamespace> ns=new GuiInstanceNamespace;
Pair<vint, vint> star=INVLOC.FindFirst(pattern, L"*", Locale::None);
if(star.key==-1)
{
ns->prefix=pattern;
}
else
{
ns->prefix=pattern.Sub(0, star.key);
ns->postfix=pattern.Sub(star.key+star.value, pattern.Length()-star.key-star.value);
}
info->namespaces.Add(ns);
}
}
}
// load instance
FOREACH(Ptr<XmlElement>, element, XmlGetElements(xml->rootElement))
{
if (element->name.value == L"ref.Parameter")
{
auto attName = XmlGetAttribute(element, L"Name");
auto attClass = XmlGetAttribute(element, L"Class");
if (attName && attClass)
{
auto parameter = MakePtr<GuiInstanceParameter>();
parameter->name = GlobalStringKey::Get(attName->value.value);
parameter->className = GlobalStringKey::Get(attClass->value.value);
context->parameters.Add(parameter);
}
}
else if (element->name.value == L"ref.Cache")
{
auto attName = XmlGetAttribute(element, L"Name");
auto attType = XmlGetAttribute(element, L"Type");
if (attName && attType)
{
auto resolver = GetInstanceLoaderManager()->GetInstanceCacheResolver(GlobalStringKey::Get(attType->value.value));
MemoryStream stream;
HexToBinary(stream, XmlGetValue(element));
stream.SeekFromBegin(0);
auto cache = resolver->Deserialize(stream);
context->precompiledCaches.Add(GlobalStringKey::Get(attName->value.value), cache);
}
}
else if (!context->instance)
{
context->instance=LoadCtor(element, errors);
}
}
}
return context->instance ? context : nullptr;
}
Ptr<parsing::xml::XmlDocument> GuiInstanceContext::SaveToXml(bool serializePrecompiledResource)
{
auto xmlInstance = MakePtr<XmlElement>();
xmlInstance->name.value = L"Instance";
if (className)
{
auto attClass = MakePtr<XmlAttribute>();
attClass->name.value = L"ref.Class";
attClass->value.value = className.Value();
xmlInstance->attributes.Add(attClass);
}
for (vint i = 0; i < namespaces.Count(); i++)
{
auto key = namespaces.Keys()[i];
auto value = namespaces.Values()[i];
auto xmlns = MakePtr<XmlAttribute>();
xmlns->name.value = L"xmlns";
if (key != GlobalStringKey::Empty)
{
xmlns->name.value += L":" + key.ToString();
}
xmlInstance->attributes.Add(xmlns);
for (vint j = 0; j < value->namespaces.Count(); j++)
{
auto ns = value->namespaces[j];
if (j != 0)
{
xmlns->value.value += L";";
}
xmlns->value.value += ns->prefix + L"*" + ns->postfix;
}
}
FOREACH(Ptr<GuiInstanceParameter>, parameter, parameters)
{
auto xmlParameter = MakePtr<XmlElement>();
xmlParameter->name.value = L"ref.Parameter";
xmlInstance->subNodes.Add(xmlParameter);
auto attName = MakePtr<XmlAttribute>();
attName->name.value = L"Name";
attName->value.value = parameter->name.ToString();
xmlParameter->attributes.Add(attName);
auto attClass = MakePtr<XmlAttribute>();
attClass->name.value = L"Class";
attClass->value.value = parameter->className.ToString();
xmlParameter->attributes.Add(attClass);
}
if (!serializePrecompiledResource && stylePaths.Count() > 0)
{
auto attStyles = MakePtr<XmlAttribute>();
attStyles->name.value = L"ref.Styles";
xmlInstance->attributes.Add(attStyles);
for (vint j = 0; j < stylePaths.Count(); j++)
{
if (j != 0)
{
attStyles->value.value += L";";
}
attStyles->value.value += stylePaths[j];
}
}
if (serializePrecompiledResource)
{
for (vint i = 0; i < precompiledCaches.Count(); i++)
{
auto key = precompiledCaches.Keys()[i];
auto value = precompiledCaches.Values()[i];
auto resolver = GetInstanceLoaderManager()->GetInstanceCacheResolver(value->GetCacheTypeName());
MemoryStream stream;
resolver->Serialize(value, stream);
stream.SeekFromBegin(0);
auto hex = BinaryToHex(stream);
auto xmlCache = MakePtr<XmlElement>();
xmlCache->name.value = L"ref.Cache";
xmlInstance->subNodes.Add(xmlCache);
auto attName = MakePtr<XmlAttribute>();
attName->name.value = L"Name";
attName->value.value = key.ToString();
xmlCache->attributes.Add(attName);
auto attType = MakePtr<XmlAttribute>();
attType->name.value = L"Type";
attType->value.value = value->GetCacheTypeName().ToString();
xmlCache->attributes.Add(attType);
auto xmlContent = MakePtr<XmlCData>();
xmlContent->content.value = hex;
xmlCache->subNodes.Add(xmlContent);
}
}
instance->FillXml(xmlInstance, serializePrecompiledResource);
auto doc = MakePtr<XmlDocument>();
doc->rootElement = xmlInstance;
return doc;
}
Ptr<GuiInstanceContext> GuiInstanceContext::LoadPrecompiledBinary(stream::IStream& stream, collections::List<WString>& errors)
{
stream::internal::Reader reader(stream);
List<GlobalStringKey> sortedKeys;
{
vint count = 0;
reader << count;
for (vint i = 0; i < count; i++)
{
WString keyString;
reader << keyString;
sortedKeys.Add(GlobalStringKey::Get(keyString));
}
}
auto context = MakePtr<GuiInstanceContext>();
context->appliedStyles = true;
{
context->instance = GuiConstructorRepr::LoadPrecompiledBinary(stream, sortedKeys);
}
{
vint count = -1;
reader << count;
for (vint i = 0; i < count; i++)
{
vint keyIndex = -1;
vint valueNameIndex = -1;
reader << keyIndex << valueNameIndex;
auto key = sortedKeys[keyIndex];
auto ni = MakePtr<NamespaceInfo>();
ni->name = sortedKeys[valueNameIndex];
context->namespaces.Add(key, ni);
vint valueCount = -1;
reader << valueCount;
for (vint j = 0; j < valueCount; j++)
{
auto ns = MakePtr<GuiInstanceNamespace>();
reader << ns->prefix << ns->postfix;
ni->namespaces.Add(ns);
}
}
}
{
reader << context->className;
}
{
vint count = -1;
reader << count;
for (vint i = 0; i < count; i++)
{
vint nameIndex = -1;
vint classNameIndex = -1;
reader << nameIndex << classNameIndex;
auto parameter = MakePtr<GuiInstanceParameter>();
parameter->name = sortedKeys[nameIndex];
parameter->className = sortedKeys[classNameIndex];
context->parameters.Add(parameter);
}
}
{
vint count = 0;
reader << count;
for (vint i = 0; i < count; i++)
{
vint keyIndex = -1;
vint nameIndex = -1;
stream::MemoryStream stream;
reader << keyIndex << nameIndex << (stream::IStream&)stream;
auto key = sortedKeys[keyIndex];
auto name = sortedKeys[nameIndex];
if (auto resolver = GetInstanceLoaderManager()->GetInstanceCacheResolver(name))
{
if (auto cache = resolver->Deserialize(stream))
{
context->precompiledCaches.Add(key, cache);
}
}
}
}
return context;
}
void GuiInstanceContext::SavePrecompiledBinary(stream::IStream& stream)
{
stream::internal::Writer writer(stream);
SortedList<GlobalStringKey> sortedKeys;
{
List<GlobalStringKey> keys;
CollectUsedKey(keys);
CopyFrom(sortedKeys, From(keys).Distinct());
vint count = sortedKeys.Count();
writer << count;
FOREACH(GlobalStringKey, key, sortedKeys)
{
WString keyString = key.ToString();
writer << keyString;
}
}
{
instance->SavePrecompiledBinary(stream, sortedKeys, false);
}
{
vint count = namespaces.Count();
writer << count;
for (vint i = 0; i < count; i++)
{
auto keyIndex = sortedKeys.IndexOf(namespaces.Keys()[i]);
auto value = namespaces.Values()[i];
auto valueNameIndex = sortedKeys.IndexOf(value->name);
CHECK_ERROR(keyIndex != -1 && valueNameIndex != -1, L"GuiInstanceContext::SavePrecompiledBinary(stream::IStream&)#Internal Error.");
writer << keyIndex << valueNameIndex;
vint valueCount = value->namespaces.Count();
writer << valueCount;
FOREACH(Ptr<GuiInstanceNamespace>, ns, value->namespaces)
{
writer << ns->prefix << ns->postfix;
}
}
}
{
writer << className;
}
{
vint count = parameters.Count();
writer << count;
FOREACH(Ptr<GuiInstanceParameter>, parameter, parameters)
{
vint nameIndex = sortedKeys.IndexOf(parameter->name);
vint classNameIndex = sortedKeys.IndexOf(parameter->className);
CHECK_ERROR(nameIndex != -1 && classNameIndex != -1, L"GuiInstanceContext::SavePrecompiledBinary(stream::IStream&)#Internal Error.");
writer << nameIndex << classNameIndex;
}
}
{
vint count = precompiledCaches.Count();
writer << count;
for (vint i = 0; i < count; i++)
{
auto keyIndex = sortedKeys.IndexOf(precompiledCaches.Keys()[i]);
auto cache = precompiledCaches.Values()[i];
auto name = cache->GetCacheTypeName();
vint nameIndex = sortedKeys.IndexOf(name);
CHECK_ERROR(keyIndex != -1 && nameIndex != -1, L"GuiInstanceContext::SavePrecompiledBinary(stream::IStream&)#Internal Error.");
stream::MemoryStream stream;
if (auto resolver = GetInstanceLoaderManager()->GetInstanceCacheResolver(name))
{
resolver->Serialize(cache, stream);
}
writer << keyIndex << nameIndex << (stream::IStream&)stream;
}
}
}
void GuiInstanceContext::CollectUsedKey(collections::List<GlobalStringKey>& keys)
{
instance->CollectUsedKey(keys);
for (vint i = 0; i < namespaces.Count(); i++)
{
keys.Add(namespaces.Keys()[i]);
keys.Add(namespaces.Values()[i]->name);
}
for (vint i = 0; i < parameters.Count(); i++)
{
keys.Add(parameters[i]->name);
keys.Add(parameters[i]->className);
}
for (vint i = 0; i < precompiledCaches.Count(); i++)
{
keys.Add(precompiledCaches.Keys()[i]);
keys.Add(precompiledCaches.Values()[i]->GetCacheTypeName());
}
}
bool GuiInstanceContext::ApplyStyles(Ptr<GuiResourcePathResolver> resolver, collections::List<WString>& errors)
{
if (!appliedStyles)
{
appliedStyles = true;
List<Ptr<GuiInstanceStyle>> styles;
FOREACH(WString, uri, stylePaths)
{
WString protocol, path;
if (IsResourceUrl(uri, protocol, path))
{
if (auto styleContext = resolver->ResolveResource(protocol, path).Cast<GuiInstanceStyleContext>())
{
CopyFrom(styles, styleContext->styles, true);
}
else
{
errors.Add(L"Failed to find the style referred in attribute \"ref.Styles\": \"" + uri + L"\".");
}
}
else
{
errors.Add(L"Invalid path in attribute \"ref.Styles\": \"" + uri + L"\".");
}
}
FOREACH(Ptr<GuiInstanceStyle>, style, styles)
{
List<Ptr<GuiConstructorRepr>> output;
ExecuteQuery(style->query, this, output);
FOREACH(Ptr<GuiConstructorRepr>, ctor, output)
{
ApplyStyle(style, ctor);
}
}
return true;
}
else
{
return false;
}
}
/***********************************************************************
GuiInstanceStyle
***********************************************************************/
namespace visitors
{
class SetStyleMarkVisitor : public Object, public GuiValueRepr::IVisitor
{
public:
void Visit(GuiTextRepr* repr)override
{
repr->fromStyle = true;
}
void Visit(GuiAttSetterRepr* repr)override
{
repr->fromStyle = true;
FOREACH(Ptr<GuiAttSetterRepr::SetterValue>, value, repr->setters.Values())
{
FOREACH(Ptr<GuiValueRepr>, subValue, value->values)
{
subValue->Accept(this);
}
}
FOREACH(Ptr<GuiAttSetterRepr::EventValue>, value, repr->eventHandlers.Values())
{
value->fromStyle = true;
}
}
void Visit(GuiConstructorRepr* repr)override
{
Visit((GuiAttSetterRepr*)repr);
}
};
}
using namespace visitors;
Ptr<GuiInstanceStyle> GuiInstanceStyle::LoadFromXml(Ptr<parsing::xml::XmlElement> xml, collections::List<WString>& errors)
{
auto style = MakePtr<GuiInstanceStyle>();
if (auto pathAttr = XmlGetAttribute(xml, L"ref.Path"))
{
auto parser = GetParserManager()->GetParser<GuiIqQuery>(L"INSTANCE-QUERY");
if (auto query = parser->TypedParse(pathAttr->value.value, errors))
{
style->query = query;
}
else
{
return 0;
}
}
else
{
errors.Add(L"Missing attribute \"ref.Path\" in <Style>.");
}
style->setter = MakePtr<GuiAttSetterRepr>();
GuiInstanceContext::FillAttSetter(style->setter, xml, errors);
SetStyleMarkVisitor visitor;
style->setter->Accept(&visitor);
return style;
}
Ptr<parsing::xml::XmlElement> GuiInstanceStyle::SaveToXml()
{
auto xmlStyle = MakePtr<XmlElement>();
xmlStyle->name.value = L"Style";
auto attPath = MakePtr<XmlAttribute>();
attPath->name.value = L"ref.Path";
{
MemoryStream stream;
{
StreamWriter writer(stream);
GuiIqPrint(query, writer);
}
stream.SeekFromBegin(0);
{
StreamReader reader(stream);
attPath->value.value = reader.ReadToEnd();
}
}
xmlStyle->attributes.Add(attPath);
setter->FillXml(xmlStyle, true);
return xmlStyle;
}
/***********************************************************************
GuiInstanceStyleContext
***********************************************************************/
Ptr<GuiInstanceStyleContext> GuiInstanceStyleContext::LoadFromXml(Ptr<parsing::xml::XmlDocument> xml, collections::List<WString>& errors)
{
auto context = MakePtr<GuiInstanceStyleContext>();
FOREACH(Ptr<XmlElement>, styleElement, XmlGetElements(xml->rootElement))
{
if (styleElement->name.value == L"Style")
{
if (auto style = GuiInstanceStyle::LoadFromXml(styleElement, errors))
{
context->styles.Add(style);
}
}
else
{
errors.Add(L"Unknown style type \"" + styleElement->name.value + L"\".");
}
}
return context;
}
Ptr<parsing::xml::XmlDocument> GuiInstanceStyleContext::SaveToXml()
{
auto xmlStyles = MakePtr<XmlElement>();
xmlStyles->name.value = L"Styles";
FOREACH(Ptr<GuiInstanceStyle>, style, styles)
{
xmlStyles->subNodes.Add(style->SaveToXml());
}
auto doc = MakePtr<XmlDocument>();
doc->rootElement = xmlStyles;
return doc;
}
}
}
/***********************************************************************
GuiInstanceSchemaRepresentation.cpp
***********************************************************************/
namespace vl
{
namespace presentation
{
using namespace collections;
using namespace parsing::xml;
/***********************************************************************
GuiInstancePropertySchame
***********************************************************************/
Ptr<GuiInstancePropertySchame> GuiInstancePropertySchame::LoadFromXml(Ptr<parsing::xml::XmlElement> xml, collections::List<WString>& errors)
{
auto schema = MakePtr<GuiInstancePropertySchame>();
if (auto attName = XmlGetAttribute(xml, L"Name"))
{
schema->name = attName->value.value;
}
else
{
errors.Add(L"Missing attribute \"Name\" in <" + xml->name.value + L">.");
}
if (auto attName = XmlGetAttribute(xml, L"Type"))
{
schema->typeName = attName->value.value;
}
else
{
errors.Add(L"Missing attribute \"Type\" in <" + xml->name.value + L">.");
}
if (auto attReadonly = XmlGetAttribute(xml, L"Readonly"))
{
schema->readonly = attReadonly->value.value == L"true";
}
if (auto attObservable = XmlGetAttribute(xml, L"Observable"))
{
schema->observable = attObservable->value.value == L"true";
}
return schema;
}
Ptr<parsing::xml::XmlElement> GuiInstancePropertySchame::SaveToXml()
{
auto xmlProperty = MakePtr<XmlElement>();
xmlProperty->name.value = L"Property";
auto attName = MakePtr<XmlAttribute>();
attName->name.value = L"Name";
attName->value.value = name;
xmlProperty->attributes.Add(attName);
auto attType = MakePtr<XmlAttribute>();
attType->name.value = L"Type";
attType->value.value = typeName;
xmlProperty->attributes.Add(attType);
auto attReadonly = MakePtr<XmlAttribute>();
attReadonly->name.value = L"Readonly";
attReadonly->value.value = readonly ? L"true" : L"false";
xmlProperty->attributes.Add(attReadonly);
auto attObservable = MakePtr<XmlAttribute>();
attObservable->name.value = L"Observable";
attObservable->value.value = observable ? L"true" : L"false";
xmlProperty->attributes.Add(attObservable);
return xmlProperty;
}
/***********************************************************************
GuiInstanceTypeSchema
***********************************************************************/
void GuiInstanceTypeSchema::LoadFromXml(Ptr<parsing::xml::XmlElement> xml, collections::List<WString>& errors)
{
if (auto attName = XmlGetAttribute(xml, L"ref.Class"))
{
typeName = attName->value.value;
}
else
{
errors.Add(L"Missing attribute \"ref.Class\" in <" + xml->name.value + L">.");
}
if (auto attParent = XmlGetAttribute(xml, L"Parent"))
{
parentType = attParent->value.value;
}
FOREACH(Ptr<XmlElement>, memberElement, XmlGetElements(xml, L"Property"))
{
auto prop = GuiInstancePropertySchame::LoadFromXml(memberElement, errors);
properties.Add(prop);
}
}
Ptr<parsing::xml::XmlElement> GuiInstanceTypeSchema::SaveToXml()
{
auto xmlType = MakePtr<XmlElement>();
auto attClass = MakePtr<XmlAttribute>();
attClass->name.value = L"ref.Class";
attClass->value.value = typeName;
xmlType->attributes.Add(attClass);
if (parentType != L"")
{
auto attParent = MakePtr<XmlAttribute>();
attParent->name.value = L"Parent";
attParent->value.value = parentType;
xmlType->attributes.Add(attParent);
}
FOREACH(Ptr<GuiInstancePropertySchame>, prop, properties)
{
xmlType->subNodes.Add(prop->SaveToXml());
}
return xmlType;
}
/***********************************************************************
GuiInstanceDataSchema
***********************************************************************/
Ptr<GuiInstanceDataSchema> GuiInstanceDataSchema::LoadFromXml(Ptr<parsing::xml::XmlElement> xml, collections::List<WString>& errors)
{
auto schema = MakePtr<GuiInstanceDataSchema>();
schema->GuiInstanceTypeSchema::LoadFromXml(xml, errors);
schema->referenceType = xml->name.value == L"Class";
if (!schema->referenceType)
{
if (schema->parentType != L"")
{
errors.Add(
L"Struct \"" + schema->parentType +
L"\" should not have a parent type."
);
}
}
FOREACH(Ptr<GuiInstancePropertySchame>, prop, schema->properties)
{
if (prop->readonly)
{
errors.Add(
L"Property \"" + prop->name +
L"\" should not be readonly in data type \"" + schema->typeName +
L"\"."
);
}
if (prop->observable)
{
errors.Add(
L"Property \"" + prop->name +
L"\" should not be observable in data type \"" + schema->typeName +
L"\"."
);
}
}
return schema;
}
Ptr<parsing::xml::XmlElement> GuiInstanceDataSchema::SaveToXml()
{
auto xmlType = GuiInstanceTypeSchema::SaveToXml();
xmlType->name.value = referenceType ? L"Class" : L"Struct";
return xmlType;
}
/***********************************************************************
GuiInstanceInterfaceSchema
***********************************************************************/
Ptr<GuiInstanceMethodSchema> GuiInstanceMethodSchema::LoadFromXml(Ptr<parsing::xml::XmlElement> xml, collections::List<WString>& errors)
{
auto schema = MakePtr<GuiInstanceMethodSchema>();
if (auto attName = XmlGetAttribute(xml, L"Name"))
{
schema->name = attName->value.value;
}
else
{
errors.Add(L"Missing attribute \"Name\" in <" + xml->name.value + L">.");
}
if (auto attName = XmlGetAttribute(xml, L"Type"))
{
schema->returnType = attName->value.value;
}
else
{
errors.Add(L"Missing attribute \"Type\" in <" + xml->name.value + L">.");
}
FOREACH(Ptr<XmlElement>, memberElement, XmlGetElements(xml, L"Argument"))
{
auto prop = GuiInstancePropertySchame::LoadFromXml(memberElement, errors);
schema->arguments.Add(prop);
}
return schema;
}
Ptr<parsing::xml::XmlElement> GuiInstanceMethodSchema::SaveToXml()
{
auto xmlMethod = MakePtr<XmlElement>();
xmlMethod->name.value = L"Method";
auto attName = MakePtr<XmlAttribute>();
attName->name.value = L"Name";
attName->value.value = name;
xmlMethod->attributes.Add(attName);
auto attType = MakePtr<XmlAttribute>();
attType->name.value = L"Type";
attType->value.value = returnType;
xmlMethod->attributes.Add(attType);
FOREACH(Ptr<GuiInstancePropertySchame>, prop, arguments)
{
xmlMethod->subNodes.Add(prop->SaveToXml());
}
return xmlMethod;
}
/***********************************************************************
GuiInstanceInterfaceSchema
***********************************************************************/
Ptr<GuiInstanceInterfaceSchema> GuiInstanceInterfaceSchema::LoadFromXml(Ptr<parsing::xml::XmlElement> xml, collections::List<WString>& errors)
{
auto schema = MakePtr<GuiInstanceInterfaceSchema>();
schema->GuiInstanceTypeSchema::LoadFromXml(xml, errors);
FOREACH(Ptr<XmlElement>, memberElement, XmlGetElements(xml, L"Method"))
{
auto method = GuiInstanceMethodSchema::LoadFromXml(memberElement, errors);
schema->methods.Add(method);
}
return schema;
}
Ptr<parsing::xml::XmlElement> GuiInstanceInterfaceSchema::SaveToXml()
{
auto xmlType = GuiInstanceTypeSchema::SaveToXml();
xmlType->name.value = L"Interface";
FOREACH(Ptr<GuiInstanceMethodSchema>, method, methods)
{
xmlType->subNodes.Add(method->SaveToXml());
}
return xmlType;
}
/***********************************************************************
GuiInstanceSchema
***********************************************************************/
Ptr<GuiInstanceSchema> GuiInstanceSchema::LoadFromXml(Ptr<parsing::xml::XmlDocument> xml, collections::List<WString>& errors)
{
auto schema = MakePtr<GuiInstanceSchema>();
FOREACH(Ptr<XmlElement>, schemaElement, XmlGetElements(xml->rootElement))
{
if (schemaElement->name.value == L"Struct" || schemaElement->name.value == L"Class")
{
schema->schemas.Add(GuiInstanceDataSchema::LoadFromXml(schemaElement, errors));
}
else if (schemaElement->name.value == L"Interface")
{
schema->schemas.Add(GuiInstanceInterfaceSchema::LoadFromXml(schemaElement, errors));
}
else
{
errors.Add(L"Unknown schema type \"" + schemaElement->name.value + L"\".");
}
}
return schema;
}
Ptr<parsing::xml::XmlDocument> GuiInstanceSchema::SaveToXml()
{
auto xmlElement = MakePtr<XmlElement>();
xmlElement->name.value = L"InstanceSchema";
FOREACH(Ptr<GuiInstanceTypeSchema>, type, schemas)
{
xmlElement->subNodes.Add(type->SaveToXml());
}
auto doc = MakePtr<XmlDocument>();
doc->rootElement = xmlElement;
return doc;
}
}
}
/***********************************************************************
InstanceQuery\GuiInstanceQuery.cpp
***********************************************************************/
namespace vl
{
namespace presentation
{
using namespace collections;
/***********************************************************************
ExecuteQueryVisitor
***********************************************************************/
class ExecuteQueryVisitor : public Object, public GuiIqQuery::IVisitor
{
public:
Ptr<GuiInstanceContext> context;
List<Ptr<GuiConstructorRepr>>& input;
List<Ptr<GuiConstructorRepr>>& output;
ExecuteQueryVisitor(Ptr<GuiInstanceContext> _context, List<Ptr<GuiConstructorRepr>>& _input, List<Ptr<GuiConstructorRepr>>& _output)
:context(_context), input(_input), output(_output)
{
}
static bool TestCtor(GuiIqPrimaryQuery* node, GlobalStringKey attribute, Ptr<GuiConstructorRepr> ctor)
{
if (node->attributeNameOption == GuiIqNameOption::Specified && node->attributeName.value != attribute.ToString())
{
return false;
}
if (node->typeNameOption == GuiIqNameOption::Specified && node->typeName.value != ctor->typeName.ToString())
{
return false;
}
if (node->referenceName.value != L"")
{
bool instanceName = ctor->instanceName != GlobalStringKey::Empty && node->referenceName.value == ctor->instanceName.ToString();
bool styleName = ctor->styleName && node->referenceName.value == ctor->styleName.Value();
return instanceName || styleName;
}
return true;
}
void Traverse(GuiIqPrimaryQuery* node, Ptr<GuiAttSetterRepr> setter)
{
if (setter)
{
FOREACH_INDEXER(GlobalStringKey, attribute, index, setter->setters.Keys())
{
auto setterValue = setter->setters.Values()[index];
FOREACH(Ptr<GuiValueRepr>, value, setterValue->values)
{
if (auto ctor = value.Cast<GuiConstructorRepr>())
{
if (TestCtor(node, attribute, ctor))
{
output.Add(ctor);
}
}
if (node->childOption == GuiIqChildOption::Indirect)
{
if (auto setter = value.Cast<GuiAttSetterRepr>())
{
Traverse(node, setter);
}
}
}
}
}
else
{
if (TestCtor(node, GlobalStringKey::Empty, context->instance))
{
output.Add(context->instance);
}
if (node->childOption == GuiIqChildOption::Indirect)
{
Traverse(node, context->instance);
}
}
}
void Visit(GuiIqPrimaryQuery* node)override
{
auto inputExists = &input;
if (inputExists)
{
FOREACH(Ptr<GuiConstructorRepr>, setter, input)
{
Traverse(node, setter);
}
}
else
{
Traverse(node, 0);
}
}
void Visit(GuiIqCascadeQuery* node)override
{
List<Ptr<GuiConstructorRepr>> temp;
ExecuteQuery(node->parent, context, input, temp);
ExecuteQuery(node->child, context, temp, output);
}
void Visit(GuiIqSetQuery* node)override
{
List<Ptr<GuiConstructorRepr>> first, second;
ExecuteQuery(node->first, context, input, first);
ExecuteQuery(node->second, context, input, second);
switch (node->op)
{
case GuiIqBinaryOperator::ExclusiveOr:
CopyFrom(output, From(first).Except(second).Union(From(second).Except(second)));
break;
case GuiIqBinaryOperator::Intersect:
CopyFrom(output, From(first).Intersect(second));
break;
case GuiIqBinaryOperator::Union:
CopyFrom(output, From(first).Union(second));
break;
case GuiIqBinaryOperator::Substract:
CopyFrom(output, From(first).Except(second));
break;
}
}
};
/***********************************************************************
ExecuteQuery
***********************************************************************/
void ExecuteQuery(Ptr<GuiIqQuery> query, Ptr<GuiInstanceContext> context, collections::List<Ptr<GuiConstructorRepr>>& input, collections::List<Ptr<GuiConstructorRepr>>& output)
{
ExecuteQueryVisitor visitor(context, input, output);
query->Accept(&visitor);
}
void ExecuteQuery(Ptr<GuiIqQuery> query, Ptr<GuiInstanceContext> context, collections::List<Ptr<GuiConstructorRepr>>& output)
{
ExecuteQuery(query, context, *(List<Ptr<GuiConstructorRepr>>*)0, output);
}
/***********************************************************************
ApplyStyle
***********************************************************************/
void ApplyStyleInternal(Ptr<GuiAttSetterRepr> src, Ptr<GuiAttSetterRepr> dst)
{
FOREACH_INDEXER(GlobalStringKey, attribute, srcIndex, src->setters.Keys())
{
auto srcValue = src->setters.Values()[srcIndex];
vint dstIndex = dst->setters.Keys().IndexOf(attribute);
if (dstIndex == -1)
{
dst->setters.Add(attribute, srcValue);
}
else
{
auto dstValue = dst->setters.Values()[dstIndex];
if (srcValue->binding == dstValue->binding)
{
if (srcValue->binding == GlobalStringKey::_Set)
{
ApplyStyleInternal(srcValue->values[0].Cast<GuiAttSetterRepr>(), dstValue->values[0].Cast<GuiAttSetterRepr>());
}
else
{
CopyFrom(dstValue->values, srcValue->values, true);
}
}
}
}
FOREACH_INDEXER(GlobalStringKey, eventName, srcIndex, src->eventHandlers.Keys())
{
if (!dst->eventHandlers.Keys().Contains(eventName))
{
auto srcValue = src->eventHandlers.Values()[srcIndex];
dst->eventHandlers.Add(eventName, srcValue);
}
}
}
void ApplyStyle(Ptr<GuiInstanceStyle> style, Ptr<GuiConstructorRepr> ctor)
{
ApplyStyleInternal(style->setter->Clone().Cast<GuiAttSetterRepr>(), ctor);
}
/***********************************************************************
GuiIqPrint
***********************************************************************/
class GuiIqPrintVisitor : public Object, public GuiIqQuery::IVisitor
{
public:
stream::StreamWriter& writer;
GuiIqPrintVisitor(stream::StreamWriter& _writer)
:writer(_writer)
{
}
void Visit(GuiIqPrimaryQuery* node)override
{
switch (node->childOption)
{
case GuiIqChildOption::Direct:
writer.WriteString(L"/");
break;
case GuiIqChildOption::Indirect:
writer.WriteString(L"//");
break;
}
if (node->attributeNameOption == GuiIqNameOption::Specified)
{
writer.WriteChar(L'@');
writer.WriteString(node->attributeName.value);
writer.WriteChar(L':');
}
if (node->typeNameOption == GuiIqNameOption::Specified)
{
writer.WriteString(node->typeName.value);
}
else
{
writer.WriteChar(L'*');
}
if (node->referenceName.value != L"")
{
writer.WriteChar(L'.');
writer.WriteString(node->referenceName.value);
}
}
void Visit(GuiIqCascadeQuery* node)override
{
node->parent->Accept(this);
node->child->Accept(this);
}
void Visit(GuiIqSetQuery* node)override
{
writer.WriteChar(L'(');
node->first->Accept(this);
switch (node->op)
{
case GuiIqBinaryOperator::ExclusiveOr:
writer.WriteString(L" ^ ");
break;
case GuiIqBinaryOperator::Intersect:
writer.WriteString(L" * ");
break;
case GuiIqBinaryOperator::Union:
writer.WriteString(L" + ");
break;
case GuiIqBinaryOperator::Substract:
writer.WriteString(L" - ");
break;
}
node->second->Accept(this);
writer.WriteChar(L')');
}
};
void GuiIqPrint(Ptr<GuiIqQuery> query, stream::StreamWriter& writer)
{
GuiIqPrintVisitor visitor(writer);
query->Accept(&visitor);
}
}
}
/***********************************************************************
InstanceQuery\GuiInstanceQuery_Parser.cpp
***********************************************************************/
namespace vl
{
namespace presentation
{
/***********************************************************************
ParserText
***********************************************************************/
const wchar_t parserTextBuffer[] =
L"\r\n" L""
L"\r\n" L"class Query"
L"\r\n" L"{"
L"\r\n" L"}"
L"\r\n" L""
L"\r\n" L"enum NameOption"
L"\r\n" L"{"
L"\r\n" L"\tSpecified,"
L"\r\n" L"\tAny,"
L"\r\n" L"}"
L"\r\n" L""
L"\r\n" L"enum ChildOption"
L"\r\n" L"{"
L"\r\n" L"\tDirect,"
L"\r\n" L"\tIndirect,"
L"\r\n" L"}"
L"\r\n" L""
L"\r\n" L"class PrimaryQuery : Query"
L"\r\n" L"{"
L"\r\n" L"\tChildOption\t\tchildOption;"
L"\r\n" L"\tNameOption\t\tattributeNameOption;"
L"\r\n" L"\ttoken\t\t\tattributeName;"
L"\r\n" L"\tNameOption\t\ttypeNameOption;"
L"\r\n" L"\ttoken\t\t\ttypeName;"
L"\r\n" L"\ttoken\t\t\treferenceName;"
L"\r\n" L"}"
L"\r\n" L""
L"\r\n" L"class CascadeQuery : Query"
L"\r\n" L"{"
L"\r\n" L"\tQuery\t\t\tparent;"
L"\r\n" L"\tQuery\t\t\tchild;"
L"\r\n" L"}"
L"\r\n" L""
L"\r\n" L"enum BinaryOperator"
L"\r\n" L"{"
L"\r\n" L"\tExclusiveOr,"
L"\r\n" L"\tIntersect,"
L"\r\n" L"\tUnion,"
L"\r\n" L"\tSubstract,"
L"\r\n" L"}"
L"\r\n" L""
L"\r\n" L"class SetQuery : Query"
L"\r\n" L"{"
L"\r\n" L"\tQuery\t\t\tfirst;"
L"\r\n" L"\tQuery\t\t\tsecond;"
L"\r\n" L"\tBinaryOperator\top;"
L"\r\n" L"}"
L"\r\n" L""
L"\r\n" L"token INDIRECT = \"////\";"
L"\r\n" L"token DIRECT = \"//\";"
L"\r\n" L"token NAME = \"[a-zA-Z_][a-zA-Z0-9]*\";"
L"\r\n" L"token WILDCARD = \"/*\";"
L"\r\n" L"token OPEN = \"/(\";"
L"\r\n" L"token CLOSE = \"/)\";"
L"\r\n" L"token XOR = \"/^\";"
L"\r\n" L"token INTERSECT = \"/*\";"
L"\r\n" L"token UNION = \"/+\";"
L"\r\n" L"token SUBSTRACT = \"-\";"
L"\r\n" L"token ATTRIBUTE = \"@\";"
L"\r\n" L"token COLON = \":\";"
L"\r\n" L"token DOT = \".\";"
L"\r\n" L""
L"\r\n" L"discardtoken SPACE = \"/s+\";"
L"\r\n" L""
L"\r\n" L"rule PrimaryQuery QPrimaryFragment"
L"\r\n" L"\t=\t("
L"\r\n" L"\t\t\t(NAME : typeName with {typeNameOption=\"Specified\"})"
L"\r\n" L"\t\t\t| (\"*\" with {typeNameOption=\"Any\"})"
L"\r\n" L"\t\t)"
L"\r\n" L"\t\t[\".\" NAME : referenceName] as PrimaryQuery"
L"\r\n" L"\t;"
L"\r\n" L""
L"\r\n" L"rule PrimaryQuery QPrimaryAttributed"
L"\r\n" L"\t= !QPrimaryFragment with {attributeNameOption=\"Any\"}"
L"\r\n" L"\t= \"@\" [NAME : attributeName] \":\" !QPrimaryFragment with {attributeNameOption=\"Specified\"}"
L"\r\n" L"\t;"
L"\r\n" L""
L"\r\n" L"rule PrimaryQuery QPrimary"
L"\r\n" L"\t= (\"/\" with {childOption=\"Direct\"}) !QPrimaryAttributed"
L"\r\n" L"\t= (\"//\" with {childOption=\"Indirect\"}) !QPrimaryAttributed"
L"\r\n" L"\t= \"(\" !QueryRoot \")\""
L"\r\n" L"\t;"
L"\r\n" L""
L"\r\n" L"rule Query Query0"
L"\r\n" L"\t= !QPrimary"
L"\r\n" L"\t= Query0 : parent QPrimary : child as CascadeQuery;"
L"\r\n" L""
L"\r\n" L"rule Query Query1"
L"\r\n" L"\t= !Query0"
L"\r\n" L"\t= Query1 : first \"^\" Query0 : second as SetQuery with {op=\"ExclusiveOr\"}"
L"\r\n" L"\t= Query1 : first \"*\" Query0 : second as SetQuery with {op=\"Intersect\"}"
L"\r\n" L"\t;"
L"\r\n" L"\t"
L"\r\n" L"rule Query Query2"
L"\r\n" L"\t= !Query1"
L"\r\n" L"\t= Query2 : first \"+\" Query1 : second as SetQuery with {op=\"Union\"}"
L"\r\n" L"\t= Query2 : first \"-\" Query1 : second as SetQuery with {op=\"Substract\"}"
L"\r\n" L"\t;"
L"\r\n" L""
L"\r\n" L"rule Query QueryRoot"
L"\r\n" L"\t= !Query2"
L"\r\n" L"\t;"
;
vl::WString GuiIqGetParserTextBuffer()
{
return parserTextBuffer;
}
/***********************************************************************
SerializedTable
***********************************************************************/
const vint parserBufferLength = 6350; // 25801 bytes before compressing
const vint parserBufferBlock = 1024;
const vint parserBufferRemain = 206;
const vint parserBufferRows = 7;
const char* parserBuffer[] = {
"\x00\x00\x80\x84\x01\x8C\x01\x83\x20\x00\x61\x00\x33\x20\x03\x30\x84\x00\x32\x00\x65\x00\x11\x20\x05\x39\x88\x00\x72\x00\x39\x20\x0F\x7D\x8F\x7F\x82\x00\xD0\x18\x80\x09\x30\x01\x36\x87\x19\x9B\x94\x96\x82\x89\x94\x8E\x8F\x05\x01\xAB\x97\x8E\x96\x8F\x7E\x04\x01\xD3\x17\x94\x33\x8D\x88\x9A\x8D\x2F\x9D\x8B\x04\x86\x86\x87\x85\x86\x09\x90\x92\x93\x9D\x90\xA1\x98\x80\x0D\xE8\x24\x80\x0C\x37\x85\xA1\x8F\x45\x89\x87\xAE\x8A\xA5\x9C\x97\x91\x1B\x86\x01\x90\x38\x97\x8A\x36\x00\x3C\xB6\xA0\x80\x02\x91\x8D\x93\x93\x09\xAE\x8C\xA0\xB0\x05\x05\x81\x84\x3C\xBC\xAE\xA0\x02\x36\x9C\x9E\x89\x4E\x0E\xA7\x92\x8A\xB1\x81\xB7\xA9\x70\xF4\xB3\xAE\x93\x0F\xB8\xB5\xC7\x7B\xFD\x96\x9F\xB0\x01\xC1\x85\xC1\x00\x4F\x00\x04\xBC\x9D\x93\x36\x00\x67\x85\xE1\x83\x9F\xB5\xB2\x94\x9F\x4D\x9B\x83\xB0\xA0\x02\xA9\x93\xAA\x10\x9A\xDC\xD3\xAF\xC9\xD2\x8F\xB5\x87\xA5\xF1\xA0\xAB\xC0\xA2\xBA\x80\x19\x92\xA6\x3F\x92\x8F\xB1\x86\xC0\x82\x97\xA2\xCC\xB4\xD6\x92\xD2\xAF\x3F\x9B\xB8\x80\x8C\x9B\x8C\xB2\xE4\x97\xCA\xF7\xC6\xCD\xE1\xC6\xB8\xD4\x74\x8E\x01\x95\xEB\xCF\x8A\xCA\xE7\x12\xB2\xCF\xDE\xC0\xD7\xAB\xE8\x00\x3A\x92\xBC\x9D\xDB\x8F\xA4\x01\xE1\x25\x99\x8B\x89\xBE\x8F\xF5\xF9\xC7\xF4\x40\x02\x01\x40\x9F\x64\x56\x4E\x7F\x3B\x50\x79\x68\x00\x62\x40\x4B\x42\x44\x0D\x75\x66\x56\x4D\x11\x01\x4F\x09\x40\x15\x81\x4A\x85\x40\x36\x76\x4B\x84\x87\x1D\x9D\x4F\x84\x40\x21\xA2\x83\x89\x89\x37\x41\x49\x11\x65\x00\x04\x10\x03\x8A\x52\x00\x05\x10\x00\x07\x54\x10\x03\x40\x00\x57\x8A\x8C\x00\x17\x9A\x86\x4D\x83\x2D\xAF\x80\x01\x8C\x33\xB5\x82\x82\x85\x3C\x80\x01\x00\x88\x1D\x78\x8C\x89\x10\x00\x0D\x12\x8C\x00\x15\x01\x4B\x16\x43\x2D\x00\x0A\x1C\x00\x50\x99\x9A\x14\x00\x5F\x00\x0D\x14\x00\x57\x89\x49\x97\x96\x5D\x80\x0F\x94\x0C\x00\x19\x99\x0E\x98\x00\x2A\x07\x90\x89\xFD\x41\x47\x16\x90\x4C\x01\x97\x40\x94\x31\xAE\x83\x81\x8E\x71\x80\x03\x00\x93\xFF\x0E\x9A\x66\x48\x33\x81\x6F\x9D\x92\x28\x37\x84\xA2\x7D\x07\x79\x9A\x66\x4E\x33\x8B\xA7\x85\x0A\x00\x36\x76\x4F\xA0\x00\x58\x19\x67\x90\x73\x89\x9E\x14\x83\x84\x89\x0A\x88\x8B\x36\xB3\x81\x8C\xA5\x34\x80\x06\x8E\xA5\x81\x87\x0F\xA1\x40\x55\x2C\x8B\x8A\x66\x8A\x88\x9B\x08\x00\xEF\x76\x46\xA8\x40\x3A\x75\xA2\x10\x7C\xAE\xA0\xA0\x96\x91\x4B\x80\x49\x97\xAF\x57\x4C\xB0\x96\x8D\x36\xB1\x8B\x8B\xB0\xB5\xA9\xAA\x91\x40\x40\x00\x0A\x03\xAC\x00\x47\x4A\x66\xA4\x2C\x89\xB0\x02\x0E\x00\x2B\x67\x54\xA7\x41\x9A\x66\x8E\xB8\x2E\x00\x0B\x5A\x4D\xE2\xB6\x7A\x4E\x48\xC7\x93\x98\xBB\x85\x0B\x7B\xAF\x6F\x55\x3D\xA4\xA0\x41\x80\x32\x00\x00\x06\x4C\xE0\x6E\x41\xC1\xBB\x31\x9F\x6F\x64\x4F\x3A\x7C\x4B\x6C\x4F\xE6\x8F\x35\x08\x08\x00\x24\x00\x00\x0F\x0A\xB4\x51\xC2\x0F\xFE\x99\xC6\xC2\xBB\x04\xDF\x5F\xC5\xBB\x0D\xE5\x5C\x4F\xB6\x00\x77\x20\x00\xC5\x18\xC0\xC0\x00\xC7\xEF\x54\x49\x6E\x73\xBB\x5B\x48\xC9\x4F\x33\xDE\x70\x51\xBB\x31\x00\x05\x25\x40\x2D\xCC\x7B\x5E\xCE\x1B\x5C\xC4\xB8\xC5\x8D\x94\xC2\x09\x92\x4B\xD2\xC4\xC7\x1D\x53\x7C\x42\x54\xC5\x7B\x2B\xCC\x41\x6B\x53\x70\x6F\xA7\x6C\xEC\x67\x54\xC5\x0F\x56\xCB\xDE\x89\x7E\x17\x4D\x4C\x4F\xD2\x14\xFD\x16\xD4\xA6\x14\xE1\x08\xCD\x77\xCF\x50\x99\x5D\x73\x92\x4F\x62\x44\x44\x76\x5B\xB1\xD1\xCE\xCF\x46\xD6\xD5\xD2\x00\x0B\xDB\x8D\xD3\x13\xC0\x00\xD5\x49\x52\xD6\xD5\xD4\xC5\x51\x59\xD6\x56\x7A\x9D\x40\x02\x87\xD7\x61\xC2\x97\x58\x44\x64\xD0\x8F\x60\xDA\x00\x2A\xD4\xC4\xDB\x00\x2E\xD2\xCC\xDC\x35\xDC\x9F\x62\x5E\x53\x75\xD4\x64\x44\x31\xC2\xD8\x63\x73\x37\xE3\xE3\xD3\x73\xED\x81\xCF\x04\xD0\x6F\xF3\xE5\xEA\xDF\x4A\xC0\x0D\xA0\xE1\x6D\xDE\xC0\x51\xC2\x92\xCF\x6D\xEC\xA6\x4B\xC3\xCF\xBE\xEB\xBA\x74\x56\x13\x48\x09\x67\x18\x79\x7B\x3C\x52\x04\xC0\xDF\xA5\xCF\xF9\x45\xF4\xD3\xE7\x5C\x4C\xCF\x00\x29\x28\xEE\xEC\xAF\xD9\xF0\xF4\x00\xD2\xD8\x6E\xF7\xCB\xE3\xBF\xDE\xF8\xC5\x81\x50\x92\x97\x8C\x14\xC7\xDF\x62\x75\xE6\x49\x72\x47\xD3\x51\xD8\xD4\xD6\xD5\xE4\x37\x38\x8B\x59\x39\x3D\xF2\x11\x73\x72\x00\x00\x6D\xEF\x3A\x22\x81\x86\x25\x20\x3F\x17\x30\x20\xE7\x1E\x70\x00\xD0\x7C\x0F\x7D\x81\x61\x50\xE7\x07\x7F\x31\xA9\x40\x03\x71\xF7\x65\x3C\x76\x53\x70\x72\xDA\x2D\x3C\x72\xBD\x70\x4B\x59\x1B\x23\x83\xB5\x6E\x86\x69\x64\x55\x71\xBB\x1C\x71\x7F\x28\x53\x4D\x7E\x56\x61\x3B\x7D\x44\x3D\x3D\xE3\x03\x83\x7A\x14\x63\x4C\xC5\x5A\x26\x6A",
"\xEC\x4A\x35\x60\x40\x2A\x79\xEE\x65\x7E\x79\xF3\x69\x7E\x2C\x8F\x36\x7B\xF2\x46\x8E\x24\xED\x4E\x27\x89\xC5\x2F\x31\xED\x61\x73\x7C\xE6\x74\x65\x89\xDB\x68\x7D\xF7\x0F\x3C\x76\xDF\x58\x85\x86\xF3\x76\x6A\xFD\x01\x89\x7E\x02\x96\x6C\x83\x89\x7F\x7C\xC5\x6C\x83\x84\xCC\x25\x85\x6B\x56\x6A\x81\x06\x8C\x85\x6D\xA9\x10\x87\x6E\x19\x89\x6E\x0B\x94\x67\x82\xA4\x55\x72\x4E\x1B\x9D\x7E\x07\xA0\x84\x8F\x1F\xB6\x8E\x80\x26\x9E\x69\x02\x95\x7A\x84\xA0\x2D\x87\x73\x2F\x85\x73\x95\x3D\x73\x86\xAB\x68\x8F\x86\xED\x74\x62\x0E\xC3\x3D\x29\x2C\xBE\x87\x3C\x98\x21\x8A\xD5\x44\x84\x62\x2A\xBC\x30\x89\x1B\x32\x8B\x12\xCD\x7E\x24\xB9\x50\x31\x75\x7E\x31\x80\x00\x14\x07\x7A\xD2\x74\x2E\x96\xA8\x65\x26\xEA\x3A\x9B\x8A\x9E\x00\x23\x6F\xBE\x95\x97\xE9\x74\x69\x96\x40\xA5\x8B\x69\xD9\x40\x79\x0C\xF0\x76\x75\x34\xB8\x83\x88\xCB\x91\x31\x33\x8E\x97\x22\x55\xBD\x74\x5C\x9C\x62\x76\x17\xC4\x60\x00\x2B\x9C\x7A\x7D\xC6\x66\x72\x22\x8A\x7B\x95\x6C\xB8\x93\x32\x6D\x84\x84\x24\xF8\x88\x85\x3D\xA2\x87\x6A\x0F\x93\x28\x20\xAD\x8A\x88\xF2\x74\x90\x28\xE6\x82\x8C\x3A\xD5\x7D\x96\xDD\x60\x8F\x8A\x63\x9F\x78\x00\x33\x0C\x8B\x63\xB3\x97\x8B\x55\x8E\x89\x42\xEC\x76\x7E\xC0\x40\x77\x93\xF4\x61\x95\x08\x82\x88\x95\x6E\xAA\x98\x71\xFE\x7F\x80\x00\xC0\x2C\xA2\xFD\x5B\x6B\x3D\xC5\x72\x92\x1E\xCB\x6C\x8E\xCD\x79\x9D\x24\xFB\x96\x68\x05\x96\x88\x83\xA5\x48\x97\x8D\xEB\x92\x8F\x46\xF1\x9F\x90\xAE\x69\xA1\x8F\x94\x8D\x3C\x0B\xB2\xA3\x91\x0A\x96\x6B\x93\x19\x9D\x90\x0C\x98\xAA\x8D\x1C\x97\x24\x94\x23\x26\x94\x4F\x9E\xA2\x88\xA3\x05\x89\x99\xAF\x82\x65\x12\x85\xAC\x89\x88\xA1\x88\x8B\xD4\x60\x00\x06\x5C\xAF\x9F\x8D\x01\xA0\xAC\xEB\x68\x61\xF1\x0B\x63\x4B\xCB\x54\x49\x20\x16\x68\x9A\x41\xDE\xA8\xA1\x81\xAC\x7C\x62\x12\x72\x96\x3F\x90\xA0\x28\x60\x8C\x98\x9E\x80\x9C\x97\x14\xD8\xAB\x22\xBF\x9A\x98\xB0\x56\x20\x7F\x30\x5D\x8E\x95\xC2\xAE\x9A\x98\xDB\x90\x21\x19\xE2\x9D\xB1\x72\x92\xA6\xAE\x30\x90\x8D\x48\xA0\x88\x2F\x5B\x90\xB0\xB1\x1D\xA5\x82\x4F\x88\x8B\xA4\xD3\x6B\x81\x90\x9D\x75\x2E\xB6\x17\x6F\xA0\x72\x86\xB7\x9D\x76\x76\x2B\x33\x80\x01\x9B\xA3\x9E\x95\x9A\xA0\x96\x7D\x67\xC1\x9C\x2F\x6D\xA1\xB6\x6A\x55\xAB\x68\x38\xD6\x64\xB2\xC2\x96\xB7\xAB\x13\xB9\xB1\x4E\xA2\xA8\x9B\xB9\x47\xB1\xB6\xBF\xB7\x8F\x4F\xF5\x9C\xA5\x7B\x8E\x83\x87\x30\xB6\x29\x0B\xFA\xA3\x9D\xB8\x4F\xB5\xB7\x88\xB0\x22\x60\xAD\xBE\xBA\xE7\xB0\xB3\x75\x00\x0D\x5D\x0D\x0F\x3E\xA1\xBD\xAE\xB7\xBB\xC3\x8E\x9A\x46\xD0\x98\xB4\xA4\x8C\xAF\x9A\x0E\x26\xBF\x67\xD0\xB6\xA4\x6F\x99\x83\xB8\x30\x85\xBB\x5C\x80\xA7\xB2\x28\xBC\x24\x7F\x20\xAB\x91\x3B\xFA\xB0\xBC\xFE\xAE\x8A\xBA\xA4\xB5\x71\x4B\xF8\x98\xBA\x5D\x9B\xBC\xAC\x7C\xAE\xB0\x83\xF1\xB6\x2B\xF1\xAE\xBD\xBC\x9E\xAD\xC0\x7A\xED\x54\x06\xF6\xAC\xB7\xC3\xA5\x6F\xB7\x7E\xE8\xB3\xB7\xDA\x94\x66\xBE\xB8\xB9\xA2\x6E\xF0\xBE\xB7\xFE\xB0\x48\x86\xC2\xA8\xB6\x80\xDD\xA4\xC0\xE4\xB6\xA8\xC1\x1D\x8C\x9D\x73\xA1\xCC\xC3\xE8\xB3\x9B\xBA\x93\x8B\x82\x75\xFE\x8A\x9E\xED\x84\xAD\x9F\xDD\xA6\x7E\x8F\x86\xC0\x00\xEE\x95\xB7\xAC\x13\xAA\xBD\x43\xA7\xC1\xCB\x83\xA7\x9C\xCA\x65\x96\xA3\x6D\xF2\x79\xB7\x91\xB8\x7D\x8E\x1E\xBA\xB2\x82\xF3\x84\xA5\xA9\xA2\xB0\xA5\x11\xCA\xC9\x03\xCC\xC9\xBA\x09\x84\xA8\x93\x84\x95\xA6\x06\xB8\xA9\xC0\x21\xFB\xA0\xCD\x6F\xC7\x83\x09\xC9\xC9\x83\x4A\x83\xAA\x90\x78\xC6\xAB\x8B\xB2\x88\xB5\xFB\x9A\xA3\x94\x3C\x86\x3A\x9B\xC0\xBD\x9D\x85\x2D\x96\xB8\x01\x59\xAC\x86\xEF\xBB\xC3\xC8\x80\x02\x03\x9B\xC0\xC4\x6F\x9C\xC0\x22\xB5\x8A\x67\x31\x33\x4E\xAF\x05\x70\xAC\xCB\xCA\xAA\xC2\xC4\xBA\x9C\x60\x5E\xA5\x0D\x75\xCA\xB1\x75\xCB\x2E\x2D\x5C\x43\xB6\x1C\xB0\xE3\xA1\xCD\x72\x17\x49\x91\x9F\xBA\xAD\x71\xD7\x0F\x77\xC8\x71\xD9\x83\xD8\x51\xA7\x6B\xB3\x77\xCA\xD1\xA1\x64\xBD\x8A\xB4\xC1\xBC\x00\x12\x61\x6F\xAD\xDE\xD6\x46\x80\x72\x70\xA6\x7C\xC9\xC8\xC4\xD8\x6A\xB1\xB1\x38\xD9\x41\xE5\xB3\x45\x6E\xB9\x71\xB3\xA8\xB3\xA6\xE2\x92\xDF\x97\xD4\xD1\xB4\x44\x57\xDB\xB4\xB9\xBC\xC5\x68\xF3\xA6\x8D\x38\xC2\x7B\x22\xE2\x6C\xAF\x78\x19\x92\x60\x90\x01\x4C\x4D\xD6\x5A\xAB\x23\x6C\x40\x7C\x45\x6D\xB0\x96\x00\x2C\x4B\xB2\xEF\xCE\x24\xBD\xFA\x6C\xDE\x87\xD4\xA6\x6A\x04\xED\xA8\xC5\x64\x2B\x37\x2C\x87\xC1\xE2\x40\x38\xBD\xB1\xD4\x26\x2A\x6C\x96\xD5\x55\x44\x88\x2A\x55\x4B\x2D\xE0\x81",
"\xE1\x61\x3A\x16\xE6\xE0\xCC\x89\xEB\xA0\x00\x3B\x05\x8B\x07\xF6\xE1\x19\x99\xE8\xBE\x8E\xCC\xDB\x7D\x14\x68\xC4\x5D\x22\xE2\xDC\x92\xD0\x26\xE4\x56\x67\x21\xCA\xDC\x27\x23\x4C\xF4\xD1\xD4\xA5\x70\xC9\x65\xA6\xD5\x78\x9E\x29\xD6\x2A\xFB\x51\xAC\xC8\xF8\xD3\xD7\x81\xCD\xE5\x67\x32\xEB\x41\xCF\x24\xC0\x00\x5F\x38\xE0\xE6\x3D\x7B\xE7\xD7\x9A\xE5\xC2\xFD\x29\x9E\xA6\xA8\xBC\xE6\x46\x8F\x47\x6A\x09\x47\xEE\xAA\x14\x7F\x3F\x7C\x0D\xE0\xC9\x38\x8C\xBD\x78\x64\x34\xBA\xE5\x31\xBE\xEC\xCD\x4E\xDA\x90\x13\xFC\xC9\xCE\xE9\xEA\xA2\x71\xB9\xE4\x4D\x89\xE1\x6B\xE2\x97\xE1\xE9\xB5\xF8\xB8\x82\x6E\xFF\xE3\xD2\x23\x5C\x72\xB9\xF6\x7C\xEE\x11\x4D\x3F\xDD\xAC\x94\x58\xF9\x15\xE5\xEF\x9B\xB6\x69\x81\x40\xAD\x77\x19\x78\x0F\x6A\x55\x36\x23\x42\x25\x26\x0F\x8B\x1A\x31\x23\x2D\x8E\xE7\xF2\x13\xF1\xEC\xBA\x23\xED\xE6\xAA\x07\xEE\xD8\x94\xF5\xE3\x9E\x57\xF3\x2A\x99\xF5\x70\xE7\x98\xED\xE0\x36\x78\xB8\xF4\x3F\xA3\xF6\x42\x56\x6A\xEF\x8A\xCA\xBB\xD8\x7F\xEB\xF6\xE0\xAE\xF0\xF6\x9F\x33\xF0\x00\xB5\xE5\x80\xEE\xC4\xA8\xDA\xC9\xE8\xEC\xF8\x01\x46\xFA\x46\x98\xF3\xFA\xCD\xFB\xCD\xF2\x8F\xEC\xEC\xF4\xF6\xE5\xD2\xEA\xC9\x46\xE9\xA8\xEB\xCC\xE0\xAC\xF9\x82\x74\xC4\xF3\xFA\x86\x7C\x6E\x1D\x39\x71\xBD\x7E\x12\x34\x71\x30\x37\x7C\x70\xF1\x7A\x76\xF1\x7D\x73\x65\x1E\x71\xD6\x65\x38\x42\x7E\x12\x44\x7E\x1A\x46\x75\x7F\x14\x3A\x74\xD3\x7A\x72\x5D\x11\x20\x5E\x71\x7F\xE2\x1B\x7B\x33\x79\x5E\xA0\x27\x6A\x56\x72\x7A\xE5\x2C\x6A\xE6\x7B\x20\x0F\x76\x35\xBA\x75\x71\x01\x35\x80\x40\x17\x30\x00\x05\x62\xB8\x02\x7C\x1A\x38\x7E\x0D\x71\x30\xC7\x74\x36\xFB\x15\x39\xBB\x2D\x79\x96\x73\x77\x7D\x44\x7F\x48\x79\x77\xF7\x7C\x77\x1F\x50\x6E\xD9\x75\x1E\x82\x75\x2B\x67\x18\x47\xB9\x75\x02\xE5\x70\x83\x3A\x89\x73\x3C\x8B\x7E\xC8\x7D\x7E\x95\x39\x25\x42\x83\x79\xCF\x75\x84\x28\x87\x84\xA5\x70\x20\x4A\x8A\x66\x7E\x6A\x7D\x84\x65\x5D\x16\x1D\x17\x3F\x81\x46\x66\x32\x80\x91\x76\x85\x10\x79\x7E\x11\x8F\x81\x30\x71\x83\x2F\x7B\x20\x34\x8C\x50\xA4\x08\x83\x1F\x3C\x80\x79\x8C\x76\xEC\x7F\x83\xBD\x31\x84\xCC\x70\x86\x44\x8A\x39\x46\x88\x77\x65\x8B\x77\x39\x77\x7D\x4C\x80\x42\x6A\x85\x5A\x50\x81\x49\x02\x85\x85\x2E\x32\x88\x7C\x84\x88\x5B\x86\x88\x19\x4E\x85\x89\x87\x7E\x61\x8C\x88\x63\x8E\x88\xD5\x78\x7F\x4B\x8E\x77\x94\x8E\x84\x6B\x84\x2C\x6D\x8C\x85\x70\x8B\x39\x44\x58\x87\xC3\x72\x83\x1B\x1F\x7B\x3D\x31\x7C\x0A\x87\x7E\x9C\x8E\x7B\x9E\x8E\x83\x8F\x18\x63\xEF\x75\x71\xCE\x7B\x88\x75\x77\x8A\xA4\x79\x8A\x67\x8B\x5C\xAD\x81\x78\xAF\x8E\x7F\x94\x15\x78\xEB\x6D\x42\x9A\x8B\x76\xBF\x8E\x12\xEA\x76\x3F\x85\x83\x8C\x85\x3B\x79\x71\x7D\x7C\xF2\x72\x86\x6E\x54\x86\xCC\x89\x73\xF9\x79\x86\xAE\x85\x5A\xDC\x7D\x10\xB1\x73\x7D\xB4\x76\x7B\x23\x1D\x42\xB6\x80\x8C\x21\x85\x7C\x24\x8E\x6F\xA8\x68\x82\xE6\x2A\x75\x76\x82\x6B\x77\x8B\x87\x39\x88\x8B\x00\x04\x83\x3D\x3F\x87\xBD\x8D\x89\xD9\x83\x83\xC1\x83\x12\x3F\x84\x8C\x88\x80\x7F\xA4\x88\x8C\xA1\x75\x8E\xA8\x89\x84\xE8\x8B\x8A\xA9\x74\x31\x95\x85\x39\x97\x82\x85\xE4\x75\x6F\x74\x8A\x51\x2E\x3D\x83\x0E\x9E\x8D\xBD\x32\x8A\x12\x93\x7C\xA5\x89\x8C\x16\x9B\x8C\x18\x90\x73\xE9\x8A\x53\x1D\x9A\x64\xB1\x8F\x86\x0E\x11\x87\xF4\x82\x90\x1F\x37\x8F\x2E\x34\x75\x6C\x57\x75\x10\x1D\x8F\x8A\x73\x88\x00\x92\x31\xCC\x21\x20\xFA\x80\x31\x3C\x93\x3C\x6B\x5A\x45\x00\x0D\x33\x55\x29\x90\x74\x1B\x94\xC4\x7E\x78\x83\x8F\x82\x76\x84\x90\xBF\x71\x30\xBC\x85\x94\xC3\x7B\x90\xB9\x8D\x90\xC9\x7D\x3B\x37\x50\x43\x9E\x76\x35\xF3\x7A\x8C\xD3\x78\x84\xA6\x71\x20\x33\x9D\x84\xD0\x87\x6E\x61\x5D\x14\xD0\x77\x78\xA9\x57\x8D\x93\x72\x96\x51\x94\x96\x5C\x8D\x3B\xCB\x78\x96\xE2\x8D\x92\x15\x95\x72\x17\x9F\x96\xCD\x88\x7D\xCF\x8C\x7F\x4B\x3D\x8E\x24\x72\x7B\x53\x11\x7E\x9F\x23\x7E\x82\x45\x8F\x1F\x34\x90\x34\x81\x30\x08\x90\x96\x39\x8C\x97\x59\x8C\x8D\x9F\x8F\x76\x6D\x21\x70\x12\x83\x84\x9F\x74\x8E\x86\x90\x93\x88\x99\x91\x68\x84\x93\xEB\x82\x61\x3E\x1E\x86\xB7\x49\x10\x3A\x91\x92\x14\x7B\x89\x24\x9B\x83\x7E\x90\x8A\x4B\x38\x88\x82\x9A\x88\xA7\x96\x8A\x2F\x9D\x96\x8F\x87\x7A\x1A\x9A\x7F\x35\x99\x41\x1F\x9F\x53\x2D\x49\x94\x0D\x76\x95\x19\x25\x71\x56\x90\x94\xFB\x8E\x56\xF7\x8E\x8F\xCF\x9F\x94\x3C\x17\x94\x4F\x73\x58\x03\x66\x33\x50\x74\x17\x64\x77\x3B\x0C\x75\x59\xB3\x5F\x3B\xEE\x6A\x94",
"\xDA\x91\x81\x00\x79\x3C\xE1\x94\x57\x5F\x60\x81\xA0\x6E\x9D\xF7\x67\x5C\x75\x54\x65\xD4\x9C\x30\x8F\x1F\x30\x6F\x50\x10\x30\x48\x9D\x57\x65\x60\x10\x8C\x31\x52\x76\x5C\x58\x66\x57\x16\x0F\x9E\x3D\x67\x9F\x10\x84\x32\xFB\x93\x12\x3C\x13\x5E\x2A\x3C\x32\x5B\x76\x9F\xF1\x91\x56\x1C\x36\x99\x40\x1D\x33\x50\x63\x79\xF9\x94\x2C\x0E\x30\xA1\x29\x8E\x9F\x85\x38\x9D\x7B\x93\x80\x6B\x7B\x16\x76\x8E\xA0\x21\xA9\x11\x27\x31\x10\x13\xAC\x99\xDA\x8C\x3E\x1A\xA8\x70\x02\x3D\x94\x36\xAF\xA1\x25\x3C\x9F\x11\x35\xA2\x32\xA0\x14\x2D\x85\xA3\x16\x7A\xA2\xE2\x8C\xA2\x26\x3B\x5A\x29\x36\x35\x2B\x84\x17\x2D\x8E\x9C\x39\x76\x95\x8D\x12\x82\x0B\x23\x9D\x25\x85\x75\x20\xA7\xA4\xF7\x8F\x9F\x3F\xAD\x6F\xEB\x9C\x31\x4E\xA0\x73\x56\x9F\x00\x38\xA5\xA5\x6C\x56\xA4\xFC\x9B\x2F\x31\xAB\xA4\x2E\x16\x95\x1C\x36\x65\xC6\x5F\x6A\xA4\x60\x00\x1C\x0A\xA0\x1A\x64\x64\x9E\x6A\xA3\x0F\xAE\xA2\x00\x0B\x6A\x24\xA4\x31\x00\xAF\xA6\xF1\x6C\x62\x55\x64\xA7\xA6\x3D\x69\xD5\x63\x56\xF4\x95\x56\x85\xA6\xA7\xD5\x66\xA6\x22\xA9\xA0\x49\xA4\xA1\x13\x8D\x57\x81\xA1\x6B\xBC\x24\xA8\x6E\xAF\x9D\xF9\x8B\x9E\x3B\xA2\xA2\xFB\x2A\xA5\xF6\x6A\xA8\x30\x34\xA8\x3E\x98\x6B\x3B\x37\xA5\xFC\x9B\x16\x69\xA5\xA1\x04\xA4\xA8\x07\xA4\x65\x99\xA5\x9F\xAF\xAD\xA0\x35\x8B\x65\xA1\xA9\x61\x16\xA2\x50\x60\x6B\x6D\x67\x41\x63\x6C\x7D\x48\xBF\x51\x97\x8C\x4D\x66\x80\x67\x52\x82\x6A\x52\xB0\x93\x67\x2F\x56\x61\xCF\x64\x53\x86\x46\x96\xA8\x5D\x9A\x7F\x70\xAC\x26\x50\x61\xE6\x61\x54\xA7\x57\x49\xD0\x60\x3A\x48\x5B\x34\x9D\x44\x4D\x64\x62\x63\x4E\x52\x1C\x91\x67\x35\xC5\xAE\x5F\xA4\x75\x59\x4E\x71\xAB\x8A\xA0\xA7\x9E\x6E\x61\xA6\xA5\xA7\xA3\x67\xA7\x35\x7B\x58\xE5\x90\xA8\x86\xA2\x6F\x57\x95\xA1\xB3\xA1\x56\xC2\xAB\x60\x8C\xAE\x60\xF2\x43\x5A\xD7\xA9\x42\x42\x52\x87\x54\x82\x92\x93\xA2\xAF\x7F\x5A\xAF\x2D\x65\x5F\x63\x66\x43\xE2\xA3\x64\xF3\xA0\x5A\x36\x61\x5C\xED\x3B\x6F\x0B\xB9\xAB\x68\x59\x4E\xD2\xAC\x59\x95\xA5\xAC\xD6\xA8\xAC\x72\x6D\x47\xCB\xA1\x53\x88\x75\x02\xB2\x20\x10\x42\xA1\x30\xF6\x11\x20\x23\x27\x15\x05\xAA\xA9\xFD\xAB\x3E\xB8\x18\x69\x0D\x7A\x21\x6E\x34\x27\x1D\x12\xA4\x3D\x3F\xB2\x39\xB1\x10\x23\x04\x28\x42\xAC\x26\x40\xB9\x73\x1A\x25\x02\xA5\x23\xA6\x56\x97\xB4\x30\x7A\x21\x27\x04\x28\xEC\xA8\xAB\xEE\xA5\x6D\x37\xBA\xA9\x30\xB1\x10\x98\x2C\xB3\x29\x29\xA8\xB8\xA7\xB5\xF5\x99\xB5\x00\x1B\x2B\x5C\xBF\x01\x9C\x2F\x0F\xE2\x2F\x0F\x1A\x22\x2E\x31\xBD\xB6\x6E\xBB\x21\x68\xBC\x21\x4E\x2B\x28\x31\xBE\x24\xF6\x1C\xB6\x23\x2D\xB2\x99\x2C\x6A\x6E\xBE\xB3\x7B\xB0\x10\x26\x0F\xB6\x45\xBE\x28\x1F\x26\x2E\x23\x7A\x35\x23\xB7\xA9\x00\x1E\x7F\x98\x3C\x6C\x71\x85\x6B\xC6\x51\xB7\x24\x26\x1F\x74\xB3\x22\x76\xB1\x10\x78\xBF\x21\x7A\xB6\x1F\x16\x3D\xB7\x63\xAF\xB3\x01\x11\xB8\x9E\xB2\xA5\x4C\xA4\xB8\x1B\x26\xB8\x45\x78\xB8\xE5\x67\x16\x40\x2B\x6C\x3A\x4F\xB8\x84\xA4\x22\x69\xBF\x1E\xE8\x21\xB3\xE8\x27\xB7\x82\xB3\xA6\x2E\xBC\xB7\x6D\xBE\xB7\xF6\x12\xBA\xBD\xB3\xA6\x6C\x2F\xB6\x1C\x29\xB6\x40\x2E\x24\xB6\xB1\x10\x94\xBF\xB6\x90\xBA\xA9\xF6\x12\x27\x6E\xB3\xB5\x9C\x61\xB0\xE8\x59\xB9\x8A\xBF\x67\xDC\x42\x11\x1A\x23\xB3\xB2\xA2\xA0\x61\x52\xB9\x1C\x1B\xB2\x7F\xBD\xB6\x8B\x2B\xBC\x6E\xBD\xBC\xF5\x9F\xBC\x6F\xB2\xBD\xA2\x6D\xB0\xE8\x5F\x21\xE0\xBF\x0F\xF7\x80\x24\x31\xB1\x2F\x01\x15\xB9\x1F\x28\xBE\x8A\xA0\xBF\x69\xB3\xB7\xB9\xB0\x10\xF6\x15\xBB\x23\x2A\xBF\xB8\xA6\x1F\x8D\x2E\xB6\x5F\xA3\xA5\xEB\x98\xBB\xA3\xB6\x85\x9C\xBF\xBF\xF8\x8F\xBB\x10\xC9\x71\xC8\xB1\x10\xA8\xB6\x81\xAA\xB4\xB0\x67\x1F\x1E\x8C\xBB\x85\x01\x84\xC0\xE4\x41\xBF\xE6\xB1\xBC\x00\xC1\x10\x02\xC9\xBF\x84\xA6\xC0\x6F\xB9\xC0\x55\x9B\xC0\x98\xB3\xC1\xBA\x9F\xC0\x0D\xC6\x87\x12\xC3\xC3\xE2\x85\xC1\x00\x17\xC1\x8E\x34\x6E\x1A\xCD\x31\xAE\xBD\x47\x3C\x10\xC2\xCF\x12\xBB\x1C\x24\xBB\x6F\xB6\x1F\x01\xCC\xBC\x29\xC1\x10\x07\xCD\xB6\x2C\xCB\xA6\x2E\xC0\x10\xD6\xBA\x21\x9B\xBC\xBB\x31\xBE\xBB\xA1\xB0\xC3\xF1\x7D\xB6\xF1\xB2\x2E\xEF\x11\xB3\xF8\xBB\x21\x60\xBA\xA8\x62\xB7\xA3\x5E\xB4\x4E\x35\xBF\x18\x38\xC0\x00\xF7\x84\xAD\x0F\x6B\xBA\x00\x0C\x2C\x13\x67\x5D\x7F\x46\x15\xDC\xBA\xA8\x69\xC9\x16\x8B\x2F\x0F\x8B\x2C\x2C\xCC\x20\xBE\xE2\x2B\x01\xC5\xB1\x10\xCC\x27\x8F\xE0\xBB\x16\x1E\x03\xC8\x00\x1B\x2F\x89\xC4\xC4\x00\x12\xBE\x1D\x0A\xC8\x48\xA0\x00\x91",
"\xCE\xC8\xA6\xBB\xC7\xF6\xB0\x10\x98\xC1\x10\x46\xC2\xC5\x01\x10\xBD\xE3\xB1\xB3\x63\xC8\xAB\x65\xC7\xC7\xB8\xA9\xC7\xA6\xBA\x21\x6D\xC4\xAC\xD9\xB6\xAC\x98\x82\xC7\x4B\x67\xB2\x76\xCE\xAA\xDE\xBB\x3E\x40\x20\xCA\x31\xB6\xCA\x68\xC5\xCB\x8F\x17\xC2\x6D\xBC\xBE\xD3\x69\xAF\xE8\x5B\xC6\x51\xA9\x5F\xD4\xB3\x69\x89\xB8\x2E\x86\x63\xA8\x67\xCD\xBE\xCF\x58\x5E\x7C\xC4\xC8\xD2\xC6\xC9\x9D\xCC\x11\xE2\x22\x2E\xE4\x96\xCD\xD3\xCC\xC6\x92\xC8\xC8\x92\xCC\xC8\x92\xC0\xC9\x92\xC7\x33\x95\xCA\xCD\x02\x17\xBF\x92\xC3\xC2\xE2\x27\x33\xF6\x12\xCA\xDC\x18\xB5\x41\xB0\x10\xBA\xCF\x1C\xA8\xCB\xC6\xAB\xC7\x66\xAD\xC9\xB8\xB0\xCA\xAC\x15\x60\x48\xF3\xC2\x65\x0C\xA1\x56\x40\x27\x33\xB9\xC4\xCB\x53\x60\x81\xBE\xC1\xB3\xC0\xC0\x6F\xC2\xCA\x4B\xC4\xCE\x18\x0D\xD2\xB2\x70\xCB\xCF\x26\xBD\xCF\x56\x1B\xD0\xCA\x41\xD1\x56\x14\xBC\xE6\xCC\x11\x4A\x42\xBE\x69\xB2\x2E\x40\x2B\x16\x6B\xB1\x10\xF6\xC3\x1E\xAC\xC6\x64\x3D\xC4\xD1\x2E\x56\xD1\x10\x1F\xCF\x5E\x6A\xAB\x10\x8D\xD1\xE0\xBF\xC5\x23\x21\xC6\x1A\x23\xCA\xE4\x45\xCA\x06\xD1\xD0\xEB\x37\xD2\xD4\x19\xD2\xD5\xA0\xC7\xCA\xC7\xB0\x30\xD0\x9F\x32\xDF\xBD\x7B\xCD\xC7\xDB\xC0\xBE\x23\xC5\xD3\x26\xCF\xCD\x01\x1D\xC8\x1D\xD1\xC8\xDD\xC3\xD5\xE1\xC1\x10\xE5\xC0\xBE\xE4\xC2\xC9\x85\xC2\xC9\xFE\xBE\xC9\x00\x10\xCA\xED\xC3\x22\x3A\xDF\x1C\x3C\xDD\xCC\x00\xD7\xA1\x3F\xD3\x22\xF7\xC7\x4F\x2A\xD0\x67\xED\x15\xD4\xA7\x57\xD4\x0B\xAC\xD6\x8F\x17\xCB\x6F\xB6\xD7\x66\x5C\xCB\x3C\x19\xD0\x23\x28\xD1\x94\xAA\xD1\x10\x1F\xD0\x00\x1B\x5B\xEE\xB8\xCC\x44\xD1\x10\xCB\xC2\xD8\x0C\xBF\xCC\xBA\x41\xCD\x00\x1E\xC7\x60\xD8\xCE\x96\xCF\xD4\x5E\xC1\xD5\x96\xC6\xD5\x96\xCF\xD5\x96\xCE\xCD\x96\xC0\xCE\x96\xC2\xCE\x96\xCD\xD5\x62\xD3\xC9\x65\xDF\x21\x67\xD5\x3A\x69\xDC\xAF\x7E\xD9\xCA\x01\x1F\xD6\x25\x5F\xC6\x3D\xC4\xD7\x5B\x5A\xD6\x31\xDD\xB1\x3C\x13\xD0\x7B\xDD\xD3\x78\xDF\xD7\x1C\xD0\x10\x8E\xDB\xA8\x15\xBA\xAF\x86\xD6\xCC\xC5\xD4\x19\x71\xD7\xAC\x71\xC9\x13\xB1\xCE\xD2\xCC\xC5\xA1\x55\xBA\xAF\x1C\xD1\xBF\x1F\xDF\xC2\x96\xC3\xD2\x23\x22\x2E\x40\xD8\xBD\xCB\xD8\x89\xB6\xDB\x11\x7C\xDC\xB1\x13\x5C\xBF\x1C\x20\x24\xE6\x25\xBF\xD8\xDB\x21\xFB\x28\xD8\x90\xD5\xAC\x1A\x23\xDC\xD3\xDF\xBE\x27\x29\xB6\x62\xA0\x10\x04\xD1\xDC\x3E\x26\xBC\x44\x1E\xB6\xD7\xC3\x22\xFB\x20\x69\xA5\x4D\x43\x93\x6B\xBD\xBE\xD9\xD4\xEB\x3A\xDF\xD5\xD1\xD2\x01\x1B\x2F\xC4\xB1\xBF\x8B\x27\x8F\x25\xDA\xC9\x96\xDD\x31\x38\xD1\x10\xF2\xD1\xB2\x56\x10\xD8\x28\xC8\xDB\x2E\x1A\xE0\xFB\xD7\xDE\x26\xDF\xB6\xE5\xB1\x10\xF9\xDF\x21\x19\xE4\xD8\xD7\x2D\xE1\xDE\xD6\x52\x06\xEE\xE1\x77\xD8\xE0\x8F\x11\xBF\xE2\xB9\xDA\x1B\x29\xC9\x93\xCA\xD0\x84\xA3\xDF\xBA\x40\xE2\xF5\xDC\x21\xF7\xD9\xE3\x0B\xE2\xC9\x36\xDF\x21\x53\xCD\xDF\xF1\xA5\x71\x2F\xEE\xDA\x07\xDA\xD4\x1C\x2C\xD4\x46\xEF\xC9\x23\xEE\xB6\xAB\xD7\x44\x48\xB1\x10\xE3\xD8\xCA\x7A\xDE\xB6\x59\xEF\xDA\x1C\xEB\x21\x29\xE7\xCC\x80\x47\xDC\xEE\xD7\x5E\x8A\xD5\xDB\x8C\xD7\xB0\x61\xE9\xDC\x91\xD0\xE5\x37\xE6\xE2\x53\xED\xB6\x55\xEF\x1D\x57\xE2\xCF\x07\xEA\xDB\x1D\x37\xE2\x1B\x2D\xE5\x4D\xEB\x3E\x5F\xE1\xDF\x3B\xEA\xE1\x85\xD3\x22\xC5\xC5\xE6\x2B\x67\xE6\x72\xD7\x16\x2C\xD4\x61\x75\xC0\x11\x6B\xE9\xD8\x80\x4E\xE3\xC1\xDD\xC5\x18\x2A\xDF\x92\xDC\x11\x8B\x21\xE4\x13\xE0\x00\xC0\xBB\x28\x40\x20\xBC\x31\xB2\xC4\xA5\x3F\xE7\x01\x13\xB8\x97\xEA\x44\x9B\xE3\x5E\x9E\xE1\x10\xE3\x51\xEA\x84\xA6\xBD\xF6\x17\xB8\x1B\xD5\xEA\xC2\xBA\xE0\x94\xE0\x10\x53\x95\xDD\x4B\xD8\xE1\xB4\xEB\xD9\x01\x19\x01\x5E\xD1\xDB\x57\xD0\x10\x54\xD0\xBE\xA2\xDD\xD1\xA4\xDD\xD1\xA6\xDB\xE2\x15\x35\xE1\x40\x2D\xB9\x24\xC6\x8C\x82\x2A\xDF\x7E\xB7\xE9\xC5\xC0\x24\x87\xC8\xD5\xA1\xDA\xED\x55\xD1\x10\x82\xCD\xD9\xC2\xE3\xDA\x5A\xD3\xCE\xE3\xE7\xDA\xE5\xCB\xEA\x00\x15\xCE\x57\xC5\xEB\xD6\xB0\x24\x6B\x9E\x56\x54\xCF\xB9\x34\xD8\x2E\xE3\x58\x2E\xE0\xB1\xD6\x1D\xD8\xD9\x9C\xCA\xD9\x1B\x2B\x28\xE2\xB0\xEA\x79\xBC\xEE\x01\xF0\x10\x3E\x7A\x43\x09\xED\xEB\xD2\xE3\xE9\x0C\xE8\xEB\x6F\xB7\xE4\x00\x1B\x16\x1A\x8B\x15\x49\x1D\x74\xF1\xC8\xA2\xF1\x77\xE9\x97\xE2\x4B\xD8\xEF\xDF\x00\x1F\xED\x1D\xD0\xDA\x1D\xD7\xEC\xE0\xBE\xD9\xC8\xE5\xEE\xCA\xE6\xF2\xE2\x20\xED\x5F\xE0\xF1\x56\x5C\x81\x14\xF5\xE7\x16\xF3\x82\xCF\xEA\xC5\x23\x84\xEA\x2C\xB2\xEF\xD6\xE8\xF0\x80\xC1\x10\xD9\xC3\xF2\xE1\xEF",
"\xF1\xDC\xE6\xEC\x41\xF2\x2E\xC9\xEC\xD5\x28\xF6\xF2\x2B\xF9\x15\x1B\x8C\x74\x2C\x70\xF3\x83\xB0\x24\xEA\xE3\xF0\xD2\xED\xEE\x01\x1F\xEE\xB3\xE7\xF3\xA4\xB3\xA3\xF1\xB4\xEF\xFC\xE7\xEF\x15\xEE\xD4\x5F\xF9\xD9\x00\x1E\xCB\x49\xFD\x2D\x2D\xFC\xF4\x4A\xE8\xF0\x19\x7F\xEF\x34\xFC\x82\xCC\xE1\xEF\x04\xFF\x80\x61\x50\xF7\x09\xF2\xE9\x6F\xB7\xEB\x00\x00\xEC\x93\xEB\xEB\x00\x1C\xA7\xA6\xBB\xF3\x1D\xF1\xEC\x00\x16\xC8\xE2\x20\xF2\x42\xF4\xEC\xEB\xD4\xD5\xE8\xE0\x00\x54\xDB\xEE\x59\xFB\xA1\x6F\xF8\xF0\x56\xF0\x11\x74\xFE\x32\x97\xE0\xA9\x7F\xFC\xF1\x00\x0E\xF1\x3E\xF3\xF8\xC3\xEC\xF8\x52\xD8\xF8\xA7\xD2\x2E\x8B\xFE\xF0\x31\xF3\x7C\x36\xF7\xFA\x39\x8B\xF5\x01\x18\xA8\xA1\x20\xBE\x45\xFB\xCE\x26\xFA\x21\xFE\xE6\xC5\x52\xF6\x87\xB0\xE1\x10\xDD\x86\x4C\x6A\xFB\x76\x0A\xF2\xC9\x7A\xFA\xEB\x4F\xE1\x10\x7E\xFE\x24\x80\xF0\x00\x3D\xF2\x2E\x24\xF9\xED\xA2\xF1\xF2\xDC\xE2\x2E\x8A\xF8\xF0\x8D\xF7\xFB\x6B\x74\xF5\x0E\x28\x9A\x94\xFD\xFB\x58\x88\xE9\x01\x18\xF9\xC6\xFA\xF9\x9C\xFA\xFC\x3F\xFC\xFC\xA0\xFB\xED\xCD\xFA\xF9\xA5\xFD\xF6\xC0\x89\xFA\x7A\xBC\xFA\x00\x1E\xFA\x9B\xCF\xC8\x26\xF6\xF4\xE9\xE7\xD3\x01\x12\xBE\xD0\xEE\xF8\xF8\x89\xFB\x00\x1B\xFB\x1B\x2E\xB7\x20\x71\x7E\x78\x76\x30\x6A\xBC\x2C\x76\xFA\x66\x40\xB0\x69\x87\x41\x08\x59\x7C\xC3\x09\x77\xF5\x5D\x60\xEA\x30\x76\x70\x71\x8D\x02\xC2\x15\x70\x01\x85\x61\x00\x0D\xD5\x54\x7F\xF8\x3B\xC6\x3A\x63\xB8\x2E\x65\x78\x25\x75\x5E\x61\x75\x32\xEA\x74\x0A\x25\x7D\x5A\xD3\x76\xBF\x45\x81\x0C\x87\x00\xC0\x52\xDD\x7F\x71\x96\x66\xE3\x4F\x71\xB4\x5B\x28\x73\x50\x85\x7E\x75\x00\x09\xF9\x5B\x67\x7B\x42\x2E\x4D\x63\xE2\x6D\x62\xFA\x7E\x65\x29\x7D\x27\x6E\x94\x26\x43\xBC\x61\x08\xF3\x4F\xF5\x45\x7D\xA1\x7D\xE0\x5C\x74\xED\x77\x7F\xEB\x69\x08\xBA\x4C\xFE\x7D\x76\x5C\x41\xE5\x7A\x4D\xBF\x79\x06\x96\x74\x1A\x81\x10\x36\x82\x12\x8B\x6F\x3A\x83\xB2\x7F\x79\x1E\x8E\xEC\x4C\x61\x0B\x9B\x08\x01\x1B\x08\x8C\x5B\xF5\x4E\xFE\x1F\x35\xD8\x68\x72\xC5\x72\x5C\x07\x77\x27\x82\xFF\x27\x6E\x14\x9B\x7E\x54\x86\xFF\x57\x83\xED\x76\xF7\x34\x73\xEC\x76\x7F\xE7\x5E\xB9\x6B\x4D\xA7\x5A\xFD\x67\x3F\x1A\x6B\x14\xAB\x3C\x59\x12\x47\x9F\x07\x97\x2A\x7F\x8C\x47\x81\xCB\x77\x02\xAD\x5A\x04\x13\x08\x8B\x13\x1E\x86\x84\x80\x83\xFF\x26\x16\xC7\x4F\x8E\x5F\x3E\x64\x57\x3D\x8E\x80\xF2\x6F\x81\x2C\x8C\x11\x20\x7A\x24\x8E\x75\xC0\x11\x26\x56\x85\x42\x8D\x89\x07\x84\x81\x05\x0F\xF6\x0B\x39\x52\x11\xF6\x79\xB6\x73\x81\x26\x88\x85\xC5\x4D\x8C\x7A\x5A\x57\x80\x10\x09\x86\x73\x77\x49\xB3\x4B\xDD\x3A\x5B\x17\x88\xF7\x59\x67\x0C\x83\x7E\x00\x0C\x62\x11\x73\xB1\x75\x06\xCC\x84\x02\x6B\x83\x46\x81\xF5\x65\x81\x0F\x71\x00\xFD\x5E\x05\x83\x11\xB7\x5F\x0F\x9A\x5C\x79\x75\xC3\x51\x74\x05\x63\x11\x1E\x87\x02\x49\x5C\x0E\x68\x82\x11\x83\x63\x13\x86\x40\x0D\x02\xB7\x81\xB6\x59\x0D\xF5\x7E\x0D\x73\x3C\xDD\x87\x0E\xA3\x41\x0E\x8B\x00\xA9\x5F\xB1\x3D\x61\x22\x86\x1C\x81\x63\xD8\x54\xD3\x55\x66\x24\x96\x0F\x51\x7B\x1B\x8F\x7D\xB1\x41\x0F\x9B\x83\x08\x47\x86\x24\x13\x00\x96\x5D\x15\x85\xFE\x5E\x85\x0C\x76\x7D\x02\x89\x82\x59\x63\x77\x83\x0F\xE0\x85\x3D\x98\x60\xF7\x86\x01\xA4\x87\x74\x3E\xB8\x67\x84\xA1\x4A\x87\xA1\x15\x6E\x4C\x89\xE9\x71\x11\xAE\x1A\x0C\x6E\x88\xF0\x83\x22\xA8\x89\x8A\x85\xB8\x17\x8B\x0E\x60\x81\x3F\x29\x1F\x9D\x89\x7D\x83\x01\x92\x64\x0A\x9F\x72\xED\x85\x21\xB2\x87\x4E\x47\x12\xBB\x88\x30\x45\x88\x25\x8A\x1C\x63\x84\x84\x8C\x11\x24\x7A\xA4\x71\x5F\x1A\x13\x69\x03\x8B\x21\x74\x22\x47\x5D\xC3\x71\x82\xFB\x71\xA8\x78\x67\xDF\x2B\xE4\x1B\x58\x2A\x7E\x83\x18\x83\x14\x88\x8A\x88\x8B\x14\xF0\x5A\x35\x8B\x87\xC9\x59\x2B\xB9\x7E\x83\x83\x7C\x40\x8B\xFF\x75\x75\xF4\x84\x35\x18\x89\x06\x8C\xDC\x1B\x8A\x55\x1A\x87\xD7\x5B\x63\x60\x89\x0B\x7E\x0C\xE3\x5F\x58\x81\x8A\x29\x88\x70\x67\x82\x8B\x39\x16\xD7\x1B\x5A\x90\x89\xB3\x81\x20\x3F\x61\x0F\x6C\x0F\xF1\x5E\x3F\x99\x84\x3D\x8C\x2C\xBF\x88\x95\x8E\x13\x88\x81\xCC\x5B\x8A\x7A\x8D\x2B\x9C\x63\xAF\x81\x12\x88\x8C\x63\x8A\x8C\x08\x85\x2F\x8C\x80\xC0\x8D\x1E\x6E\x89\xE3\x4F\x5D\x1E\x8D\x26\xB3\x8A\x12\x7C\x10\x80\x78\x5E\x8C\x89\xA7\x5E\x25\x9F\x81\xC4\x52\x13\xA0\x8C\x4D\x95\x50\x27\x87\x30\x8B\x87\xF1\x56\x1A\xE7\x8B\x40\x96\x38\x8F\x89\x6D\x5A\x10\x20\x82\x19\xDE\x8A\xDC\x57\x86\x1F\x10\x89\x66\x83\x67\x87",
"\x1B\xCD\x58\x54\x87\x8D\x3C\x8C\x2B\x97\x85\xB2\x87\x19\xC8\x8D\xE9\x5A\x8C\xF6\x84\x2D\x98\x44\xCF\x83\x02\x92\x81\x85\x43\x8D\x6E\x5A\x38\x80\x08\xDE\x8F\x21\x44\x80\x97\x46\x82\x0C\x63\x25\x89\x8E\x80\x07\x17\xB6\x8E\x44\x91\x8C\xE2\x8F\x39\x96\x88\xB5\x8F\x12\xAC\x8E\x60\x95\x8E\xA1\x88\x36\xBD\x86\x7E\x72\x12\xD9\x88\x77\x9B\x10\xDE\x8C\x4C\x4F\x0D\xF0\x8D\x18\x8C\x49\x62\x8E\x8E\x33\x56\x2C\x8B\x8F\xD2\x59\x1B\x9C\x12\x86\x18\x65\xBD\x8E\xBC\x4D\x8B\x38\x7F\x0F\xD2\x71\xF4\x41\x74\x2A\x76\x7A\x6F\x0E\x37\x63\x3D\x55\x89\x92\x77\x8A\x69\x5D\xC6\x4F\x8B\xAC\x88\x20\xA8\x70\x84\x82\x73\x57\x7E\x26\xB3\x5F\x6A\x86\x20\x81\x08\x0B\x09\x90\x30\x84\x23\x0A\x89\xD9\x80\x1D\xFF\x8B\x38\x87\x15\x1C\x8E\x35\xB1\x8B\x24\x78\x1D\xED\x58\x77\x6B\x8F\x7E\x8D\x3D\xB0\x63\xD6\x80\xC4\x33\x91\x65\x31\x8D\xF4\x88\x45\x8B\x8A",
};
void GuiIqGetParserBuffer(vl::stream::MemoryStream& stream)
{
vl::stream::MemoryStream compressedStream;
for (vint i = 0; i < parserBufferRows; i++)
{
vint size = i == parserBufferRows - 1 ? parserBufferRemain : parserBufferBlock;
compressedStream.Write((void*)parserBuffer[i], size);
}
compressedStream.SeekFromBegin(0);
vl::stream::LzwDecoder decoder;
vl::stream::DecoderStream decoderStream(compressedStream, decoder);
vl::collections::Array<vl::vuint8_t> buffer(65536);
while (true)
{
vl::vint size = decoderStream.Read(&buffer[0], 65536);
if (size == 0) break;
stream.Write(&buffer[0], size);
}
stream.SeekFromBegin(0);
}
/***********************************************************************
Unescaping Function Foward Declarations
***********************************************************************/
/***********************************************************************
Parsing Tree Conversion Driver Implementation
***********************************************************************/
class GuiIqTreeConverter : public vl::parsing::ParsingTreeConverter
{
public:
using vl::parsing::ParsingTreeConverter::SetMember;
bool SetMember(GuiIqNameOption& member, vl::Ptr<vl::parsing::ParsingTreeNode> node, const TokenList& tokens)
{
vl::Ptr<vl::parsing::ParsingTreeToken> token=node.Cast<vl::parsing::ParsingTreeToken>();
if(token)
{
if(token->GetValue()==L"Specified") { member=GuiIqNameOption::Specified; return true; }
else if(token->GetValue()==L"Any") { member=GuiIqNameOption::Any; return true; }
else { member=GuiIqNameOption::Specified; return false; }
}
member=GuiIqNameOption::Specified;
return false;
}
bool SetMember(GuiIqChildOption& member, vl::Ptr<vl::parsing::ParsingTreeNode> node, const TokenList& tokens)
{
vl::Ptr<vl::parsing::ParsingTreeToken> token=node.Cast<vl::parsing::ParsingTreeToken>();
if(token)
{
if(token->GetValue()==L"Direct") { member=GuiIqChildOption::Direct; return true; }
else if(token->GetValue()==L"Indirect") { member=GuiIqChildOption::Indirect; return true; }
else { member=GuiIqChildOption::Direct; return false; }
}
member=GuiIqChildOption::Direct;
return false;
}
bool SetMember(GuiIqBinaryOperator& member, vl::Ptr<vl::parsing::ParsingTreeNode> node, const TokenList& tokens)
{
vl::Ptr<vl::parsing::ParsingTreeToken> token=node.Cast<vl::parsing::ParsingTreeToken>();
if(token)
{
if(token->GetValue()==L"ExclusiveOr") { member=GuiIqBinaryOperator::ExclusiveOr; return true; }
else if(token->GetValue()==L"Intersect") { member=GuiIqBinaryOperator::Intersect; return true; }
else if(token->GetValue()==L"Union") { member=GuiIqBinaryOperator::Union; return true; }
else if(token->GetValue()==L"Substract") { member=GuiIqBinaryOperator::Substract; return true; }
else { member=GuiIqBinaryOperator::ExclusiveOr; return false; }
}
member=GuiIqBinaryOperator::ExclusiveOr;
return false;
}
void Fill(vl::Ptr<GuiIqQuery> tree, vl::Ptr<vl::parsing::ParsingTreeObject> obj, const TokenList& tokens)
{
}
void Fill(vl::Ptr<GuiIqPrimaryQuery> tree, vl::Ptr<vl::parsing::ParsingTreeObject> obj, const TokenList& tokens)
{
SetMember(tree->childOption, obj->GetMember(L"childOption"), tokens);
SetMember(tree->attributeNameOption, obj->GetMember(L"attributeNameOption"), tokens);
SetMember(tree->attributeName, obj->GetMember(L"attributeName"), tokens);
SetMember(tree->typeNameOption, obj->GetMember(L"typeNameOption"), tokens);
SetMember(tree->typeName, obj->GetMember(L"typeName"), tokens);
SetMember(tree->referenceName, obj->GetMember(L"referenceName"), tokens);
}
void Fill(vl::Ptr<GuiIqCascadeQuery> tree, vl::Ptr<vl::parsing::ParsingTreeObject> obj, const TokenList& tokens)
{
SetMember(tree->parent, obj->GetMember(L"parent"), tokens);
SetMember(tree->child, obj->GetMember(L"child"), tokens);
}
void Fill(vl::Ptr<GuiIqSetQuery> tree, vl::Ptr<vl::parsing::ParsingTreeObject> obj, const TokenList& tokens)
{
SetMember(tree->first, obj->GetMember(L"first"), tokens);
SetMember(tree->second, obj->GetMember(L"second"), tokens);
SetMember(tree->op, obj->GetMember(L"op"), tokens);
}
vl::Ptr<vl::parsing::ParsingTreeCustomBase> ConvertClass(vl::Ptr<vl::parsing::ParsingTreeObject> obj, const TokenList& tokens)override
{
if(obj->GetType()==L"PrimaryQuery")
{
vl::Ptr<GuiIqPrimaryQuery> tree = new GuiIqPrimaryQuery;
vl::collections::CopyFrom(tree->creatorRules, obj->GetCreatorRules());
Fill(tree, obj, tokens);
Fill(tree.Cast<GuiIqQuery>(), obj, tokens);
return tree;
}
else if(obj->GetType()==L"CascadeQuery")
{
vl::Ptr<GuiIqCascadeQuery> tree = new GuiIqCascadeQuery;
vl::collections::CopyFrom(tree->creatorRules, obj->GetCreatorRules());
Fill(tree, obj, tokens);
Fill(tree.Cast<GuiIqQuery>(), obj, tokens);
return tree;
}
else if(obj->GetType()==L"SetQuery")
{
vl::Ptr<GuiIqSetQuery> tree = new GuiIqSetQuery;
vl::collections::CopyFrom(tree->creatorRules, obj->GetCreatorRules());
Fill(tree, obj, tokens);
Fill(tree.Cast<GuiIqQuery>(), obj, tokens);
return tree;
}
else
return 0;
}
};
vl::Ptr<vl::parsing::ParsingTreeCustomBase> GuiIqConvertParsingTreeNode(vl::Ptr<vl::parsing::ParsingTreeNode> node, const vl::collections::List<vl::regex::RegexToken>& tokens)
{
GuiIqTreeConverter converter;
vl::Ptr<vl::parsing::ParsingTreeCustomBase> tree;
converter.SetMember(tree, node, tokens);
return tree;
}
/***********************************************************************
Parsing Tree Conversion Implementation
***********************************************************************/
vl::Ptr<GuiIqPrimaryQuery> GuiIqPrimaryQuery::Convert(vl::Ptr<vl::parsing::ParsingTreeNode> node, const vl::collections::List<vl::regex::RegexToken>& tokens)
{
return GuiIqConvertParsingTreeNode(node, tokens).Cast<GuiIqPrimaryQuery>();
}
vl::Ptr<GuiIqCascadeQuery> GuiIqCascadeQuery::Convert(vl::Ptr<vl::parsing::ParsingTreeNode> node, const vl::collections::List<vl::regex::RegexToken>& tokens)
{
return GuiIqConvertParsingTreeNode(node, tokens).Cast<GuiIqCascadeQuery>();
}
vl::Ptr<GuiIqSetQuery> GuiIqSetQuery::Convert(vl::Ptr<vl::parsing::ParsingTreeNode> node, const vl::collections::List<vl::regex::RegexToken>& tokens)
{
return GuiIqConvertParsingTreeNode(node, tokens).Cast<GuiIqSetQuery>();
}
/***********************************************************************
Visitor Pattern Implementation
***********************************************************************/
void GuiIqPrimaryQuery::Accept(GuiIqQuery::IVisitor* visitor)
{
visitor->Visit(this);
}
void GuiIqCascadeQuery::Accept(GuiIqQuery::IVisitor* visitor)
{
visitor->Visit(this);
}
void GuiIqSetQuery::Accept(GuiIqQuery::IVisitor* visitor)
{
visitor->Visit(this);
}
/***********************************************************************
Parser Function
***********************************************************************/
vl::Ptr<vl::parsing::ParsingTreeNode> GuiIqParseAsParsingTreeNode(const vl::WString& input, vl::Ptr<vl::parsing::tabling::ParsingTable> table, vl::collections::List<vl::Ptr<vl::parsing::ParsingError>>& errors, vl::vint codeIndex)
{
vl::parsing::tabling::ParsingState state(input, table, codeIndex);
state.Reset(L"QueryRoot");
vl::Ptr<vl::parsing::tabling::ParsingGeneralParser> parser=vl::parsing::tabling::CreateStrictParser(table);
vl::Ptr<vl::parsing::ParsingTreeNode> node=parser->Parse(state, errors);
return node;
}
vl::Ptr<vl::parsing::ParsingTreeNode> GuiIqParseAsParsingTreeNode(const vl::WString& input, vl::Ptr<vl::parsing::tabling::ParsingTable> table, vl::vint codeIndex)
{
vl::collections::List<vl::Ptr<vl::parsing::ParsingError>> errors;
return GuiIqParseAsParsingTreeNode(input, table, errors, codeIndex);
}
vl::Ptr<GuiIqQuery> GuiIqParse(const vl::WString& input, vl::Ptr<vl::parsing::tabling::ParsingTable> table, vl::collections::List<vl::Ptr<vl::parsing::ParsingError>>& errors, vl::vint codeIndex)
{
vl::parsing::tabling::ParsingState state(input, table, codeIndex);
state.Reset(L"QueryRoot");
vl::Ptr<vl::parsing::tabling::ParsingGeneralParser> parser=vl::parsing::tabling::CreateStrictParser(table);
vl::Ptr<vl::parsing::ParsingTreeNode> node=parser->Parse(state, errors);
if(node && errors.Count()==0)
{
return GuiIqConvertParsingTreeNode(node, state.GetTokens()).Cast<GuiIqQuery>();
}
return 0;
}
vl::Ptr<GuiIqQuery> GuiIqParse(const vl::WString& input, vl::Ptr<vl::parsing::tabling::ParsingTable> table, vl::vint codeIndex)
{
vl::collections::List<vl::Ptr<vl::parsing::ParsingError>> errors;
return GuiIqParse(input, table, errors, codeIndex);
}
/***********************************************************************
Table Generation
***********************************************************************/
vl::Ptr<vl::parsing::tabling::ParsingTable> GuiIqLoadTable()
{
vl::stream::MemoryStream stream;
GuiIqGetParserBuffer(stream);
vl::Ptr<vl::parsing::tabling::ParsingTable> table=new vl::parsing::tabling::ParsingTable(stream);
table->Initialize();
return table;
}
}
}
namespace vl
{
namespace reflection
{
namespace description
{
#ifndef VCZH_DEBUG_NO_REFLECTION
using namespace vl::presentation;
IMPL_TYPE_INFO_RENAME(GuiIqQuery, presentation::GuiIqQuery)
IMPL_TYPE_INFO_RENAME(GuiIqNameOption, presentation::GuiIqNameOption)
IMPL_TYPE_INFO_RENAME(GuiIqChildOption, presentation::GuiIqChildOption)
IMPL_TYPE_INFO_RENAME(GuiIqPrimaryQuery, presentation::GuiIqPrimaryQuery)
IMPL_TYPE_INFO_RENAME(GuiIqCascadeQuery, presentation::GuiIqCascadeQuery)
IMPL_TYPE_INFO_RENAME(GuiIqBinaryOperator, presentation::GuiIqBinaryOperator)
IMPL_TYPE_INFO_RENAME(GuiIqSetQuery, presentation::GuiIqSetQuery)
IMPL_TYPE_INFO_RENAME(GuiIqQuery::IVisitor, presentation::GuiIqQuery::IVisitor)
BEGIN_CLASS_MEMBER(GuiIqQuery)
CLASS_MEMBER_METHOD(Accept, {L"visitor"})
END_CLASS_MEMBER(GuiIqQuery)
BEGIN_ENUM_ITEM(GuiIqNameOption)
ENUM_ITEM_NAMESPACE(GuiIqNameOption)
ENUM_NAMESPACE_ITEM(Specified)
ENUM_NAMESPACE_ITEM(Any)
END_ENUM_ITEM(GuiIqNameOption)
BEGIN_ENUM_ITEM(GuiIqChildOption)
ENUM_ITEM_NAMESPACE(GuiIqChildOption)
ENUM_NAMESPACE_ITEM(Direct)
ENUM_NAMESPACE_ITEM(Indirect)
END_ENUM_ITEM(GuiIqChildOption)
BEGIN_CLASS_MEMBER(GuiIqPrimaryQuery)
CLASS_MEMBER_BASE(GuiIqQuery)
CLASS_MEMBER_CONSTRUCTOR(vl::Ptr<GuiIqPrimaryQuery>(), NO_PARAMETER)
CLASS_MEMBER_EXTERNALMETHOD(get_attributeName, NO_PARAMETER, vl::WString(GuiIqPrimaryQuery::*)(), [](GuiIqPrimaryQuery* node){ return node->attributeName.value; })
CLASS_MEMBER_EXTERNALMETHOD(set_attributeName, {L"value"}, void(GuiIqPrimaryQuery::*)(const vl::WString&), [](GuiIqPrimaryQuery* node, const vl::WString& value){ node->attributeName.value = value; })
CLASS_MEMBER_EXTERNALMETHOD(get_typeName, NO_PARAMETER, vl::WString(GuiIqPrimaryQuery::*)(), [](GuiIqPrimaryQuery* node){ return node->typeName.value; })
CLASS_MEMBER_EXTERNALMETHOD(set_typeName, {L"value"}, void(GuiIqPrimaryQuery::*)(const vl::WString&), [](GuiIqPrimaryQuery* node, const vl::WString& value){ node->typeName.value = value; })
CLASS_MEMBER_EXTERNALMETHOD(get_referenceName, NO_PARAMETER, vl::WString(GuiIqPrimaryQuery::*)(), [](GuiIqPrimaryQuery* node){ return node->referenceName.value; })
CLASS_MEMBER_EXTERNALMETHOD(set_referenceName, {L"value"}, void(GuiIqPrimaryQuery::*)(const vl::WString&), [](GuiIqPrimaryQuery* node, const vl::WString& value){ node->referenceName.value = value; })
CLASS_MEMBER_FIELD(childOption)
CLASS_MEMBER_FIELD(attributeNameOption)
CLASS_MEMBER_PROPERTY(attributeName, get_attributeName, set_attributeName)
CLASS_MEMBER_FIELD(typeNameOption)
CLASS_MEMBER_PROPERTY(typeName, get_typeName, set_typeName)
CLASS_MEMBER_PROPERTY(referenceName, get_referenceName, set_referenceName)
END_CLASS_MEMBER(GuiIqPrimaryQuery)
BEGIN_CLASS_MEMBER(GuiIqCascadeQuery)
CLASS_MEMBER_BASE(GuiIqQuery)
CLASS_MEMBER_CONSTRUCTOR(vl::Ptr<GuiIqCascadeQuery>(), NO_PARAMETER)
CLASS_MEMBER_FIELD(parent)
CLASS_MEMBER_FIELD(child)
END_CLASS_MEMBER(GuiIqCascadeQuery)
BEGIN_ENUM_ITEM(GuiIqBinaryOperator)
ENUM_ITEM_NAMESPACE(GuiIqBinaryOperator)
ENUM_NAMESPACE_ITEM(ExclusiveOr)
ENUM_NAMESPACE_ITEM(Intersect)
ENUM_NAMESPACE_ITEM(Union)
ENUM_NAMESPACE_ITEM(Substract)
END_ENUM_ITEM(GuiIqBinaryOperator)
BEGIN_CLASS_MEMBER(GuiIqSetQuery)
CLASS_MEMBER_BASE(GuiIqQuery)
CLASS_MEMBER_CONSTRUCTOR(vl::Ptr<GuiIqSetQuery>(), NO_PARAMETER)
CLASS_MEMBER_FIELD(first)
CLASS_MEMBER_FIELD(second)
CLASS_MEMBER_FIELD(op)
END_CLASS_MEMBER(GuiIqSetQuery)
BEGIN_CLASS_MEMBER(GuiIqQuery::IVisitor)
CLASS_MEMBER_BASE(vl::reflection::IDescriptable)
CLASS_MEMBER_EXTERNALCTOR(Ptr<GuiIqQuery::IVisitor>(Ptr<IValueInterfaceProxy>), {L"proxy"}, &interface_proxy::GuiIqQuery_IVisitor::Create)
CLASS_MEMBER_METHOD_OVERLOAD(Visit, {L"node"}, void(GuiIqQuery::IVisitor::*)(GuiIqPrimaryQuery* node))
CLASS_MEMBER_METHOD_OVERLOAD(Visit, {L"node"}, void(GuiIqQuery::IVisitor::*)(GuiIqCascadeQuery* node))
CLASS_MEMBER_METHOD_OVERLOAD(Visit, {L"node"}, void(GuiIqQuery::IVisitor::*)(GuiIqSetQuery* node))
END_CLASS_MEMBER(GuiIqQuery)
class GuiIqTypeLoader : public vl::Object, public ITypeLoader
{
public:
void Load(ITypeManager* manager)
{
ADD_TYPE_INFO(vl::presentation::GuiIqQuery)
ADD_TYPE_INFO(vl::presentation::GuiIqNameOption)
ADD_TYPE_INFO(vl::presentation::GuiIqChildOption)
ADD_TYPE_INFO(vl::presentation::GuiIqPrimaryQuery)
ADD_TYPE_INFO(vl::presentation::GuiIqCascadeQuery)
ADD_TYPE_INFO(vl::presentation::GuiIqBinaryOperator)
ADD_TYPE_INFO(vl::presentation::GuiIqSetQuery)
ADD_TYPE_INFO(vl::presentation::GuiIqQuery::IVisitor)
}
void Unload(ITypeManager* manager)
{
}
};
#endif
bool GuiIqLoadTypes()
{
#ifndef VCZH_DEBUG_NO_REFLECTION
ITypeManager* manager=GetGlobalTypeManager();
if(manager)
{
Ptr<ITypeLoader> loader=new GuiIqTypeLoader;
return manager->AddTypeLoader(loader);
}
#endif
return false;
}
}
}
}
/***********************************************************************
TypeDescriptors\GuiReflectionBasic.cpp
***********************************************************************/
namespace vl
{
namespace reflection
{
namespace description
{
using namespace collections;
using namespace parsing;
using namespace parsing::tabling;
using namespace parsing::xml;
using namespace stream;
#ifndef VCZH_DEBUG_NO_REFLECTION
GUIREFLECTIONBASIC_TYPELIST(IMPL_TYPE_INFO)
Color TypedValueSerializerProvider<Color>::GetDefaultValue()
{
return Color();
}
bool TypedValueSerializerProvider<Color>::Serialize(const Color& input, WString& output)
{
output=input.ToString();
return true;
}
bool TypedValueSerializerProvider<Color>::Deserialize(const WString& input, Color& output)
{
output=Color::Parse(input);
return true;
}
GuiGraphicsAnimationManager* GuiControlHost_GetAnimationManager(GuiControlHost* thisObject)
{
return thisObject->GetGraphicsHost()->GetAnimationManager();
}
/***********************************************************************
External Functions
***********************************************************************/
Ptr<INativeImage> INativeImage_Constructor(const WString& path)
{
return GetCurrentController()->ImageService()->CreateImageFromFile(path);
}
INativeCursor* INativeCursor_Constructor1()
{
return GetCurrentController()->ResourceService()->GetDefaultSystemCursor();
}
INativeCursor* INativeCursor_Constructor2(INativeCursor::SystemCursorType type)
{
return GetCurrentController()->ResourceService()->GetSystemCursor(type);
}
Ptr<DocumentModel> DocumentModel_Constructor(const WString& path)
{
FileStream fileStream(path, FileStream::ReadOnly);
if(!fileStream.IsAvailable()) return 0;
BomDecoder decoder;
DecoderStream decoderStream(fileStream, decoder);
StreamReader reader(decoderStream);
WString xmlText=reader.ReadToEnd();
Ptr<ParsingTable> table=XmlLoadTable();
Ptr<XmlDocument> xml=XmlParseDocument(xmlText, table);
if(!xml) return 0;
List<WString> errors;
return DocumentModel::LoadFromXml(xml, GetFolderPath(path), errors);
}
/***********************************************************************
Type Declaration
***********************************************************************/
#define _ ,
BEGIN_ENUM_ITEM(Alignment)
ENUM_CLASS_ITEM(Left)
ENUM_CLASS_ITEM(Top)
ENUM_CLASS_ITEM(Center)
ENUM_CLASS_ITEM(Right)
ENUM_CLASS_ITEM(Bottom)
END_ENUM_ITEM(Alignment)
BEGIN_STRUCT_MEMBER(TextPos)
STRUCT_MEMBER(row)
STRUCT_MEMBER(column)
END_STRUCT_MEMBER(TextPos)
BEGIN_STRUCT_MEMBER(GridPos)
STRUCT_MEMBER(row)
STRUCT_MEMBER(column)
END_STRUCT_MEMBER(GridPos)
BEGIN_STRUCT_MEMBER(Point)
STRUCT_MEMBER(x)
STRUCT_MEMBER(y)
END_STRUCT_MEMBER(Point)
BEGIN_STRUCT_MEMBER(Size)
STRUCT_MEMBER(x)
STRUCT_MEMBER(y)
END_STRUCT_MEMBER(Size)
BEGIN_STRUCT_MEMBER(Rect)
STRUCT_MEMBER(x1)
STRUCT_MEMBER(y1)
STRUCT_MEMBER(x2)
STRUCT_MEMBER(y2)
END_STRUCT_MEMBER(Rect)
BEGIN_STRUCT_MEMBER(Margin)
STRUCT_MEMBER(left)
STRUCT_MEMBER(top)
STRUCT_MEMBER(right)
STRUCT_MEMBER(bottom)
END_STRUCT_MEMBER(Margin)
BEGIN_STRUCT_MEMBER(FontProperties)
STRUCT_MEMBER(fontFamily)
STRUCT_MEMBER(size)
STRUCT_MEMBER(bold)
STRUCT_MEMBER(italic)
STRUCT_MEMBER(underline)
STRUCT_MEMBER(strikeline)
STRUCT_MEMBER(antialias)
STRUCT_MEMBER(verticalAntialias)
END_STRUCT_MEMBER(FontProperties)
BEGIN_CLASS_MEMBER(INativeImageFrame)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_METHOD(GetImage, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetSize, NO_PARAMETER)
END_CLASS_MEMBER(INativeImageFrame)
BEGIN_CLASS_MEMBER(INativeImage)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_METHOD(GetFormat, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetFrameCount, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetFrame, {L"index"})
CLASS_MEMBER_EXTERNALCTOR(Ptr<INativeImage>(const WString&), {L"filePath"}, &INativeImage_Constructor)
END_CLASS_MEMBER(INativeImage)
BEGIN_ENUM_ITEM(INativeImage::FormatType)
ENUM_ITEM_NAMESPACE(INativeImage)
ENUM_NAMESPACE_ITEM(Bmp)
ENUM_NAMESPACE_ITEM(Gif)
ENUM_NAMESPACE_ITEM(Icon)
ENUM_NAMESPACE_ITEM(Jpeg)
ENUM_NAMESPACE_ITEM(Png)
ENUM_NAMESPACE_ITEM(Tiff)
ENUM_NAMESPACE_ITEM(Wmp)
ENUM_NAMESPACE_ITEM(Unknown)
END_ENUM_ITEM(INativeImage::FormatType)
BEGIN_CLASS_MEMBER(INativeCursor)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_METHOD(IsSystemCursor, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetSystemCursorType, NO_PARAMETER)
CLASS_MEMBER_EXTERNALCTOR(INativeCursor*(), NO_PARAMETER, &INativeCursor_Constructor1)
CLASS_MEMBER_EXTERNALCTOR(INativeCursor*(INativeCursor::SystemCursorType), NO_PARAMETER, &INativeCursor_Constructor2)
END_CLASS_MEMBER(INativeCursor)
BEGIN_ENUM_ITEM(INativeCursor::SystemCursorType)
ENUM_ITEM_NAMESPACE(INativeCursor)
ENUM_NAMESPACE_ITEM(SmallWaiting)
ENUM_NAMESPACE_ITEM(LargeWaiting)
ENUM_NAMESPACE_ITEM(Arrow)
ENUM_NAMESPACE_ITEM(Cross)
ENUM_NAMESPACE_ITEM(Hand)
ENUM_NAMESPACE_ITEM(Help)
ENUM_NAMESPACE_ITEM(IBeam)
ENUM_NAMESPACE_ITEM(SizeAll)
ENUM_NAMESPACE_ITEM(SizeNESW)
ENUM_NAMESPACE_ITEM(SizeNS)
ENUM_NAMESPACE_ITEM(SizeNWSE)
ENUM_NAMESPACE_ITEM(SizeWE)
END_ENUM_ITEM(INativeCursor::SystemCursorType)
BEGIN_CLASS_MEMBER(INativeWindow)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_PROPERTY_FAST(Bounds)
CLASS_MEMBER_PROPERTY_FAST(ClientSize)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ClientBoundsInScreen)
CLASS_MEMBER_PROPERTY_FAST(Title)
CLASS_MEMBER_PROPERTY_FAST(WindowCursor)
CLASS_MEMBER_PROPERTY_FAST(CaretPoint)
CLASS_MEMBER_PROPERTY_FAST(Parent)
CLASS_MEMBER_PROPERTY_FAST(AlwaysPassFocusToParent)
CLASS_MEMBER_PROPERTY_READONLY_FAST(SizeState)
CLASS_MEMBER_PROPERTY_FAST(MinimizedBox)
CLASS_MEMBER_PROPERTY_FAST(MaximizedBox)
CLASS_MEMBER_PROPERTY_FAST(Border)
CLASS_MEMBER_PROPERTY_FAST(SizeBox)
CLASS_MEMBER_PROPERTY_FAST(IconVisible)
CLASS_MEMBER_PROPERTY_FAST(TitleBar)
CLASS_MEMBER_PROPERTY_FAST(TopMost)
CLASS_MEMBER_METHOD(EnableCustomFrameMode, NO_PARAMETER)
CLASS_MEMBER_METHOD(DisableCustomFrameMode, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsCustomFrameModeEnabled, NO_PARAMETER)
CLASS_MEMBER_METHOD(Show, NO_PARAMETER)
CLASS_MEMBER_METHOD(ShowDeactivated, NO_PARAMETER)
CLASS_MEMBER_METHOD(ShowRestored, NO_PARAMETER)
CLASS_MEMBER_METHOD(ShowMaximized, NO_PARAMETER)
CLASS_MEMBER_METHOD(ShowMinimized, NO_PARAMETER)
CLASS_MEMBER_METHOD(Hide, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsVisible, NO_PARAMETER)
CLASS_MEMBER_METHOD(Enable, NO_PARAMETER)
CLASS_MEMBER_METHOD(Disable, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsEnabled, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetFocus, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsFocused, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetActivate, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsActivated, NO_PARAMETER)
CLASS_MEMBER_METHOD(ShowInTaskBar, NO_PARAMETER)
CLASS_MEMBER_METHOD(HideInTaskBar, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsAppearedInTaskBar, NO_PARAMETER)
CLASS_MEMBER_METHOD(EnableActivate, NO_PARAMETER)
CLASS_MEMBER_METHOD(DisableActivate, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsEnabledActivate, NO_PARAMETER)
CLASS_MEMBER_METHOD(RequireCapture, NO_PARAMETER)
CLASS_MEMBER_METHOD(ReleaseCapture, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsCapturing, NO_PARAMETER)
CLASS_MEMBER_METHOD(RedrawContent, NO_PARAMETER)
END_CLASS_MEMBER(INativeWindow)
BEGIN_ENUM_ITEM(INativeWindow::WindowSizeState)
ENUM_ITEM_NAMESPACE(INativeWindow)
ENUM_NAMESPACE_ITEM(Minimized)
ENUM_NAMESPACE_ITEM(Restored)
ENUM_NAMESPACE_ITEM(Maximized)
END_ENUM_ITEM(INativeWindow::WindowSizeState)
BEGIN_CLASS_MEMBER(INativeDelay)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Status)
CLASS_MEMBER_METHOD(Delay, {L"milliseconds"})
CLASS_MEMBER_METHOD(Cancel, NO_PARAMETER)
END_CLASS_MEMBER(INativeDelay)
BEGIN_ENUM_ITEM(INativeDelay::ExecuteStatus)
ENUM_ITEM_NAMESPACE(INativeDelay)
ENUM_NAMESPACE_ITEM(Pending)
ENUM_NAMESPACE_ITEM(Executing)
ENUM_NAMESPACE_ITEM(Executed)
ENUM_NAMESPACE_ITEM(Canceled)
END_ENUM_ITEM(INativeDelay::ExecuteStatus)
BEGIN_CLASS_MEMBER(INativeScreen)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Bounds);
CLASS_MEMBER_PROPERTY_READONLY_FAST(ClientBounds);
CLASS_MEMBER_PROPERTY_READONLY_FAST(Name);
CLASS_MEMBER_METHOD(IsPrimary, NO_PARAMETER)
END_CLASS_MEMBER(INativeScreen)
BEGIN_CLASS_MEMBER(INativeImageService)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_METHOD(CreateImageFromFile, {L"path"})
END_CLASS_MEMBER(INativeImageService)
BEGIN_CLASS_MEMBER(INativeResourceService)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_PROPERTY_READONLY_FAST(DefaultSystemCursor)
CLASS_MEMBER_PROPERTY_FAST(DefaultFont)
CLASS_MEMBER_METHOD(GetSystemCursor, {L"type"})
END_CLASS_MEMBER(INativeResourceService)
BEGIN_CLASS_MEMBER(INativeAsyncService)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_METHOD(IsInMainThread, {L"type"})
CLASS_MEMBER_METHOD(InvokeAsync, {L"proc"})
CLASS_MEMBER_METHOD(InvokeInMainThread, {L"proc"})
CLASS_MEMBER_METHOD(InvokeInMainThreadAndWait, {L"proc" _ L"milliseconds"})
CLASS_MEMBER_METHOD(DelayExecute, {L"proc" _ L"milliseconds"})
CLASS_MEMBER_METHOD(DelayExecuteInMainThread, {L"proc" _ L"milliseconds"})
END_CLASS_MEMBER(INativeAsyncService)
BEGIN_CLASS_MEMBER(INativeClipboardService)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_PROPERTY_FAST(Text)
CLASS_MEMBER_METHOD(ContainsText, NO_PARAMETER)
END_CLASS_MEMBER(INativeClipboardService)
BEGIN_CLASS_MEMBER(INativeScreenService)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ScreenCount)
CLASS_MEMBER_METHOD_OVERLOAD(GetScreen, {L"index"}, INativeScreen*(INativeScreenService::*)(vint))
CLASS_MEMBER_METHOD_OVERLOAD(GetScreen, {L"window"}, INativeScreen*(INativeScreenService::*)(INativeWindow*))
END_CLASS_MEMBER(INativeScreenService)
BEGIN_CLASS_MEMBER(INativeInputService)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_METHOD(IsKeyPressing, { L"code" })
CLASS_MEMBER_METHOD(IsKeyToggled, { L"code" })
CLASS_MEMBER_METHOD(GetKeyName, { L"code" })
CLASS_MEMBER_METHOD(GetKey, { L"name" })
END_CLASS_MEMBER(INativeInputService)
BEGIN_CLASS_MEMBER(INativeController)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_STATIC_EXTERNALMETHOD(GetCurrentController, NO_PARAMETER, INativeController*(*)(), &GetCurrentController)
CLASS_MEMBER_PROPERTY_READONLY_FAST(OSVersion)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ExecutablePath)
CLASS_MEMBER_METHOD(ResourceService, NO_PARAMETER)
CLASS_MEMBER_METHOD(AsyncService, NO_PARAMETER)
CLASS_MEMBER_METHOD(ClipboardService, NO_PARAMETER)
CLASS_MEMBER_METHOD(ImageService, NO_PARAMETER)
CLASS_MEMBER_METHOD(ScreenService, NO_PARAMETER)
CLASS_MEMBER_METHOD(InputService, NO_PARAMETER)
END_CLASS_MEMBER(INativeController)
BEGIN_CLASS_MEMBER(GuiImageData)
CLASS_MEMBER_CONSTRUCTOR(Ptr<GuiImageData>(), NO_PARAMETER)
CLASS_MEMBER_CONSTRUCTOR(Ptr<GuiImageData>(Ptr<INativeImage>, vint), {L"image" _ L"frameIndex"})
CLASS_MEMBER_METHOD(GetImage, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetFrameIndex, NO_PARAMETER)
CLASS_MEMBER_PROPERTY_READONLY(Image, GetImage)
CLASS_MEMBER_PROPERTY_READONLY(FrameIndex, GetFrameIndex)
END_CLASS_MEMBER(GuiImageData)
BEGIN_CLASS_MEMBER(GuiTextData)
CLASS_MEMBER_CONSTRUCTOR(Ptr<GuiTextData>(), NO_PARAMETER)
CLASS_MEMBER_CONSTRUCTOR(Ptr<GuiTextData>(const WString&), {L"text"})
CLASS_MEMBER_PROPERTY_READONLY_FAST(Text)
END_CLASS_MEMBER(GuiTextData)
BEGIN_CLASS_MEMBER(DocumentStyleProperties)
CLASS_MEMBER_CONSTRUCTOR(Ptr<DocumentStyleProperties>(), NO_PARAMETER)
CLASS_MEMBER_FIELD(face)
CLASS_MEMBER_FIELD(size)
CLASS_MEMBER_FIELD(color)
CLASS_MEMBER_FIELD(backgroundColor)
CLASS_MEMBER_FIELD(bold)
CLASS_MEMBER_FIELD(italic)
CLASS_MEMBER_FIELD(underline)
CLASS_MEMBER_FIELD(strikeline)
CLASS_MEMBER_FIELD(antialias)
CLASS_MEMBER_FIELD(verticalAntialias)
END_CLASS_MEMBER(DocumentStyleProperties)
BEGIN_CLASS_MEMBER(DocumentRun)
END_CLASS_MEMBER(DocumentRun)
BEGIN_CLASS_MEMBER(DocumentContainerRun)
CLASS_MEMBER_BASE(DocumentRun)
CLASS_MEMBER_FIELD(runs)
END_CLASS_MEMBER(DocumentContainerRun)
BEGIN_CLASS_MEMBER(DocumentContentRun)
CLASS_MEMBER_BASE(DocumentRun)
CLASS_MEMBER_PROPERTY_READONLY_FAST(RepresentationText)
END_CLASS_MEMBER(DocumentContentRun)
BEGIN_CLASS_MEMBER(DocumentTextRun)
CLASS_MEMBER_BASE(DocumentContentRun)
CLASS_MEMBER_CONSTRUCTOR(Ptr<DocumentTextRun>(), NO_PARAMETER)
CLASS_MEMBER_FIELD(text)
END_CLASS_MEMBER(DocumentTextRun)
BEGIN_CLASS_MEMBER(DocumentInlineObjectRun)
CLASS_MEMBER_BASE(DocumentContentRun)
CLASS_MEMBER_FIELD(size)
CLASS_MEMBER_FIELD(baseline)
END_CLASS_MEMBER(DocumentInlineObjectRun)
BEGIN_CLASS_MEMBER(DocumentImageRun)
CLASS_MEMBER_BASE(DocumentInlineObjectRun)
CLASS_MEMBER_CONSTRUCTOR(Ptr<DocumentImageRun>(), NO_PARAMETER)
CLASS_MEMBER_FIELD(image)
CLASS_MEMBER_FIELD(frameIndex)
CLASS_MEMBER_FIELD(source)
END_CLASS_MEMBER(DocumentImageRun)
BEGIN_CLASS_MEMBER(DocumentStylePropertiesRun)
CLASS_MEMBER_BASE(DocumentContainerRun)
CLASS_MEMBER_CONSTRUCTOR(Ptr<DocumentStylePropertiesRun>(), NO_PARAMETER)
CLASS_MEMBER_FIELD(style)
END_CLASS_MEMBER(DocumentStylePropertiesRun)
BEGIN_CLASS_MEMBER(DocumentStyleApplicationRun)
CLASS_MEMBER_BASE(DocumentContainerRun)
CLASS_MEMBER_CONSTRUCTOR(Ptr<DocumentStyleApplicationRun>(), NO_PARAMETER)
CLASS_MEMBER_FIELD(styleName)
END_CLASS_MEMBER(DocumentStyleApplicationRun)
BEGIN_CLASS_MEMBER(DocumentHyperlinkRun)
CLASS_MEMBER_BASE(DocumentStyleApplicationRun)
CLASS_MEMBER_CONSTRUCTOR(Ptr<DocumentHyperlinkRun>(), NO_PARAMETER)
CLASS_MEMBER_FIELD(normalStyleName)
CLASS_MEMBER_FIELD(activeStyleName)
CLASS_MEMBER_FIELD(reference)
END_CLASS_MEMBER(DocumentHyperlinkRun)
BEGIN_CLASS_MEMBER(DocumentParagraphRun)
CLASS_MEMBER_BASE(DocumentContainerRun)
CLASS_MEMBER_CONSTRUCTOR(Ptr<DocumentParagraphRun>(), NO_PARAMETER)
CLASS_MEMBER_FIELD(alignment)
CLASS_MEMBER_METHOD_OVERLOAD(GetText, {L"skipNonTextContent"}, WString(DocumentParagraphRun::*)(bool))
END_CLASS_MEMBER(DocumentParagraphRun)
BEGIN_CLASS_MEMBER(DocumentStyle)
CLASS_MEMBER_CONSTRUCTOR(Ptr<DocumentStyle>(), NO_PARAMETER)
CLASS_MEMBER_FIELD(parentStyleName)
CLASS_MEMBER_FIELD(styles)
CLASS_MEMBER_FIELD(resolvedStyles)
END_CLASS_MEMBER(DocumentStyle)
BEGIN_CLASS_MEMBER(DocumentModel)
CLASS_MEMBER_EXTERNALCTOR(Ptr<DocumentModel>(const WString&), {L"filePath"}, &DocumentModel_Constructor)
CLASS_MEMBER_FIELD(paragraphs)
CLASS_MEMBER_FIELD(styles)
CLASS_MEMBER_METHOD_OVERLOAD(GetText, {L"skipNonTextContent"}, WString(DocumentModel::*)(bool))
CLASS_MEMBER_STATIC_METHOD_OVERLOAD(LoadFromXml, {L"filePath" _ L"errors"}, Ptr<DocumentModel>(*)(const WString&, List<WString>&))
CLASS_MEMBER_METHOD_OVERLOAD(SaveToXml, {L"filePath"}, bool(DocumentModel::*)(const WString&))
END_CLASS_MEMBER(DocumentModel)
BEGIN_CLASS_MEMBER(GuiResourceNodeBase)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Parent)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Name)
CLASS_MEMBER_PROPERTY_FAST(Path)
END_CLASS_MEMBER(GuiResourceNodeBase)
BEGIN_CLASS_MEMBER(GuiResourceItem)
CLASS_MEMBER_BASE(GuiResourceNodeBase)
CLASS_MEMBER_METHOD(GetContent, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetContent, {L"typeName" _ L"value"})
CLASS_MEMBER_METHOD(AsImage, NO_PARAMETER)
CLASS_MEMBER_METHOD(AsXml, NO_PARAMETER)
CLASS_MEMBER_METHOD(AsString, NO_PARAMETER)
CLASS_MEMBER_METHOD(AsDocument, NO_PARAMETER)
END_CLASS_MEMBER(GuiResourceItem)
BEGIN_CLASS_MEMBER(GuiResourceFolder)
CLASS_MEMBER_BASE(GuiResourceNodeBase)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Items)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Folders)
CLASS_MEMBER_METHOD(GetItem, { L"name" })
CLASS_MEMBER_METHOD(AddItem, { L"name" _ L"item" })
CLASS_MEMBER_METHOD(RemoveItem, { L"name" })
CLASS_MEMBER_METHOD(ClearItems, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetFolder, { L"name" })
CLASS_MEMBER_METHOD(AddFolder, { L"name" _ L"folder" })
CLASS_MEMBER_METHOD(RemoveFolder, { L"name" })
CLASS_MEMBER_METHOD(ClearFolders, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetValueByPath, { L"path" })
CLASS_MEMBER_METHOD(GetFolderByPath, { L"path" })
END_CLASS_MEMBER(GuiResourceFolder)
BEGIN_CLASS_MEMBER(GuiResource)
CLASS_MEMBER_CONSTRUCTOR(Ptr<GuiResource>(), NO_PARAMETER)
CLASS_MEMBER_EXTERNALCTOR(Ptr<GuiResource>(const WString&, List<WString>&), {L"filePath" _ L"errors"}, &GuiResource::LoadFromXml);
CLASS_MEMBER_PROPERTY_READONLY_FAST(WorkingDirectory)
CLASS_MEMBER_METHOD(GetDocumentByPath, {L"path"})
CLASS_MEMBER_METHOD(GetImageByPath, {L"path"})
CLASS_MEMBER_METHOD(GetXmlByPath, {L"path"})
CLASS_MEMBER_METHOD(GetStringByPath, {L"path"})
END_CLASS_MEMBER(GuiResource)
BEGIN_CLASS_MEMBER(IGuiGraphicsElement)
CLASS_MEMBER_BASE(IDescriptable)
END_CLASS_MEMBER(IGuiGraphicsElement)
BEGIN_CLASS_MEMBER(GuiGraphicsComposition)
CLASS_MEMBER_GUIEVENT_COMPOSITION(leftButtonDown)
CLASS_MEMBER_GUIEVENT_COMPOSITION(leftButtonUp)
CLASS_MEMBER_GUIEVENT_COMPOSITION(leftButtonDoubleClick)
CLASS_MEMBER_GUIEVENT_COMPOSITION(middleButtonDown)
CLASS_MEMBER_GUIEVENT_COMPOSITION(middleButtonUp)
CLASS_MEMBER_GUIEVENT_COMPOSITION(middleButtonDoubleClick)
CLASS_MEMBER_GUIEVENT_COMPOSITION(rightButtonDown)
CLASS_MEMBER_GUIEVENT_COMPOSITION(rightButtonUp)
CLASS_MEMBER_GUIEVENT_COMPOSITION(rightButtonDoubleClick)
CLASS_MEMBER_GUIEVENT_COMPOSITION(horizontalWheel)
CLASS_MEMBER_GUIEVENT_COMPOSITION(verticalWheel)
CLASS_MEMBER_GUIEVENT_COMPOSITION(mouseMove)
CLASS_MEMBER_GUIEVENT_COMPOSITION(mouseEnter)
CLASS_MEMBER_GUIEVENT_COMPOSITION(mouseLeave)
CLASS_MEMBER_GUIEVENT_COMPOSITION(previewKey)
CLASS_MEMBER_GUIEVENT_COMPOSITION(keyDown)
CLASS_MEMBER_GUIEVENT_COMPOSITION(keyUp)
CLASS_MEMBER_GUIEVENT_COMPOSITION(systemKeyDown)
CLASS_MEMBER_GUIEVENT_COMPOSITION(systemKeyUp)
CLASS_MEMBER_GUIEVENT_COMPOSITION(previewCharInput)
CLASS_MEMBER_GUIEVENT_COMPOSITION(charInput)
CLASS_MEMBER_GUIEVENT_COMPOSITION(gotFocus)
CLASS_MEMBER_GUIEVENT_COMPOSITION(lostFocus)
CLASS_MEMBER_GUIEVENT_COMPOSITION(caretNotify)
CLASS_MEMBER_GUIEVENT_COMPOSITION(clipboardNotify)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Parent)
CLASS_MEMBER_PROPERTY_FAST(OwnedElement)
CLASS_MEMBER_PROPERTY_FAST(Visible)
CLASS_MEMBER_PROPERTY_FAST(MinSizeLimitation)
CLASS_MEMBER_PROPERTY_READONLY_FAST(GlobalBounds)
CLASS_MEMBER_PROPERTY_READONLY_FAST(AssociatedControl)
CLASS_MEMBER_PROPERTY_FAST(AssociatedCursor)
CLASS_MEMBER_PROPERTY_FAST(AssociatedHitTestResult)
CLASS_MEMBER_PROPERTY_READONLY_FAST(RelatedControl)
CLASS_MEMBER_PROPERTY_READONLY_FAST(RelatedControlHost)
CLASS_MEMBER_PROPERTY_READONLY_FAST(RelatedCursor)
CLASS_MEMBER_PROPERTY_FAST(Margin)
CLASS_MEMBER_PROPERTY_FAST(InternalMargin)
CLASS_MEMBER_PROPERTY_FAST(PreferredMinSize)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ClientArea)
CLASS_MEMBER_PROPERTY_READONLY_FAST(MinPreferredClientSize)
CLASS_MEMBER_PROPERTY_READONLY_FAST(PreferredBounds)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Bounds)
CLASS_MEMBER_METHOD_RENAME(GetChildren, Children, NO_PARAMETER)
CLASS_MEMBER_PROPERTY_READONLY(Children, GetChildren)
CLASS_MEMBER_METHOD(AddChild, {L"child"})
CLASS_MEMBER_METHOD(InsertChild, {L"index" _ L"child"})
CLASS_MEMBER_METHOD(RemoveChild, {L"child"})
CLASS_MEMBER_METHOD(MoveChild, {L"child" _ L"newIndex"})
CLASS_MEMBER_METHOD(Render, {L"size"})
CLASS_MEMBER_METHOD(FindComposition, {L"location"})
CLASS_MEMBER_METHOD(ForceCalculateSizeImmediately, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsSizeAffectParent, NO_PARAMETER)
END_CLASS_MEMBER(GuiGraphicsComposition)
BEGIN_ENUM_ITEM(GuiGraphicsComposition::MinSizeLimitation)
ENUM_ITEM_NAMESPACE(GuiGraphicsComposition)
ENUM_NAMESPACE_ITEM(NoLimit)
ENUM_NAMESPACE_ITEM(LimitToElement)
ENUM_NAMESPACE_ITEM(LimitToElementAndChildren)
END_ENUM_ITEM(GuiGraphicsComposition::MinSizeLimitation)
BEGIN_ENUM_ITEM(INativeWindowListener::HitTestResult)
ENUM_ITEM_NAMESPACE(INativeWindowListener)
ENUM_NAMESPACE_ITEM(BorderNoSizing)
ENUM_NAMESPACE_ITEM(BorderLeft)
ENUM_NAMESPACE_ITEM(BorderRight)
ENUM_NAMESPACE_ITEM(BorderTop)
ENUM_NAMESPACE_ITEM(BorderBottom)
ENUM_NAMESPACE_ITEM(BorderLeftTop)
ENUM_NAMESPACE_ITEM(BorderRightTop)
ENUM_NAMESPACE_ITEM(BorderLeftBottom)
ENUM_NAMESPACE_ITEM(BorderRightBottom)
ENUM_NAMESPACE_ITEM(Title)
ENUM_NAMESPACE_ITEM(ButtonMinimum)
ENUM_NAMESPACE_ITEM(ButtonMaximum)
ENUM_NAMESPACE_ITEM(ButtonClose)
ENUM_NAMESPACE_ITEM(Client)
ENUM_NAMESPACE_ITEM(Icon)
ENUM_NAMESPACE_ITEM(NoDecision)
END_ENUM_ITEM(INativeWindowListener::HitTestResult)
BEGIN_CLASS_MEMBER(GuiGraphicsSite)
CLASS_MEMBER_BASE(GuiGraphicsComposition)
CLASS_MEMBER_PROPERTY_GUIEVENT_READONLY_FAST(Bounds)
END_CLASS_MEMBER(GuiGraphicsSite)
BEGIN_CLASS_MEMBER(GuiWindowComposition)
CLASS_MEMBER_BASE(GuiGraphicsSite)
CLASS_MEMBER_CONSTRUCTOR(GuiWindowComposition*(), NO_PARAMETER)
END_CLASS_MEMBER(GuiWindowComposition)
BEGIN_CLASS_MEMBER(GuiBoundsComposition)
CLASS_MEMBER_BASE(GuiGraphicsSite)
CLASS_MEMBER_CONSTRUCTOR(GuiBoundsComposition*(), NO_PARAMETER)
CLASS_MEMBER_PROPERTY_EVENT_FAST(Bounds, BoundsChanged)
CLASS_MEMBER_PROPERTY_FAST(AlignmentToParent)
CLASS_MEMBER_METHOD(ClearAlignmentToParent, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsAlignedToParent, NO_PARAMETER)
END_CLASS_MEMBER(GuiBoundsComposition)
BEGIN_CLASS_MEMBER(GuiControl)
CLASS_MEMBER_CONSTRUCTOR(GuiControl*(GuiControl::IStyleController*), {L"styleController"})
CLASS_MEMBER_PROPERTY_READONLY_FAST(StyleController)
CLASS_MEMBER_PROPERTY_READONLY_FAST(BoundsComposition)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ContainerComposition)
CLASS_MEMBER_PROPERTY_READONLY_FAST(FocusableComposition)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Parent)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ChildrenCount)
CLASS_MEMBER_PROPERTY_READONLY_FAST(RelatedControlHost)
CLASS_MEMBER_PROPERTY_GUIEVENT_READONLY_FAST(VisuallyEnabled)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(Enabled)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(Visible)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(Alt)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(Text)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(Font)
CLASS_MEMBER_PROPERTY_FAST(Tag)
CLASS_MEMBER_PROPERTY_FAST(TooltipControl)
CLASS_MEMBER_PROPERTY_FAST(TooltipWidth)
CLASS_MEMBER_METHOD(SetActivatingAltHost, { L"host" })
CLASS_MEMBER_METHOD(GetChild, {L"index"})
CLASS_MEMBER_METHOD(AddChild, {L"control"})
CLASS_MEMBER_METHOD(HasChild, {L"control"})
CLASS_MEMBER_METHOD(SetFocus, NO_PARAMETER)
CLASS_MEMBER_METHOD(DisplayTooltip, {L"location"})
CLASS_MEMBER_METHOD(CloseTooltip, NO_PARAMETER)
CLASS_MEMBER_METHOD_OVERLOAD(QueryService, {L"identifier"}, IDescriptable*(GuiControl::*)(const WString&))
END_CLASS_MEMBER(GuiControl)
BEGIN_CLASS_MEMBER(GuiControl::IStyleController)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_EXTERNALCTOR(GuiControl::IStyleController*(Ptr<IValueInterfaceProxy>), {L"proxy"}, &interface_proxy::GuiControl_IStyleController::Create)
CLASS_MEMBER_METHOD(GetBoundsComposition, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetContainerComposition, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetFocusableComposition, {L"value"})
CLASS_MEMBER_METHOD(SetText, {L"value"})
CLASS_MEMBER_METHOD(SetFont, {L"value"})
CLASS_MEMBER_METHOD(SetVisuallyEnabled, {L"value"})
END_CLASS_MEMBER(GuiControl::IStyleController)
BEGIN_CLASS_MEMBER(GuiControl::IStyleProvider)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_EXTERNALCTOR(GuiControl::IStyleProvider*(Ptr<IValueInterfaceProxy>), {L"proxy"}, &interface_proxy::GuiControl_IStyleProvider::Create)
CLASS_MEMBER_METHOD(AssociateStyleController, {L"controller"})
CLASS_MEMBER_METHOD(SetFocusableComposition, {L"value"})
CLASS_MEMBER_METHOD(SetText, {L"value"})
CLASS_MEMBER_METHOD(SetFont, {L"value"})
CLASS_MEMBER_METHOD(SetVisuallyEnabled, {L"value"})
END_CLASS_MEMBER(GuiControl::IStyleProvider)
BEGIN_CLASS_MEMBER(GuiComponent)
END_CLASS_MEMBER(GuiComponent)
BEGIN_CLASS_MEMBER(GuiControlHost)
CLASS_MEMBER_BASE(GuiControl)
CLASS_MEMBER_BASE(GuiInstanceRootObject)
CLASS_MEMBER_CONSTRUCTOR(GuiControlHost*(GuiControl::IStyleController*), {L"styleController"})
CLASS_MEMBER_GUIEVENT(WindowGotFocus)
CLASS_MEMBER_GUIEVENT(WindowLostFocus)
CLASS_MEMBER_GUIEVENT(WindowActivated)
CLASS_MEMBER_GUIEVENT(WindowDeactivated)
CLASS_MEMBER_GUIEVENT(WindowOpened)
CLASS_MEMBER_GUIEVENT(WindowClosing)
CLASS_MEMBER_GUIEVENT(WindowClosed)
CLASS_MEMBER_GUIEVENT(WindowDestroying)
CLASS_MEMBER_PROPERTY_READONLY_FAST(MainComposition)
CLASS_MEMBER_PROPERTY_FAST(ShowInTaskBar)
CLASS_MEMBER_PROPERTY_FAST(EnabledActivate)
CLASS_MEMBER_PROPERTY_FAST(TopMost)
CLASS_MEMBER_PROPERTY_FAST(ClientSize)
CLASS_MEMBER_PROPERTY_FAST(Bounds)
CLASS_MEMBER_PROPERTY_FAST(ShortcutKeyManager)
CLASS_MEMBER_PROPERTY_READONLY_FAST(AnimationManager)
CLASS_MEMBER_METHOD(ForceCalculateSizeImmediately, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetFocused, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetFocused, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetActivated, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetActivated, NO_PARAMETER)
CLASS_MEMBER_METHOD(Show, NO_PARAMETER)
CLASS_MEMBER_METHOD(ShowDeactivated, NO_PARAMETER)
CLASS_MEMBER_METHOD(ShowRestored, NO_PARAMETER)
CLASS_MEMBER_METHOD(ShowMaximized, NO_PARAMETER)
CLASS_MEMBER_METHOD(ShowMinimized, NO_PARAMETER)
CLASS_MEMBER_METHOD(Hide, NO_PARAMETER)
CLASS_MEMBER_METHOD(Close, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetOpening, NO_PARAMETER)
END_CLASS_MEMBER(GuiControlHost)
#undef _
/***********************************************************************
Type Loader
***********************************************************************/
class GuiBasicTypeLoader : public Object, public ITypeLoader
{
public:
void Load(ITypeManager* manager)
{
GUIREFLECTIONBASIC_TYPELIST(ADD_TYPE_INFO)
}
void Unload(ITypeManager* manager)
{
}
};
#endif
bool LoadGuiBasicTypes()
{
#ifndef VCZH_DEBUG_NO_REFLECTION
ITypeManager* manager=GetGlobalTypeManager();
if(manager)
{
Ptr<ITypeLoader> loader=new GuiBasicTypeLoader;
return manager->AddTypeLoader(loader);
}
#endif
return false;
}
}
}
}
/***********************************************************************
TypeDescriptors\GuiReflectionCompositions.cpp
***********************************************************************/
namespace vl
{
namespace reflection
{
namespace description
{
using namespace collections;
using namespace parsing;
using namespace parsing::tabling;
using namespace parsing::xml;
using namespace stream;
#ifndef VCZH_DEBUG_NO_REFLECTION
GUIREFLECTIONCOMPOSITION_TYPELIST(IMPL_TYPE_INFO)
/***********************************************************************
External Functions
***********************************************************************/
void GuiTableComposition_SetRows(GuiTableComposition* thisObject, vint value)
{
vint columns=thisObject->GetColumns();
if(columns<=0) columns=1;
thisObject->SetRowsAndColumns(value, columns);
}
void GuiTableComposition_SetColumns(GuiTableComposition* thisObject, vint value)
{
vint row=thisObject->GetRows();
if(row<=0) row=1;
thisObject->SetRowsAndColumns(row, value);
}
void IGuiAltActionHost_CollectAltActions(IGuiAltActionHost* host, List<IGuiAltAction*>& actions)
{
Group<WString, IGuiAltAction*> group;
host->CollectAltActions(group);
for (vint i = 0; i < group.Count(); i++)
{
CopyFrom(actions, group.GetByIndex(i), true);
}
}
/***********************************************************************
Type Declaration
***********************************************************************/
#define _ ,
#define INTERFACE_EXTERNALCTOR(CONTROL, INTERFACE)\
CLASS_MEMBER_EXTERNALCTOR(decltype(interface_proxy::CONTROL##_##INTERFACE::Create(0))(Ptr<IValueInterfaceProxy>), {L"proxy"}, &interface_proxy::CONTROL##_##INTERFACE::Create)
#define INTERFACE_IDENTIFIER(INTERFACE)\
CLASS_MEMBER_STATIC_EXTERNALMETHOD(GetIdentifier, NO_PARAMETER, WString(*)(), []()->WString{return INTERFACE::Identifier;})
BEGIN_CLASS_MEMBER(GuiStackComposition)
CLASS_MEMBER_BASE(GuiBoundsComposition)
CLASS_MEMBER_CONSTRUCTOR(GuiStackComposition*(), NO_PARAMETER)
CLASS_MEMBER_PROPERTY_READONLY_FAST(StackItems)
CLASS_MEMBER_PROPERTY_FAST(Direction)
CLASS_MEMBER_PROPERTY_FAST(Padding)
CLASS_MEMBER_PROPERTY_FAST(ExtraMargin)
CLASS_MEMBER_METHOD(InsertStackItem, {L"index" _ L"item"})
CLASS_MEMBER_METHOD(IsStackItemClipped, NO_PARAMETER)
CLASS_MEMBER_METHOD(EnsureVisible, {L"index"})
END_CLASS_MEMBER(GuiStackComposition)
BEGIN_ENUM_ITEM(GuiStackComposition::Direction)
ENUM_ITEM_NAMESPACE(GuiStackComposition)
ENUM_NAMESPACE_ITEM(Horizontal)
ENUM_NAMESPACE_ITEM(Vertical)
END_ENUM_ITEM(GuiStackComposition::Direction)
BEGIN_CLASS_MEMBER(GuiStackItemComposition)
CLASS_MEMBER_BASE(GuiGraphicsSite)
CLASS_MEMBER_CONSTRUCTOR(GuiStackItemComposition*(), NO_PARAMETER)
CLASS_MEMBER_PROPERTY_EVENT_FAST(Bounds, BoundsChanged)
CLASS_MEMBER_PROPERTY_FAST(ExtraMargin)
END_CLASS_MEMBER(GuiStackItemComposition)
BEGIN_STRUCT_MEMBER(GuiCellOption)
STRUCT_MEMBER(composeType)
STRUCT_MEMBER(absolute)
STRUCT_MEMBER(percentage)
END_STRUCT_MEMBER(GuiCellOption)
BEGIN_ENUM_ITEM(GuiCellOption::ComposeType)
ENUM_ITEM_NAMESPACE(GuiCellOption)
ENUM_NAMESPACE_ITEM(Absolute)
ENUM_NAMESPACE_ITEM(Percentage)
ENUM_NAMESPACE_ITEM(MinSize)
END_ENUM_ITEM(GuiCellOption::ComposeType)
BEGIN_CLASS_MEMBER(GuiTableComposition)
CLASS_MEMBER_BASE(GuiBoundsComposition)
CLASS_MEMBER_CONSTRUCTOR(GuiTableComposition*(), NO_PARAMETER)
CLASS_MEMBER_PROPERTY_FAST(CellPadding)
CLASS_MEMBER_METHOD(GetRows, NO_PARAMETER)
CLASS_MEMBER_EXTERNALMETHOD(SetRows, {L"value"}, void(GuiTableComposition::*)(vint), &GuiTableComposition_SetRows)
CLASS_MEMBER_PROPERTY(Rows, GetRows, SetRows)
CLASS_MEMBER_METHOD(GetColumns, NO_PARAMETER)
CLASS_MEMBER_EXTERNALMETHOD(SetColumns, {L"value"}, void(GuiTableComposition::*)(vint), &GuiTableComposition_SetColumns)
CLASS_MEMBER_PROPERTY(Columns, GetColumns, SetColumns)
CLASS_MEMBER_METHOD(SetRowsAndColumns, {L"rows" _ L"columns"})
CLASS_MEMBER_METHOD(GetSitedCell, {L"rows" _ L"columns"})
CLASS_MEMBER_METHOD(GetRowOption, {L"row"})
CLASS_MEMBER_METHOD(SetRowOption, {L"row" _ L"option"})
CLASS_MEMBER_METHOD(GetColumnOption, {L"column"})
CLASS_MEMBER_METHOD(SetColumnOption, {L"column" _ L"option"})
CLASS_MEMBER_METHOD(GetCellArea, NO_PARAMETER)
CLASS_MEMBER_METHOD(UpdateCellBounds, NO_PARAMETER)
END_CLASS_MEMBER(GuiTableComposition)
BEGIN_CLASS_MEMBER(GuiCellComposition)
CLASS_MEMBER_BASE(GuiGraphicsSite)
CLASS_MEMBER_CONSTRUCTOR(GuiCellComposition*(), NO_PARAMETER)
CLASS_MEMBER_PROPERTY_READONLY_FAST(TableParent)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Row)
CLASS_MEMBER_PROPERTY_READONLY_FAST(RowSpan)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Column)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ColumnSpan)
CLASS_MEMBER_METHOD(SetSite, {L"row" _ L"column" _ L"rowSpan" _ L"columnSpan"})
END_CLASS_MEMBER(GuiCellComposition)
BEGIN_CLASS_MEMBER(GuiSideAlignedComposition)
CLASS_MEMBER_BASE(GuiGraphicsSite)
CLASS_MEMBER_CONSTRUCTOR(GuiSideAlignedComposition*(), NO_PARAMETER)
CLASS_MEMBER_PROPERTY_FAST(Direction)
CLASS_MEMBER_PROPERTY_FAST(MaxLength)
CLASS_MEMBER_PROPERTY_FAST(MaxRatio)
END_CLASS_MEMBER(GuiSideAlignedComposition)
BEGIN_ENUM_ITEM(GuiSideAlignedComposition::Direction)
ENUM_ITEM_NAMESPACE(GuiSideAlignedComposition)
ENUM_NAMESPACE_ITEM(Left)
ENUM_NAMESPACE_ITEM(Top)
ENUM_NAMESPACE_ITEM(Right)
ENUM_NAMESPACE_ITEM(Bottom)
END_ENUM_ITEM(GuiSideAlignedComposition::Direction)
BEGIN_CLASS_MEMBER(GuiPartialViewComposition)
CLASS_MEMBER_BASE(GuiGraphicsSite)
CLASS_MEMBER_CONSTRUCTOR(GuiPartialViewComposition*(), NO_PARAMETER)
CLASS_MEMBER_PROPERTY_FAST(WidthRatio)
CLASS_MEMBER_PROPERTY_FAST(WidthPageSize)
CLASS_MEMBER_PROPERTY_FAST(HeightRatio)
CLASS_MEMBER_PROPERTY_FAST(HeightPageSize)
END_CLASS_MEMBER(GuiPartialViewComposition)
BEGIN_CLASS_MEMBER(GuiSharedSizeItemComposition)
CLASS_MEMBER_BASE(GuiBoundsComposition)
CLASS_MEMBER_CONSTRUCTOR(GuiSharedSizeItemComposition*(), NO_PARAMETER)
CLASS_MEMBER_PROPERTY_FAST(Group)
CLASS_MEMBER_PROPERTY_FAST(SharedWidth)
CLASS_MEMBER_PROPERTY_FAST(SharedHeight)
END_CLASS_MEMBER(GuiSubComponentMeasurer)
BEGIN_CLASS_MEMBER(GuiSharedSizeRootComposition)
CLASS_MEMBER_BASE(GuiBoundsComposition)
CLASS_MEMBER_CONSTRUCTOR(GuiSharedSizeRootComposition*(), NO_PARAMETER)
END_CLASS_MEMBER(GuiSubComponentMeasurerSource)
BEGIN_CLASS_MEMBER(IGuiGraphicsAnimation)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(composition, IGuiGraphicsAnimation)
CLASS_MEMBER_PROPERTY_READONLY_FAST(TotalLength)
CLASS_MEMBER_PROPERTY_READONLY_FAST(CurrentPosition)
CLASS_MEMBER_METHOD(Play, {L"currentPosition" _ L"totalLength"})
CLASS_MEMBER_METHOD(Stop, NO_PARAMETER)
END_CLASS_MEMBER(IGuiGraphicsAnimation)
BEGIN_CLASS_MEMBER(GuiGraphicsAnimationManager)
CLASS_MEMBER_METHOD(AddAnimation, {L"animation"})
CLASS_MEMBER_METHOD(HasAnimation, NO_PARAMETER)
CLASS_MEMBER_METHOD(Play, NO_PARAMETER)
END_CLASS_MEMBER(GuiGraphicsAnimationManager)
BEGIN_CLASS_MEMBER(IGuiShortcutKeyItem)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Manager)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Name)
END_CLASS_MEMBER(IGuiShortcutKeyItem)
BEGIN_CLASS_MEMBER(IGuiShortcutKeyManager)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ItemCount)
CLASS_MEMBER_METHOD(GetItem, {L"index"})
END_CLASS_MEMBER(IGuiShortcutKeyManager)
BEGIN_CLASS_MEMBER(GuiShortcutKeyManager)
CLASS_MEMBER_BASE(IGuiShortcutKeyManager)
CLASS_MEMBER_CONSTRUCTOR(GuiShortcutKeyManager*(), NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateShortcut, {L"ctrl" _ L"shift" _ L"alt" _ L"ket"})
CLASS_MEMBER_METHOD(DestroyShortcut, {L"ctrl" _ L"shift" _ L"alt" _ L"ket"})
CLASS_MEMBER_METHOD(TryGetShortcut, {L"ctrl" _ L"shift" _ L"alt" _ L"ket"})
END_CLASS_MEMBER(GuiShortcutKeyManager)
BEGIN_CLASS_MEMBER(IGuiAltAction)
INTERFACE_IDENTIFIER(IGuiAltAction)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Alt)
CLASS_MEMBER_METHOD(IsAltEnabled, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsAltAvailable, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetAltComposition, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetActivatingAltHost, NO_PARAMETER)
CLASS_MEMBER_METHOD(OnActiveAlt, NO_PARAMETER)
END_CLASS_MEMBER(IGuiAltAction)
BEGIN_CLASS_MEMBER(IGuiAltActionContainer)
INTERFACE_IDENTIFIER(IGuiAltActionContainer)
CLASS_MEMBER_PROPERTY_READONLY_FAST(AltActionCount)
CLASS_MEMBER_METHOD(GetAltAction, { L"index" })
END_CLASS_MEMBER(IGuiAltActionContainer)
BEGIN_CLASS_MEMBER(IGuiAltActionHost)
INTERFACE_IDENTIFIER(IGuiAltActionHost)
CLASS_MEMBER_PROPERTY_READONLY_FAST(PreviousAltHost)
CLASS_MEMBER_METHOD(OnActivatedAltHost, { L"previousHost" })
CLASS_MEMBER_METHOD(OnDeactivatedAltHost, NO_PARAMETER)
CLASS_MEMBER_EXTERNALMETHOD(CollectAltActions, {L"actions"}, void(IGuiAltActionHost::*)(List<IGuiAltAction*>&), &IGuiAltActionHost_CollectAltActions)
END_CLASS_MEMBER(IGuiAltActionHost)
#undef INTERFACE_EXTERNALCTOR
#undef _
/***********************************************************************
Type Loader
***********************************************************************/
class GuiCompositionTypeLoader : public Object, public ITypeLoader
{
public:
void Load(ITypeManager* manager)
{
GUIREFLECTIONCOMPOSITION_TYPELIST(ADD_TYPE_INFO)
}
void Unload(ITypeManager* manager)
{
}
};
#endif
bool LoadGuiCompositionTypes()
{
#ifndef VCZH_DEBUG_NO_REFLECTION
ITypeManager* manager=GetGlobalTypeManager();
if(manager)
{
Ptr<ITypeLoader> loader=new GuiCompositionTypeLoader;
return manager->AddTypeLoader(loader);
}
#endif
return false;
}
}
}
}
/***********************************************************************
TypeDescriptors\GuiReflectionControls.cpp
***********************************************************************/
namespace vl
{
namespace reflection
{
namespace description
{
using namespace collections;
using namespace parsing;
using namespace parsing::tabling;
using namespace parsing::definitions;
using namespace parsing::analyzing;
using namespace parsing::xml;
using namespace stream;
using namespace list;
using namespace tree;
using namespace text;
using namespace theme;
#ifndef VCZH_DEBUG_NO_REFLECTION
GUIREFLECTIONCONTROLS_TYPELIST(IMPL_TYPE_INFO)
/***********************************************************************
External Functions
***********************************************************************/
Ptr<ITheme> CreateWin7Theme()
{
return new win7::Win7Theme();
}
Ptr<ITheme> CreateWin8Theme()
{
return new win8::Win8Theme();
}
ListViewItemStyleProvider::IListViewItemContent* ListViewItemStyleProvider_GetItemContent(ListViewItemStyleProvider* thisObject, GuiListControl::IItemStyleController* itemStyleController)
{
return thisObject->GetItemContent<ListViewItemStyleProvider::IListViewItemContent>(itemStyleController);
}
Ptr<RepeatingParsingExecutor> CreateRepeatingParsingExecutor(const WString& grammar, bool enableAmbiguity, const WString& rule, Ptr<ILanguageProvider> provider)
{
Ptr<ParsingGeneralParser> parser=CreateBootstrapStrictParser();
List<Ptr<ParsingError>> errors;
Ptr<ParsingTreeNode> definitionNode=parser->Parse(grammar, L"ParserDecl", errors);
Ptr<ParsingDefinition> definition=DeserializeDefinition(definitionNode);
Ptr<ParsingTable> table=GenerateTable(definition, enableAmbiguity, errors);
Ptr<ParsingGeneralParser> grammarParser=CreateAutoRecoverParser(table);
return new RepeatingParsingExecutor(grammarParser, rule, provider);
}
/***********************************************************************
Type Declaration
***********************************************************************/
#define _ ,
#define CONTROL_CONSTRUCTOR_CONTROLLER(CONTROL)\
CLASS_MEMBER_CONSTRUCTOR(CONTROL*(CONTROL::IStyleController*), {L"styleController"})
#define CONTROL_CONSTRUCTOR_DEFAULT(CONTROL, CONSTRUCTOR)\
CLASS_MEMBER_EXTERNALCTOR(CONTROL*(), NO_PARAMETER, CONSTRUCTOR)
#define CONTROL_CONSTRUCTOR_PROVIDER(CONTROL)\
CLASS_MEMBER_CONSTRUCTOR(CONTROL*(CONTROL::IStyleProvider*), {L"styleProvider"})
#define INTERFACE_EXTERNALCTOR(CONTROL, INTERFACE)\
CLASS_MEMBER_EXTERNALCTOR(decltype(interface_proxy::CONTROL##_##INTERFACE::Create(0))(Ptr<IValueInterfaceProxy>), {L"proxy"}, &interface_proxy::CONTROL##_##INTERFACE::Create)
#define INTERFACE_IDENTIFIER(INTERFACE)\
CLASS_MEMBER_STATIC_EXTERNALMETHOD(GetIdentifier, NO_PARAMETER, WString(*)(), []()->WString{return INTERFACE::Identifier;})
BEGIN_CLASS_MEMBER(GuiApplication)
CLASS_MEMBER_STATIC_EXTERNALMETHOD(GetApplication, NO_PARAMETER, GuiApplication*(*)(), &GetApplication)
CLASS_MEMBER_PROPERTY_READONLY_FAST(MainWindow)
CLASS_MEMBER_PROPERTY_READONLY_FAST(TooltipOwner)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ExecutablePath)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ExecutableFolder)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Windows)
CLASS_MEMBER_METHOD(Run, NO_PARAMETER)
CLASS_MEMBER_METHOD(ShowTooltip, {L"owner" _ L"tooltip" _ L"preferredContentWidth" _ L"location"})
CLASS_MEMBER_METHOD(CloseTooltip, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsInMainThread, NO_PARAMETER)
CLASS_MEMBER_METHOD(InvokeAsync, {L"proc"})
CLASS_MEMBER_METHOD(InvokeInMainThread, {L"proc"})
CLASS_MEMBER_METHOD(InvokeInMainThreadAndWait, {L"proc" _ L"milliseconds"})
CLASS_MEMBER_METHOD(DelayExecute, {L"proc" _ L"milliseconds"})
CLASS_MEMBER_METHOD(DelayExecuteInMainThread, {L"proc" _ L"milliseconds"})
END_CLASS_MEMBER(GuiApplication)
BEGIN_CLASS_MEMBER(ITheme)
CLASS_MEMBER_STATIC_EXTERNALMETHOD(GetCurrentTheme, NO_PARAMETER, ITheme*(*)(), &GetCurrentTheme)
CLASS_MEMBER_STATIC_EXTERNALMETHOD(SetCurrentTheme, {L"theme"}, void(*)(ITheme*), &SetCurrentTheme)
CLASS_MEMBER_STATIC_EXTERNALMETHOD(CreateWin7Theme, NO_PARAMETER, Ptr<ITheme>(*)(), &CreateWin7Theme)
CLASS_MEMBER_STATIC_EXTERNALMETHOD(CreateWin8Theme, NO_PARAMETER, Ptr<ITheme>(*)(), &CreateWin8Theme)
CLASS_MEMBER_METHOD(CreateWindowStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateTooltipStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateLabelStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateShortcutKeyStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateScrollContainerStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateGroupBoxStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateTabStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateComboBoxStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateMultilineTextBoxStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateTextBoxStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetDefaultTextBoxColorEntry, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateDocumentViewerStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateDocumentLabelStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateListViewStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateTreeViewStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateListItemBackgroundStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateMenuStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateMenuBarStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateMenuSplitterStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateMenuBarButtonStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateMenuItemButtonStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateToolBarStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateToolBarButtonStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateToolBarDropdownButtonStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateToolBarSplitButtonStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateToolBarSplitterStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateButtonStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateCheckBoxStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateRadioButtonStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateHScrollStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateVScrollStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateHTrackerStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateVTrackerStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateProgressBarStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetScrollDefaultSize, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetTrackerDefaultSize, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateTextListStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateTextListItemStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateCheckTextListItemStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateRadioTextListItemStyle, NO_PARAMETER)
END_CLASS_MEMBER(ITheme)
BEGIN_CLASS_MEMBER(GuiInstanceRootObject)
CLASS_MEMBER_METHOD(AddSubscription, {L"subscription"})
CLASS_MEMBER_METHOD(RemoveSubscription, {L"subscription"})
CLASS_MEMBER_METHOD(ContainsSubscription, {L"subscription"})
CLASS_MEMBER_METHOD(AddComponent, {L"component"})
CLASS_MEMBER_METHOD(RemoveComponent, {L"component"})
CLASS_MEMBER_METHOD(ContainsComponent, {L"component"})
END_CLASS_MEMBER(GuiInstanceRootObject)
BEGIN_CLASS_MEMBER(GuiCustomControl)
CLASS_MEMBER_BASE(GuiControl)
CLASS_MEMBER_BASE(GuiInstanceRootObject)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiCustomControl)
END_CLASS_MEMBER(GuiCustomControl)
BEGIN_CLASS_MEMBER(GuiLabel)
CLASS_MEMBER_BASE(GuiControl)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiLabel)
CLASS_MEMBER_PROPERTY_FAST(TextColor)
END_CLASS_MEMBER(GuiLabel)
BEGIN_CLASS_MEMBER(GuiLabel::IStyleController)
CLASS_MEMBER_BASE(GuiControl::IStyleController)
INTERFACE_EXTERNALCTOR(GuiLabel, IStyleController)
CLASS_MEMBER_METHOD(GetDefaultTextColor, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetTextColor, {L"value"})
END_CLASS_MEMBER(GuiLabel::IStyleController)
BEGIN_CLASS_MEMBER(GuiButton)
CLASS_MEMBER_BASE(GuiControl)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiButton)
CLASS_MEMBER_GUIEVENT(Clicked)
CLASS_MEMBER_PROPERTY_FAST(ClickOnMouseUp)
END_CLASS_MEMBER(GuiButton)
BEGIN_ENUM_ITEM(GuiButton::ControlState)
ENUM_ITEM_NAMESPACE(GuiButton)
ENUM_NAMESPACE_ITEM(Normal)
ENUM_NAMESPACE_ITEM(Active)
ENUM_NAMESPACE_ITEM(Pressed)
END_ENUM_ITEM(GuiButton::ControlState)
BEGIN_CLASS_MEMBER(GuiButton::IStyleController)
CLASS_MEMBER_BASE(GuiControl::IStyleController)
INTERFACE_EXTERNALCTOR(GuiButton, IStyleController)
CLASS_MEMBER_METHOD(Transfer, {L"value"})
END_CLASS_MEMBER(GuiButton::IStyleController)
BEGIN_CLASS_MEMBER(GuiSelectableButton)
CLASS_MEMBER_BASE(GuiButton)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiSelectableButton)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(GroupController)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(AutoSelection)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(Selected)
END_CLASS_MEMBER(GuiSelectableButton)
BEGIN_CLASS_MEMBER(GuiSelectableButton::IStyleController)
CLASS_MEMBER_BASE(GuiButton::IStyleController)
INTERFACE_EXTERNALCTOR(GuiSelectableButton, IStyleController)
CLASS_MEMBER_METHOD(SetSelected, {L"value"})
END_CLASS_MEMBER(GuiSelectableButton::IStyleController)
BEGIN_CLASS_MEMBER(GuiSelectableButton::GroupController)
CLASS_MEMBER_BASE(GuiComponent)
CLASS_MEMBER_METHOD(Attach, {L"button"})
CLASS_MEMBER_METHOD(Detach, {L"button"})
CLASS_MEMBER_METHOD(OnSelectedChanged, {L"button"})
END_CLASS_MEMBER(GuiSelectableButton::GroupController)
BEGIN_CLASS_MEMBER(GuiSelectableButton::MutexGroupController)
CLASS_MEMBER_BASE(GuiSelectableButton::GroupController)
CLASS_MEMBER_CONSTRUCTOR(GuiSelectableButton::MutexGroupController*(), NO_PARAMETER)
END_CLASS_MEMBER(GuiSelectableButton::MutexGroupController)
BEGIN_CLASS_MEMBER(GuiScroll)
CLASS_MEMBER_BASE(GuiControl)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiScroll)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(TotalSize)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(PageSize)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(Position)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(SmallMove)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(BigMove)
CLASS_MEMBER_PROPERTY_READONLY_FAST(MinPosition)
CLASS_MEMBER_PROPERTY_READONLY_FAST(MaxPosition)
END_CLASS_MEMBER(GuiScroll)
BEGIN_CLASS_MEMBER(GuiScroll::ICommandExecutor)
CLASS_MEMBER_METHOD(SmallDecrease, NO_PARAMETER)
CLASS_MEMBER_METHOD(SmallIncrease, NO_PARAMETER)
CLASS_MEMBER_METHOD(BigDecrease, NO_PARAMETER)
CLASS_MEMBER_METHOD(BigIncrease, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetTotalSize, {L"value"})
CLASS_MEMBER_METHOD(SetPageSize, {L"value"})
CLASS_MEMBER_METHOD(SetPosition, {L"value"})
END_CLASS_MEMBER(GuiScroll::ICommandExecutor)
BEGIN_CLASS_MEMBER(GuiScroll::IStyleController)
CLASS_MEMBER_BASE(GuiControl::IStyleController)
INTERFACE_EXTERNALCTOR(GuiScroll, IStyleController)
CLASS_MEMBER_METHOD(SetCommandExecutor, {L"value"})
CLASS_MEMBER_METHOD(SetTotalSize, {L"value"})
CLASS_MEMBER_METHOD(SetPageSize, {L"value"})
CLASS_MEMBER_METHOD(SetPosition, {L"value"})
END_CLASS_MEMBER(GuiScroll::IStyleController)
BEGIN_CLASS_MEMBER(GuiTabPage)
CLASS_MEMBER_CONSTRUCTOR(GuiTabPage*(), NO_PARAMETER)
CLASS_MEMBER_GUIEVENT(PageInstalled)
CLASS_MEMBER_GUIEVENT(PageUninstalled)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ContainerComposition)
CLASS_MEMBER_PROPERTY_READONLY_FAST(OwnerTab)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(Alt)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(Text)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Selected)
END_CLASS_MEMBER(GuiTabPage)
BEGIN_CLASS_MEMBER(GuiTab)
CLASS_MEMBER_BASE(GuiControl)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiTab)
CONTROL_CONSTRUCTOR_DEFAULT(GuiTab, &g::NewTab)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(SelectedPage)
CLASS_MEMBER_METHOD_OVERLOAD(CreatePage, {L"index"}, GuiTabPage*(GuiTab::*)(vint))
CLASS_MEMBER_METHOD_OVERLOAD(CreatePage, {L"page" _ L"index"}, bool(GuiTab::*)(GuiTabPage* _ vint))
CLASS_MEMBER_METHOD(RemovePage, {L"value"})
CLASS_MEMBER_METHOD(MovePage, {L"page" _ L"newIndex"})
CLASS_MEMBER_PROPERTY_READONLY_FAST(Pages)
END_CLASS_MEMBER(GuiTab)
BEGIN_CLASS_MEMBER(GuiTab::ICommandExecutor)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_METHOD(ShowTab, {L"index"})
END_CLASS_MEMBER(GuiTab::ICommandExecutor)
BEGIN_CLASS_MEMBER(GuiTab::IStyleController)
CLASS_MEMBER_BASE(GuiControl::IStyleController)
INTERFACE_EXTERNALCTOR(GuiTab, IStyleController)
CLASS_MEMBER_METHOD(SetCommandExecutor, {L"value"})
CLASS_MEMBER_METHOD(InsertTab, {L"index"})
CLASS_MEMBER_METHOD(SetTabText, {L"index" _ L"value"})
CLASS_MEMBER_METHOD(RemoveTab, {L"index"})
CLASS_MEMBER_METHOD(MoveTab, {L"oldIndex" _ L"newIndex"})
CLASS_MEMBER_METHOD(SetSelectedTab, {L"index"})
CLASS_MEMBER_METHOD(SetTabAlt, {L"index" _ L"value" _ L"host"})
CLASS_MEMBER_METHOD(GetTabAltAction, {L"index"})
END_CLASS_MEMBER(GuiTab::IStyleController)
BEGIN_CLASS_MEMBER(GuiScrollView)
CLASS_MEMBER_BASE(GuiControl)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ViewSize)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ViewBounds)
CLASS_MEMBER_PROPERTY_READONLY_FAST(HorizontalScroll)
CLASS_MEMBER_PROPERTY_READONLY_FAST(VerticalScroll)
CLASS_MEMBER_PROPERTY_FAST(HorizontalAlwaysVisible)
CLASS_MEMBER_PROPERTY_FAST(VerticalAlwaysVisible)
CLASS_MEMBER_METHOD(CalculateView, NO_PARAMETER)
END_CLASS_MEMBER(GuiScrollView)
BEGIN_CLASS_MEMBER(GuiScrollView::IStyleProvider)
CLASS_MEMBER_BASE(GuiControl::IStyleProvider)
INTERFACE_EXTERNALCTOR(GuiScrollView, IStyleProvider)
CLASS_MEMBER_METHOD(CreateHorizontalScrollStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateVerticalScrollStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetDefaultScrollSize, NO_PARAMETER)
CLASS_MEMBER_METHOD(InstallBackground, {L"boundsComposition"})
END_CLASS_MEMBER(GuiScrollView::IStyleProvider)
BEGIN_CLASS_MEMBER(GuiScrollContainer)
CLASS_MEMBER_BASE(GuiScrollView)
CONTROL_CONSTRUCTOR_PROVIDER(GuiScrollContainer)
CLASS_MEMBER_PROPERTY_FAST(ExtendToFullWidth)
END_CLASS_MEMBER(GuiScrollContainer)
BEGIN_CLASS_MEMBER(GuiWindow)
CLASS_MEMBER_BASE(GuiControlHost)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiWindow)
CLASS_MEMBER_GUIEVENT(ClipboardUpdated)
CLASS_MEMBER_PROPERTY_FAST(MaximizedBox)
CLASS_MEMBER_PROPERTY_FAST(MinimizedBox)
CLASS_MEMBER_PROPERTY_FAST(Border)
CLASS_MEMBER_PROPERTY_FAST(SizeBox)
CLASS_MEMBER_PROPERTY_FAST(IconVisible)
CLASS_MEMBER_PROPERTY_FAST(TitleBar)
CLASS_MEMBER_METHOD(MoveToScreenCenter, NO_PARAMETER)
END_CLASS_MEMBER(GuiWindow)
BEGIN_CLASS_MEMBER(GuiWindow::IStyleController)
CLASS_MEMBER_BASE(GuiControl::IStyleController)
INTERFACE_EXTERNALCTOR(GuiWindow, IStyleController)
CLASS_MEMBER_METHOD(AttachWindow, {L"window"})
CLASS_MEMBER_METHOD(InitializeNativeWindowProperties, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetSizeState, {L"value"})
CLASS_MEMBER_PROPERTY_FAST(MaximizedBox)
CLASS_MEMBER_PROPERTY_FAST(MinimizedBox)
CLASS_MEMBER_PROPERTY_FAST(Border)
CLASS_MEMBER_PROPERTY_FAST(SizeBox)
CLASS_MEMBER_PROPERTY_FAST(IconVisible)
CLASS_MEMBER_PROPERTY_FAST(TitleBar)
CLASS_MEMBER_METHOD(CreateTooltipStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateShortcutKeyStyle, NO_PARAMETER)
END_CLASS_MEMBER(GuiWindow::IStyleController)
BEGIN_CLASS_MEMBER(GuiPopup)
CLASS_MEMBER_BASE(GuiWindow)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiPopup)
CLASS_MEMBER_METHOD(IsClippedByScreen, {L"location"})
CLASS_MEMBER_METHOD_OVERLOAD(ShowPopup, {L"location" _ L"screen"}, void(GuiPopup::*)(Point _ INativeScreen*))
CLASS_MEMBER_METHOD_OVERLOAD(ShowPopup, {L"control" _ L"location"}, void(GuiPopup::*)(GuiControl* _ Point))
CLASS_MEMBER_METHOD_OVERLOAD(ShowPopup, {L"control" _ L"preferredTopBottomSide"}, void(GuiPopup::*)(GuiControl* _ bool))
END_CLASS_MEMBER(GuiPopup)
BEGIN_CLASS_MEMBER(GuiTooltip)
CLASS_MEMBER_BASE(GuiPopup)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiPopup)
CLASS_MEMBER_PROPERTY_FAST(PreferredContentWidth)
CLASS_MEMBER_PROPERTY_FAST(TemporaryContentControl)
END_CLASS_MEMBER(GuiTooltip)
BEGIN_CLASS_MEMBER(GuiListControl)
CLASS_MEMBER_BASE(GuiScrollView)
CLASS_MEMBER_CONSTRUCTOR(GuiListControl*(GuiListControl::IStyleProvider* _ GuiListControl::IItemProvider* _ bool), {L"styleProvider" _ L"itemProvider" _ L"acceptFocus"})
CLASS_MEMBER_GUIEVENT(ItemLeftButtonDown)
CLASS_MEMBER_GUIEVENT(ItemLeftButtonUp)
CLASS_MEMBER_GUIEVENT(ItemLeftButtonDoubleClick)
CLASS_MEMBER_GUIEVENT(ItemMiddleButtonDown)
CLASS_MEMBER_GUIEVENT(ItemMiddleButtonUp)
CLASS_MEMBER_GUIEVENT(ItemMiddleButtonDoubleClick)
CLASS_MEMBER_GUIEVENT(ItemRightButtonDown)
CLASS_MEMBER_GUIEVENT(ItemRightButtonUp)
CLASS_MEMBER_GUIEVENT(ItemRightButtonDoubleClick)
CLASS_MEMBER_GUIEVENT(ItemMouseMove)
CLASS_MEMBER_GUIEVENT(ItemMouseEnter)
CLASS_MEMBER_GUIEVENT(ItemMouseLeave)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ItemProvider)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(StyleProvider)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(Arranger)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(CoordinateTransformer)
CLASS_MEMBER_METHOD(EnsureItemVisible, {L"itemIndex"})
END_CLASS_MEMBER(GuiListControl)
BEGIN_CLASS_MEMBER(GuiListControl::IItemProviderCallback)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(GuiListControl, IItemProviderCallback)
CLASS_MEMBER_METHOD(OnAttached, {L"provider"})
CLASS_MEMBER_METHOD(OnItemModified, {L"start" _ L"count" _ L"newCount"})
END_CLASS_MEMBER(GuiListControl::IItemProviderCallback)
BEGIN_CLASS_MEMBER(GuiListControl::IItemArrangerCallback)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_METHOD(RequestItem, {L"itemIndex"})
CLASS_MEMBER_METHOD(ReleaseItem, {L"style"})
CLASS_MEMBER_METHOD(SetViewLocation, {L"value"})
CLASS_MEMBER_METHOD(GetStylePreferredSize, {L"style"})
CLASS_MEMBER_METHOD(SetStyleAlignmentToParent, {L"style" _ L"margin"})
CLASS_MEMBER_METHOD(GetStyleBounds, {L"style"})
CLASS_MEMBER_METHOD(SetStyleBounds, {L"style" _ L"bounds"})
CLASS_MEMBER_METHOD(GetContainerComposition, NO_PARAMETER)
CLASS_MEMBER_METHOD(OnTotalSizeChanged, NO_PARAMETER)
END_CLASS_MEMBER(GuiListControl::IItemArrangerCallback)
BEGIN_CLASS_MEMBER(GuiListControl::IItemPrimaryTextView)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(GuiListControl, IItemPrimaryTextView)
INTERFACE_IDENTIFIER(GuiListControl::IItemPrimaryTextView)
CLASS_MEMBER_METHOD(GetPrimaryTextViewText, {L"itemIndex"})
CLASS_MEMBER_METHOD(ContainsPrimaryText, {L"itemIndex"})
END_CLASS_MEMBER(GuiListControl::IItemPrimaryTextView)
BEGIN_CLASS_MEMBER(GuiListControl::IItemBindingView)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(GuiListControl, IItemBindingView)
INTERFACE_IDENTIFIER(GuiListControl::IItemBindingView)
CLASS_MEMBER_METHOD(GetBindingValue, {L"itemIndex"})
END_CLASS_MEMBER(GuiListControl::IItemBindingView)
BEGIN_ENUM_ITEM(GuiListControl::KeyDirection)
ENUM_ITEM_NAMESPACE(GuiListControl)
ENUM_NAMESPACE_ITEM(Up)
ENUM_NAMESPACE_ITEM(Down)
ENUM_NAMESPACE_ITEM(Left)
ENUM_NAMESPACE_ITEM(Right)
ENUM_NAMESPACE_ITEM(Home)
ENUM_NAMESPACE_ITEM(End)
ENUM_NAMESPACE_ITEM(PageUp)
ENUM_NAMESPACE_ITEM(PageDown)
ENUM_NAMESPACE_ITEM(PageLeft)
ENUM_NAMESPACE_ITEM(PageRight)
END_ENUM_ITEM(GuiListControl::KeyDirection)
BEGIN_CLASS_MEMBER(GuiListControl::IItemProvider)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(GuiListControl, IItemProvider)
CLASS_MEMBER_METHOD(AttachCallback, {L"value"})
CLASS_MEMBER_METHOD(DetachCallback, {L"value"})
CLASS_MEMBER_METHOD(Count, NO_PARAMETER)
CLASS_MEMBER_METHOD(RequestView, {L"identifier"})
CLASS_MEMBER_METHOD(ReleaseView, {L"view"})
END_CLASS_MEMBER(GuiListControl::IItemProvider)
BEGIN_CLASS_MEMBER(GuiListControl::IItemStyleController)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(GuiListControl, IItemProvider)
CLASS_MEMBER_PROPERTY_READONLY_FAST(StyleProvider)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ItemStyleId)
CLASS_MEMBER_PROPERTY_READONLY_FAST(BoundsComposition)
CLASS_MEMBER_METHOD(IsCacheable, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsInstalled, NO_PARAMETER)
CLASS_MEMBER_METHOD(OnInstalled, NO_PARAMETER)
CLASS_MEMBER_METHOD(OnUninstalled, NO_PARAMETER)
END_CLASS_MEMBER(GuiListControl::IItemStyleController)
BEGIN_CLASS_MEMBER(GuiListControl::IItemStyleProvider)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(GuiListControl, IItemStyleProvider)
CLASS_MEMBER_METHOD(AttachListControl, {L"value"})
CLASS_MEMBER_METHOD(DetachListControl, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetItemStyleId, {L"itemIndex"})
CLASS_MEMBER_METHOD(CreateItemStyle, {L"styleId"})
CLASS_MEMBER_METHOD(DestroyItemStyle, {L"style"})
CLASS_MEMBER_METHOD(Install, {L"style" _ L"itemIndex"})
END_CLASS_MEMBER(GuiListControl::IItemStyleProvider)
BEGIN_CLASS_MEMBER(GuiListControl::IItemArranger)
CLASS_MEMBER_BASE(GuiListControl::IItemProviderCallback)
INTERFACE_EXTERNALCTOR(GuiListControl, IItemArranger)
CLASS_MEMBER_PROPERTY_FAST(Callback)
CLASS_MEMBER_PROPERTY_READONLY_FAST(TotalSize)
CLASS_MEMBER_METHOD(AttachListControl, {L"value"})
CLASS_MEMBER_METHOD(DetachListControl, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetVisibleStyle, {L"itemIndex"})
CLASS_MEMBER_METHOD(GetVisibleIndex, {L"style"})
CLASS_MEMBER_METHOD(OnViewChanged, {L"bounds"})
CLASS_MEMBER_METHOD(FindItem, {L"itemIndex" _ L"key"})
CLASS_MEMBER_METHOD(EnsureItemVisible, {L"itemIndex"})
END_CLASS_MEMBER(GuiListControl::IItemArranger)
BEGIN_CLASS_MEMBER(GuiListControl::IItemCoordinateTransformer)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(GuiListControl, IItemCoordinateTransformer)
CLASS_MEMBER_METHOD(RealSizeToVirtualSize, {L"size"})
CLASS_MEMBER_METHOD(VirtualSizeToRealSize, {L"size"})
CLASS_MEMBER_METHOD(RealPointToVirtualPoint, {L"realFullSize" _ L"point"})
CLASS_MEMBER_METHOD(VirtualPointToRealPoint, {L"realFullSize" _ L"point"})
CLASS_MEMBER_METHOD(RealRectToVirtualRect, {L"realFullSize" _ L"rect"})
CLASS_MEMBER_METHOD(VirtualRectToRealRect, {L"realFullSize" _ L"rect"})
CLASS_MEMBER_METHOD(RealMarginToVirtualMargin, {L"margin"})
CLASS_MEMBER_METHOD(VirtualMarginToRealMargin, {L"margin"})
CLASS_MEMBER_METHOD(RealKeyDirectionToVirtualKeyDirection, {L"key"})
END_CLASS_MEMBER(GuiListControl::IItemCoordinateTransformer)
BEGIN_CLASS_MEMBER(GuiSelectableListControl)
CLASS_MEMBER_BASE(GuiListControl)
CLASS_MEMBER_CONSTRUCTOR(GuiSelectableListControl*(GuiSelectableListControl::IStyleProvider* _ GuiSelectableListControl::IItemProvider*), {L"styleProvider" _ L"itemProvider"})
CLASS_MEMBER_GUIEVENT(SelectionChanged)
CLASS_MEMBER_PROPERTY_FAST(MultiSelect)
CLASS_MEMBER_PROPERTY_EVENT_READONLY_FAST(SelectedItems, SelectionChanged)
CLASS_MEMBER_PROPERTY_EVENT_READONLY_FAST(SelectedItemIndex, SelectionChanged)
CLASS_MEMBER_PROPERTY_EVENT_READONLY_FAST(SelectedItemText, SelectionChanged)
CLASS_MEMBER_METHOD(GetSelected, {L"itemIndex"})
CLASS_MEMBER_METHOD(SetSelected, {L"itemIndex" _ L"value"})
CLASS_MEMBER_METHOD(SelectItemsByClick, {L"itemIndex" _ L"ctrl" _ L"shift" _ L"leftButton"})
CLASS_MEMBER_METHOD(SelectItemsByKey, {L"code" _ L"ctrl" _ L"shift"})
CLASS_MEMBER_METHOD(ClearSelection, NO_PARAMETER)
END_CLASS_MEMBER(GuiSelectableListControl)
BEGIN_CLASS_MEMBER(GuiSelectableListControl::IItemStyleProvider)
CLASS_MEMBER_BASE(GuiListControl::IItemStyleProvider)
INTERFACE_EXTERNALCTOR(GuiSelectableListControl, IItemStyleProvider)
CLASS_MEMBER_METHOD(SetStyleSelected, {L"style" _ L"value"})
END_CLASS_MEMBER(GuiSelectableListControl::IItemStyleProvider)
BEGIN_CLASS_MEMBER(DefaultItemCoordinateTransformer)
CLASS_MEMBER_BASE(GuiListControl::IItemCoordinateTransformer)
CLASS_MEMBER_CONSTRUCTOR(Ptr<DefaultItemCoordinateTransformer>(), NO_PARAMETER)
END_CLASS_MEMBER(DefaultItemCoordinateTransformer)
BEGIN_CLASS_MEMBER(AxisAlignedItemCoordinateTransformer)
CLASS_MEMBER_BASE(GuiListControl::IItemCoordinateTransformer)
CLASS_MEMBER_CONSTRUCTOR(Ptr<AxisAlignedItemCoordinateTransformer>(AxisAlignedItemCoordinateTransformer::Alignment), {L"alignment"})
CLASS_MEMBER_PROPERTY_READONLY_FAST(Alignment)
END_CLASS_MEMBER(AxisAlignedItemCoordinateTransformer)
BEGIN_ENUM_ITEM(AxisAlignedItemCoordinateTransformer::Alignment)
ENUM_ITEM_NAMESPACE(AxisAlignedItemCoordinateTransformer)
ENUM_NAMESPACE_ITEM(LeftDown)
ENUM_NAMESPACE_ITEM(RightDown)
ENUM_NAMESPACE_ITEM(LeftUp)
ENUM_NAMESPACE_ITEM(RightUp)
ENUM_NAMESPACE_ITEM(DownLeft)
ENUM_NAMESPACE_ITEM(DownRight)
ENUM_NAMESPACE_ITEM(UpLeft)
ENUM_NAMESPACE_ITEM(UpRight)
END_ENUM_ITEM(AxisAlignedItemCoordinateTransformer::Alignment)
BEGIN_CLASS_MEMBER(RangedItemArrangerBase)
CLASS_MEMBER_BASE(GuiListControl::IItemArranger)
END_CLASS_MEMBER(RangedItemArrangerBase)
BEGIN_CLASS_MEMBER(FixedHeightItemArranger)
CLASS_MEMBER_BASE(RangedItemArrangerBase)
CLASS_MEMBER_CONSTRUCTOR(Ptr<FixedHeightItemArranger>(), NO_PARAMETER)
END_CLASS_MEMBER(FixedHeightItemArranger)
BEGIN_CLASS_MEMBER(FixedSizeMultiColumnItemArranger)
CLASS_MEMBER_BASE(RangedItemArrangerBase)
CLASS_MEMBER_CONSTRUCTOR(Ptr<FixedSizeMultiColumnItemArranger>(), NO_PARAMETER)
END_CLASS_MEMBER(FixedSizeMultiColumnItemArranger)
BEGIN_CLASS_MEMBER(FixedHeightMultiColumnItemArranger)
CLASS_MEMBER_BASE(RangedItemArrangerBase)
CLASS_MEMBER_CONSTRUCTOR(Ptr<FixedHeightMultiColumnItemArranger>(), NO_PARAMETER)
END_CLASS_MEMBER(FixedHeightMultiColumnItemArranger)
BEGIN_CLASS_MEMBER(ItemStyleControllerBase)
CLASS_MEMBER_BASE(GuiListControl::IItemStyleController)
END_CLASS_MEMBER(ItemStyleControllerBase)
BEGIN_CLASS_MEMBER(TextItemStyleProvider)
CLASS_MEMBER_BASE(GuiSelectableListControl::IItemStyleProvider)
CLASS_MEMBER_CONSTRUCTOR(Ptr<TextItemStyleProvider>(TextItemStyleProvider::ITextItemStyleProvider*), {L"textItemStyleProvider"})
END_CLASS_MEMBER(TextItemStyleProvider)
BEGIN_CLASS_MEMBER(TextItemStyleProvider::ITextItemStyleProvider)
INTERFACE_EXTERNALCTOR(TextItemStyleProvider, ITextItemStyleProvider)
CLASS_MEMBER_METHOD(CreateBackgroundStyleController, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateBulletStyleController, NO_PARAMETER)
CLASS_MEMBER_PROPERTY_READONLY_FAST(TextColor)
END_CLASS_MEMBER(TextItemStyleProvider::ITextItemStyleProvider)
BEGIN_CLASS_MEMBER(TextItemStyleProvider::ITextItemView)
CLASS_MEMBER_BASE(GuiListControl::IItemPrimaryTextView)
INTERFACE_EXTERNALCTOR(TextItemStyleProvider, ITextItemView)
INTERFACE_IDENTIFIER(TextItemStyleProvider::ITextItemView)
CLASS_MEMBER_METHOD(GetText, {L"itemIndex"})
CLASS_MEMBER_METHOD(GetChecked, {L"itemIndex"})
CLASS_MEMBER_METHOD(SetCheckedSilently, {L"itemIndex" _ L"value"})
END_CLASS_MEMBER(TextItemStyleProvider::ITextItemView)
BEGIN_CLASS_MEMBER(TextItemStyleProvider::TextItemStyleController)
CLASS_MEMBER_BASE(ItemStyleControllerBase)
CLASS_MEMBER_CONSTRUCTOR(TextItemStyleProvider::TextItemStyleController*(TextItemStyleProvider*), {L"provider"})
CLASS_MEMBER_PROPERTY_FAST(Selected)
CLASS_MEMBER_PROPERTY_FAST(Checked)
CLASS_MEMBER_PROPERTY_FAST(Text)
END_CLASS_MEMBER(TextItemStyleProvider::TextItemStyleController)
BEGIN_CLASS_MEMBER(TextItem)
CLASS_MEMBER_CONSTRUCTOR(Ptr<TextItem>(), NO_PARAMETER)
CLASS_MEMBER_CONSTRUCTOR(Ptr<TextItem>(const WString&), {L"text"})
CLASS_MEMBER_CONSTRUCTOR(Ptr<TextItem>(const WString&, bool), {L"text" _ L"checked"})
CLASS_MEMBER_PROPERTY_FAST(Text)
CLASS_MEMBER_PROPERTY_FAST(Checked)
END_CLASS_MEMBER(TextItem)
BEGIN_CLASS_MEMBER(GuiVirtualTextList)
CLASS_MEMBER_BASE(GuiSelectableListControl)
CLASS_MEMBER_CONSTRUCTOR(GuiVirtualTextList*(GuiSelectableListControl::IStyleProvider* _ TextItemStyleProvider::ITextItemStyleProvider* _ GuiListControl::IItemProvider*), {L"styleProvider" _ L"itemStyleProvider" _ L"itemProvider"})
CLASS_MEMBER_GUIEVENT(ItemChecked)
CLASS_MEMBER_METHOD(ChangeItemStyle, {L"itemStyleProvider"})
END_CLASS_MEMBER(GuiVirtualTextList)
BEGIN_CLASS_MEMBER(GuiTextList)
CLASS_MEMBER_BASE(GuiVirtualTextList)
CLASS_MEMBER_CONSTRUCTOR(GuiTextList*(GuiSelectableListControl::IStyleProvider* _ TextItemStyleProvider::ITextItemStyleProvider*), {L"styleProvider" _ L"itemStyleProvider"})
CLASS_MEMBER_PROPERTY_READONLY_FAST(Items)
CLASS_MEMBER_PROPERTY_EVENT_READONLY_FAST(SelectedItem, SelectionChanged)
END_CLASS_MEMBER(GuiTextList)
BEGIN_CLASS_MEMBER(ListViewItemStyleProviderBase)
CLASS_MEMBER_BASE(GuiSelectableListControl::IItemStyleProvider)
END_CLASS_MEMBER(ListViewItemStyleProviderBase)
BEGIN_CLASS_MEMBER(ListViewItemStyleProviderBase::ListViewItemStyleController)
CLASS_MEMBER_BASE(ItemStyleControllerBase)
CLASS_MEMBER_CONSTRUCTOR(ListViewItemStyleProviderBase::ListViewItemStyleController*(ListViewItemStyleProviderBase*), {L"provider"})
CLASS_MEMBER_PROPERTY_FAST(Selected)
END_CLASS_MEMBER(ListViewItemStyleProviderBase::ListViewItemStyleController)
BEGIN_CLASS_MEMBER(GuiListViewColumnHeader)
CLASS_MEMBER_BASE(GuiMenuButton)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiListViewColumnHeader)
CLASS_MEMBER_PROPERTY_FAST(ColumnSortingState)
END_CLASS_MEMBER(GuiListViewColumnHeader)
BEGIN_ENUM_ITEM(GuiListViewColumnHeader::ColumnSortingState)
ENUM_ITEM_NAMESPACE(GuiListViewColumnHeader)
ENUM_NAMESPACE_ITEM(NotSorted)
ENUM_NAMESPACE_ITEM(Ascending)
ENUM_NAMESPACE_ITEM(Descending)
END_ENUM_ITEM(GuiListViewColumnHeader::ColumnSortingState)
BEGIN_CLASS_MEMBER(GuiListViewColumnHeader::IStyleController)
CLASS_MEMBER_BASE(GuiMenuButton::IStyleController)
INTERFACE_EXTERNALCTOR(GuiListViewColumnHeader, IStyleController)
CLASS_MEMBER_METHOD(SetColumnSortingState, {L"value"})
END_CLASS_MEMBER(GuiListViewColumnHeader::IStyleController)
BEGIN_CLASS_MEMBER(GuiListViewBase)
CLASS_MEMBER_BASE(GuiSelectableListControl)
CLASS_MEMBER_CONSTRUCTOR(GuiListViewBase*(GuiListViewBase::IStyleProvider* _ GuiListControl::IItemProvider*), {L"styleProvider" _ L"itemProvider"})
CLASS_MEMBER_GUIEVENT(ColumnClicked)
CLASS_MEMBER_METHOD(GetListViewStyleProvider, NO_PARAMETER)
END_CLASS_MEMBER(GuiListViewBase)
BEGIN_CLASS_MEMBER(GuiListViewBase::IStyleProvider)
CLASS_MEMBER_BASE(GuiSelectableListControl::IStyleProvider)
INTERFACE_EXTERNALCTOR(GuiListViewBase, IStyleProvider)
CLASS_MEMBER_PROPERTY_READONLY_FAST(PrimaryTextColor)
CLASS_MEMBER_PROPERTY_READONLY_FAST(SecondaryTextColor)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ItemSeparatorColor)
CLASS_MEMBER_METHOD(CreateItemBackground, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateColumnStyle, NO_PARAMETER)
END_CLASS_MEMBER(GuiListViewBase::IStyleProvider)
BEGIN_CLASS_MEMBER(ListViewItemStyleProvider)
CLASS_MEMBER_BASE(ListViewItemStyleProviderBase)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewItemStyleProvider>(Ptr<ListViewItemStyleProvider::IListViewItemContentProvider>), {L"itemContentProvider"})
CLASS_MEMBER_PROPERTY_READONLY_FAST(ItemContentProvider)
CLASS_MEMBER_PROPERTY_READONLY_FAST(CreatedItemStyles)
CLASS_MEMBER_METHOD(IsItemStyleAttachedToListView, {L"itemStyle"})
CLASS_MEMBER_METHOD(GetItemContentFromItemStyleController, {L"itemStyleController"})
CLASS_MEMBER_METHOD(GetItemStyleControllerFromItemContent, {L"itemContent"})
CLASS_MEMBER_EXTERNALMETHOD(GetItemContent, {L"itemStyleController"}, ListViewItemStyleProvider::IListViewItemContent*(ListViewItemStyleProvider::*)(GuiListControl::IItemStyleController*), &ListViewItemStyleProvider_GetItemContent)
END_CLASS_MEMBER(ListViewItemStyleProvider)
BEGIN_CLASS_MEMBER(ListViewItemStyleProvider::IListViewItemView)
CLASS_MEMBER_BASE(GuiListControl::IItemPrimaryTextView)
INTERFACE_EXTERNALCTOR(ListViewItemStyleProvider, IListViewItemView)
INTERFACE_IDENTIFIER(ListViewItemStyleProvider::IListViewItemView)
CLASS_MEMBER_METHOD(GetSmallImage, {L"itemIndex"})
CLASS_MEMBER_METHOD(GetLargeImage, {L"itemIndex"})
CLASS_MEMBER_METHOD(GetText, {L"itemIndex"})
CLASS_MEMBER_METHOD(GetSubItem, {L"itemIndex" _ L"index"})
CLASS_MEMBER_METHOD(GetDataColumnCount, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetDataColumn, {L"index"})
CLASS_MEMBER_METHOD(GetColumnCount, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetColumnText, {L"index"})
END_CLASS_MEMBER(ListViewItemStyleProvider::IListViewItemView)
BEGIN_CLASS_MEMBER(ListViewItemStyleProvider::IListViewItemContent)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(ListViewItemStyleProvider, IListViewItemContent)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ContentComposition)
CLASS_MEMBER_PROPERTY_READONLY_FAST(BackgroundDecorator)
CLASS_MEMBER_METHOD(Install, {L"styleProvider" _ L"view" _ L"itemIndex"})
END_CLASS_MEMBER(ListViewItemStyleProvider::IListViewItemContent)
BEGIN_CLASS_MEMBER(ListViewItemStyleProvider::IListViewItemContentProvider)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(ListViewItemStyleProvider, IListViewItemContentProvider)
CLASS_MEMBER_METHOD(CreatePreferredCoordinateTransformer, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreatePreferredArranger, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateItemContent, {L"font"})
CLASS_MEMBER_METHOD(AttachListControl, {L"value"})
CLASS_MEMBER_METHOD(DetachListControl, NO_PARAMETER)
END_CLASS_MEMBER(ListViewItemStyleProvider::IListViewItemContentProvider)
BEGIN_CLASS_MEMBER(ListViewItemStyleProvider::ListViewContentItemStyleController)
CLASS_MEMBER_BASE(ListViewItemStyleProviderBase::ListViewItemStyleController)
CLASS_MEMBER_CONSTRUCTOR(ListViewItemStyleProvider::ListViewContentItemStyleController*(ListViewItemStyleProvider*), {L"provider"})
CLASS_MEMBER_PROPERTY_READONLY_FAST(ItemContent)
CLASS_MEMBER_METHOD(Install, {L"view" _ L"itemIndex"})
END_CLASS_MEMBER(ListViewItemStyleProvider::ListViewContentItemStyleController)
BEGIN_CLASS_MEMBER(ListViewBigIconContentProvider)
CLASS_MEMBER_BASE(ListViewItemStyleProvider::IListViewItemContentProvider)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewBigIconContentProvider>(), NO_PARAMETER)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewBigIconContentProvider>(Size, bool), {L"minIconSize" _ L"fitImage"})
END_CLASS_MEMBER(ListViewBigIconContentProvider)
BEGIN_CLASS_MEMBER(ListViewSmallIconContentProvider)
CLASS_MEMBER_BASE(ListViewItemStyleProvider::IListViewItemContentProvider)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewSmallIconContentProvider>(), NO_PARAMETER)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewSmallIconContentProvider>(Size, bool), {L"minIconSize" _ L"fitImage"})
END_CLASS_MEMBER(ListViewSmallIconContentProvider)
BEGIN_CLASS_MEMBER(ListViewListContentProvider)
CLASS_MEMBER_BASE(ListViewItemStyleProvider::IListViewItemContentProvider)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewListContentProvider>(), NO_PARAMETER)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewListContentProvider>(Size, bool), {L"minIconSize" _ L"fitImage"})
END_CLASS_MEMBER(ListViewListContentProvider)
BEGIN_CLASS_MEMBER(ListViewTileContentProvider)
CLASS_MEMBER_BASE(ListViewItemStyleProvider::IListViewItemContentProvider)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewTileContentProvider>(), NO_PARAMETER)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewTileContentProvider>(Size, bool), {L"minIconSize" _ L"fitImage"})
END_CLASS_MEMBER(ListViewTileContentProvider)
BEGIN_CLASS_MEMBER(ListViewInformationContentProvider)
CLASS_MEMBER_BASE(ListViewItemStyleProvider::IListViewItemContentProvider)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewInformationContentProvider>(), NO_PARAMETER)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewInformationContentProvider>(Size, bool), {L"minIconSize" _ L"fitImage"})
END_CLASS_MEMBER(ListViewInformationContentProvider)
BEGIN_CLASS_MEMBER(ListViewColumnItemArranger)
CLASS_MEMBER_BASE(FixedHeightItemArranger)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewColumnItemArranger>(), NO_PARAMETER)
END_CLASS_MEMBER(ListViewColumnItemArranger)
BEGIN_CLASS_MEMBER(ListViewColumnItemArranger::IColumnItemViewCallback)
CLASS_MEMBER_METHOD(OnColumnChanged, NO_PARAMETER)
END_CLASS_MEMBER(ListViewColumnItemArranger::IColumnItemViewCallback)
BEGIN_CLASS_MEMBER(ListViewColumnItemArranger::IColumnItemView)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(ListViewColumnItemArranger, IColumnItemView)
INTERFACE_IDENTIFIER(ListViewColumnItemArranger::IColumnItemView)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ColumnCount)
CLASS_MEMBER_METHOD(AttachCallback, {L"value"})
CLASS_MEMBER_METHOD(DetachCallback, {L"value"})
CLASS_MEMBER_METHOD(GetColumnText, {L"index"})
CLASS_MEMBER_METHOD(GetColumnSize, {L"index"})
CLASS_MEMBER_METHOD(SetColumnSize, {L"index" _ L"value"})
CLASS_MEMBER_METHOD(GetDropdownPopup, {L"index"})
CLASS_MEMBER_METHOD(GetSortingState, {L"index"})
END_CLASS_MEMBER(ListViewColumnItemArranger::IColumnItemView)
BEGIN_CLASS_MEMBER(ListViewDetailContentProvider)
CLASS_MEMBER_BASE(ListViewItemStyleProvider::IListViewItemContentProvider)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewDetailContentProvider>(), NO_PARAMETER)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewDetailContentProvider>(Size, bool), {L"minIconSize" _ L"fitImage"})
END_CLASS_MEMBER(ListViewDetailContentProvider)
BEGIN_CLASS_MEMBER(ListViewItem)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewItem>(), NO_PARAMETER)
CLASS_MEMBER_PROPERTY_FAST(SmallImage)
CLASS_MEMBER_PROPERTY_FAST(LargeImage)
CLASS_MEMBER_PROPERTY_FAST(Text)
CLASS_MEMBER_PROPERTY_READONLY_FAST(SubItems)
CLASS_MEMBER_PROPERTY_FAST(Tag)
END_CLASS_MEMBER(ListViewItem)
BEGIN_CLASS_MEMBER(ListViewColumn)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewColumn>(), NO_PARAMETER)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewColumn>(const WString&), {L"text"})
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewColumn>(const WString&, vint), {L"text" _ L"size"})
CLASS_MEMBER_PROPERTY_FAST(Text)
CLASS_MEMBER_PROPERTY_FAST(TextProperty)
CLASS_MEMBER_PROPERTY_FAST(Size)
CLASS_MEMBER_PROPERTY_FAST(DropdownPopup)
CLASS_MEMBER_PROPERTY_FAST(SortingState)
END_CLASS_MEMBER(ListViewColumn)
BEGIN_CLASS_MEMBER(GuiVirtualListView)
CLASS_MEMBER_BASE(GuiListViewBase)
CLASS_MEMBER_CONSTRUCTOR(GuiVirtualListView*(GuiVirtualListView::IStyleProvider* _ GuiListControl::IItemProvider*), {L"styleProvider" _ L"itemProvider"})
CLASS_MEMBER_METHOD(ChangeItemStyle, {L"contentProvider"})
END_CLASS_MEMBER(GuiVirtualListView)
BEGIN_CLASS_MEMBER(GuiListView)
CLASS_MEMBER_BASE(GuiVirtualListView)
CONTROL_CONSTRUCTOR_PROVIDER(GuiListView)
CLASS_MEMBER_PROPERTY_READONLY_FAST(DataColumns)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Columns)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Items)
CLASS_MEMBER_PROPERTY_EVENT_READONLY_FAST(SelectedItem, SelectionChanged)
END_CLASS_MEMBER(GuiListView)
BEGIN_CLASS_MEMBER(IGuiMenuService)
INTERFACE_IDENTIFIER(IGuiMenuService)
CLASS_MEMBER_METHOD(GetParentMenuService, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetPreferredDirection, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsActiveState, NO_PARAMETER)
CLASS_MEMBER_METHOD(IsSubMenuActivatedByMouseDown, NO_PARAMETER)
CLASS_MEMBER_METHOD(MenuItemExecuted, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetOpeningMenu, NO_PARAMETER)
CLASS_MEMBER_METHOD(MenuOpened, {L"menu"})
CLASS_MEMBER_METHOD(MenuClosed, {L"menu"})
END_CLASS_MEMBER(IGuiMenuService)
BEGIN_ENUM_ITEM(IGuiMenuService::Direction)
ENUM_ITEM_NAMESPACE(IGuiMenuService)
ENUM_NAMESPACE_ITEM(Horizontal)
ENUM_NAMESPACE_ITEM(Vertical)
END_ENUM_ITEM(IGuiMenuService::Direction)
BEGIN_CLASS_MEMBER(GuiMenu)
CLASS_MEMBER_BASE(GuiPopup)
CLASS_MEMBER_CONSTRUCTOR(GuiMenu*(GuiMenu::IStyleController* _ GuiControl*), {L"styleController" _ L"owner"})
CLASS_MEMBER_METHOD(UpdateMenuService, NO_PARAMETER)
CLASS_MEMBER_METHOD(QueryService, {L"identifier"})
END_CLASS_MEMBER(GuiMenu)
BEGIN_CLASS_MEMBER(GuiMenuBar)
CLASS_MEMBER_BASE(GuiControl)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiMenuBar)
END_CLASS_MEMBER(GuiMenuBar)
BEGIN_CLASS_MEMBER(GuiMenuButton)
CLASS_MEMBER_BASE(GuiSelectableButton)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiMenuButton)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(Image)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(ShortcutText)
CLASS_MEMBER_PROPERTY_READONLY_FAST(SubMenu)
CLASS_MEMBER_PROPERTY_READONLY_FAST(OwnedSubMenu)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(SubMenuOpening)
CLASS_MEMBER_PROPERTY_FAST(PreferredMenuClientSize)
CLASS_MEMBER_PROPERTY_FAST(CascadeAction)
CLASS_MEMBER_METHOD(IsSubMenuExists, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateSubMenu, {L"subMenuStyleController"})
CLASS_MEMBER_METHOD(SetSubMenu, {L"value" _ L"owned"})
END_CLASS_MEMBER(GuiMenuButton)
BEGIN_CLASS_MEMBER(GuiMenuButton::IStyleController)
CLASS_MEMBER_BASE(GuiSelectableButton::IStyleController)
INTERFACE_EXTERNALCTOR(GuiMenuButton, IStyleController)
CLASS_MEMBER_METHOD(CreateSubMenuStyleController, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetSubMenuExisting, {L"value"})
CLASS_MEMBER_METHOD(SetSubMenuOpening, {L"value"})
CLASS_MEMBER_METHOD(GetSubMenuHost, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetImage, {L"value"})
CLASS_MEMBER_METHOD(SetShortcutText, {L"value"})
END_CLASS_MEMBER(GuiMenuButton::IStyleController)
BEGIN_CLASS_MEMBER(INodeProviderCallback)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_METHOD(OnAttached, {L"provider"})
CLASS_MEMBER_METHOD(OnBeforeItemModified, {L"parentNode" _ L"start" _ L"count" _ L"newCount"})
CLASS_MEMBER_METHOD(OnAfterItemModified, {L"parentNode" _ L"start" _ L"count" _ L"newCount"})
CLASS_MEMBER_METHOD(OnItemExpanded, {L"node"})
CLASS_MEMBER_METHOD(OnItemCollapsed, {L"node"})
END_CLASS_MEMBER(INodeProviderCallback)
BEGIN_CLASS_MEMBER(INodeProvider)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(tree, INodeProvider)
CLASS_MEMBER_PROPERTY_FAST(Expanding)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ChildCount)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Parent)
CLASS_MEMBER_METHOD(CalculateTotalVisibleNodes, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetChild, {L"index"})
CLASS_MEMBER_METHOD(Increase, NO_PARAMETER)
CLASS_MEMBER_METHOD(Release, NO_PARAMETER)
END_CLASS_MEMBER(INodeProvider)
BEGIN_CLASS_MEMBER(INodeRootProvider)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(tree, INodeRootProvider)
CLASS_MEMBER_PROPERTY_READONLY_FAST(RootNode)
CLASS_MEMBER_METHOD(CanGetNodeByVisibleIndex, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetNodeByVisibleIndex, {L"index"})
CLASS_MEMBER_METHOD(AttachCallback, {L"value"})
CLASS_MEMBER_METHOD(DetachCallback, {L"value"})
CLASS_MEMBER_METHOD(RequestView, {L"identifier"})
CLASS_MEMBER_METHOD(ReleaseView, {L"value"})
END_CLASS_MEMBER(INodeRootProvider)
BEGIN_CLASS_MEMBER(INodeItemView)
CLASS_MEMBER_BASE(GuiListControl::IItemPrimaryTextView)
INTERFACE_EXTERNALCTOR(tree, INodeItemView)
INTERFACE_IDENTIFIER(INodeItemView)
CLASS_MEMBER_METHOD(RequestNode, {L"index"})
CLASS_MEMBER_METHOD(ReleaseNode, {L"node"})
CLASS_MEMBER_METHOD(CalculateNodeVisibilityIndex, {L"node"})
END_CLASS_MEMBER(INodeItemView)
BEGIN_CLASS_MEMBER(INodeItemPrimaryTextView)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(tree, INodeItemPrimaryTextView)
INTERFACE_IDENTIFIER(INodeItemPrimaryTextView)
CLASS_MEMBER_METHOD(GetPrimaryTextViewText, {L"node"})
END_CLASS_MEMBER(INodeItemPrimaryTextView)
BEGIN_CLASS_MEMBER(INodeItemBindingView)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(tree, INodeItemBindingView)
INTERFACE_IDENTIFIER(INodeItemBindingView)
CLASS_MEMBER_METHOD(GetBindingValue, {L"node"})
END_CLASS_MEMBER(INodeItemBindingView)
BEGIN_CLASS_MEMBER(INodeItemStyleController)
CLASS_MEMBER_BASE(GuiListControl::IItemStyleController)
INTERFACE_EXTERNALCTOR(tree, INodeItemStyleController)
CLASS_MEMBER_METHOD(GetNodeStyleProvider, NO_PARAMETER)
END_CLASS_MEMBER(INodeItemStyleController)
BEGIN_CLASS_MEMBER(INodeItemStyleProvider)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(tree, INodeItemStyleProvider)
CLASS_MEMBER_PROPERTY_READONLY_FAST(BindedItemStyleProvider)
CLASS_MEMBER_METHOD(BindItemStyleProvider, {L"styleProvider"})
CLASS_MEMBER_METHOD(AttachListControl, {L"value"})
CLASS_MEMBER_METHOD(DetachListControl, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetItemStyleId, {L"node"})
CLASS_MEMBER_METHOD(CreateItemStyle, {L"styleId"})
CLASS_MEMBER_METHOD(DestroyItemStyle, {L"style"})
CLASS_MEMBER_METHOD(Install, {L"style" _ L"node" _ L"index"})
CLASS_MEMBER_METHOD(SetStyleIndex, {L"style" _ L"value"})
CLASS_MEMBER_METHOD(SetStyleSelected, {L"style" _ L"value"})
END_CLASS_MEMBER(INodeItemStyleProvider)
BEGIN_CLASS_MEMBER(NodeItemStyleProvider)
CLASS_MEMBER_BASE(GuiSelectableListControl::IItemStyleProvider)
CLASS_MEMBER_CONSTRUCTOR(Ptr<NodeItemStyleProvider>(Ptr<INodeItemStyleProvider>), {L"provider"})
END_CLASS_MEMBER(NodeItemStyleProvider)
BEGIN_CLASS_MEMBER(IMemoryNodeData)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(tree, IMemoryNodeData)
END_CLASS_MEMBER(IMemoryNodeData)
BEGIN_CLASS_MEMBER(MemoryNodeProvider)
CLASS_MEMBER_BASE(INodeProvider)
CLASS_MEMBER_CONSTRUCTOR(Ptr<MemoryNodeProvider>(), NO_PARAMETER)
CLASS_MEMBER_CONSTRUCTOR(Ptr<MemoryNodeProvider>(Ptr<IMemoryNodeData>), {L"data"})
CLASS_MEMBER_PROPERTY_FAST(Data)
CLASS_MEMBER_METHOD(NotifyDataModified, NO_PARAMETER)
CLASS_MEMBER_METHOD_RENAME(GetChildren, Children, NO_PARAMETER)
CLASS_MEMBER_PROPERTY_READONLY(Children, GetChildren)
END_CLASS_MEMBER(MemoryNodeProvider)
BEGIN_CLASS_MEMBER(NodeRootProviderBase)
CLASS_MEMBER_BASE(INodeRootProvider)
END_CLASS_MEMBER(NodeRootProviderBase)
BEGIN_CLASS_MEMBER(MemoryNodeRootProvider)
CLASS_MEMBER_BASE(MemoryNodeProvider)
CLASS_MEMBER_BASE(NodeRootProviderBase)
CLASS_MEMBER_CONSTRUCTOR(Ptr<MemoryNodeRootProvider>(), NO_PARAMETER)
CLASS_MEMBER_PROPERTY_READONLY_FAST(RootNode)
CLASS_MEMBER_METHOD(GetMemoryNode, {L"node"})
END_CLASS_MEMBER(MemoryNodeRootProvider)
BEGIN_CLASS_MEMBER(GuiVirtualTreeListControl)
CLASS_MEMBER_BASE(GuiSelectableListControl)
CLASS_MEMBER_CONSTRUCTOR(GuiVirtualTreeListControl*(GuiVirtualTreeListControl::IStyleProvider* _ Ptr<INodeRootProvider>), {L"styleProvider" _ L"rootNodeProvider"})
CLASS_MEMBER_GUIEVENT(NodeLeftButtonDown)
CLASS_MEMBER_GUIEVENT(NodeLeftButtonUp)
CLASS_MEMBER_GUIEVENT(NodeLeftButtonDoubleClick)
CLASS_MEMBER_GUIEVENT(NodeMiddleButtonDown)
CLASS_MEMBER_GUIEVENT(NodeMiddleButtonUp)
CLASS_MEMBER_GUIEVENT(NodeMiddleButtonDoubleClick)
CLASS_MEMBER_GUIEVENT(NodeRightButtonDown)
CLASS_MEMBER_GUIEVENT(NodeRightButtonUp)
CLASS_MEMBER_GUIEVENT(NodeRightButtonDoubleClick)
CLASS_MEMBER_GUIEVENT(NodeMouseMove)
CLASS_MEMBER_GUIEVENT(NodeMouseEnter)
CLASS_MEMBER_GUIEVENT(NodeMouseLeave)
CLASS_MEMBER_GUIEVENT(NodeExpanded)
CLASS_MEMBER_GUIEVENT(NodeCollapsed)
CLASS_MEMBER_PROPERTY_READONLY_FAST(NodeItemView)
CLASS_MEMBER_PROPERTY_READONLY_FAST(NodeRootProvider)
CLASS_MEMBER_PROPERTY_FAST(NodeStyleProvider)
END_CLASS_MEMBER(GuiVirtualTreeListControl)
BEGIN_CLASS_MEMBER(ITreeViewItemView)
CLASS_MEMBER_BASE(INodeItemPrimaryTextView)
INTERFACE_EXTERNALCTOR(tree, ITreeViewItemView)
INTERFACE_IDENTIFIER(ITreeViewItemView)
CLASS_MEMBER_METHOD(GetNodeImage, {L"node"})
CLASS_MEMBER_METHOD(GetNodeText, {L"node"})
END_CLASS_MEMBER(ITreeViewItemView)
BEGIN_CLASS_MEMBER(TreeViewItem)
CLASS_MEMBER_BASE(IMemoryNodeData)
CLASS_MEMBER_CONSTRUCTOR(Ptr<TreeViewItem>(), NO_PARAMETER)
CLASS_MEMBER_CONSTRUCTOR(Ptr<TreeViewItem>(const Ptr<GuiImageData>&, const WString&), {L"image" _ L"text"})
CLASS_MEMBER_FIELD(image)
CLASS_MEMBER_FIELD(text)
CLASS_MEMBER_FIELD(tag)
END_CLASS_MEMBER(TreeViewItem)
BEGIN_CLASS_MEMBER(TreeViewItemRootProvider)
CLASS_MEMBER_BASE(MemoryNodeRootProvider)
CLASS_MEMBER_CONSTRUCTOR(Ptr<TreeViewItemRootProvider>(), NO_PARAMETER)
CLASS_MEMBER_METHOD(GetTreeViewData, {L"node"})
CLASS_MEMBER_METHOD(SetTreeViewData, {L"node" _ L"value"})
CLASS_MEMBER_METHOD(UpdateTreeViewData, {L"node"})
END_CLASS_MEMBER(TreeViewItemRootProvider)
BEGIN_CLASS_MEMBER(GuiVirtualTreeView)
CLASS_MEMBER_BASE(GuiVirtualTreeListControl)
CLASS_MEMBER_CONSTRUCTOR(GuiVirtualTreeView*(GuiVirtualTreeView::IStyleProvider* _ Ptr<INodeRootProvider>), {L"styleProvider" _ L"rootNodeProvider"})
CLASS_MEMBER_PROPERTY_READONLY_FAST(TreeViewStyleProvider)
END_CLASS_MEMBER(GuiVirtualTreeView)
BEGIN_CLASS_MEMBER(GuiVirtualTreeView::IStyleProvider)
CLASS_MEMBER_BASE(GuiVirtualTreeListControl::IStyleProvider)
INTERFACE_EXTERNALCTOR(GuiVirtualTreeView, IStyleProvider)
CLASS_MEMBER_PROPERTY_READONLY_FAST(TextColor)
CLASS_MEMBER_METHOD(CreateItemBackground, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateItemExpandingDecorator, NO_PARAMETER)
END_CLASS_MEMBER(GuiVirtualTreeView::IStyleProvider)
BEGIN_CLASS_MEMBER(GuiTreeView)
CLASS_MEMBER_BASE(GuiVirtualTreeView)
CONTROL_CONSTRUCTOR_PROVIDER(GuiTreeView)
CLASS_MEMBER_METHOD_RENAME(GetNodes, Nodes, NO_PARAMETER)
CLASS_MEMBER_PROPERTY_READONLY(Nodes, GetNodes)
CLASS_MEMBER_PROPERTY_EVENT_READONLY_FAST(SelectedItem, SelectionChanged)
END_CLASS_MEMBER(GuiTreeView)
BEGIN_CLASS_MEMBER(TreeViewNodeItemStyleProvider)
CLASS_MEMBER_BASE(INodeItemStyleProvider)
CLASS_MEMBER_CONSTRUCTOR(Ptr<TreeViewNodeItemStyleProvider>(), NO_PARAMETER)
CLASS_MEMBER_CONSTRUCTOR(Ptr<TreeViewNodeItemStyleProvider>(Size, bool), {L"minIconSize" _ L"fitImage"})
END_CLASS_MEMBER(TreeViewNodeItemStyleProvider)
BEGIN_CLASS_MEMBER(GuiComboBoxBase)
CLASS_MEMBER_BASE(GuiMenuButton)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiComboBoxBase)
CLASS_MEMBER_GUIEVENT(ItemSelected)
END_CLASS_MEMBER(GuiComboBoxBase)
BEGIN_CLASS_MEMBER(GuiComboBoxBase::ICommandExecutor)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_METHOD(SelectItem, NO_PARAMETER)
END_CLASS_MEMBER(GuiComboBoxBase::ICommandExecutor)
BEGIN_CLASS_MEMBER(GuiComboBoxBase::IStyleController)
CLASS_MEMBER_BASE(GuiMenuButton::IStyleController)
INTERFACE_EXTERNALCTOR(GuiComboBoxBase, IStyleController)
CLASS_MEMBER_METHOD(SetCommandExecutor, {L"value"})
CLASS_MEMBER_METHOD(OnItemSelected, NO_PARAMETER)
END_CLASS_MEMBER(GuiComboBoxBase::IStyleController)
BEGIN_CLASS_MEMBER(GuiComboBoxListControl)
CLASS_MEMBER_BASE(GuiComboBoxBase)
CLASS_MEMBER_CONSTRUCTOR(GuiComboBoxListControl*(GuiComboBoxListControl::IStyleController* _ GuiSelectableListControl*), {L"styleController" _ L"containedListControl"})
CLASS_MEMBER_PROPERTY_FAST(Font)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ContainedListControl)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(SelectedIndex)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ItemProvider)
END_CLASS_MEMBER(GuiComboBoxListControl)
BEGIN_CLASS_MEMBER(GuiToolstripCommand)
CLASS_MEMBER_BASE(GuiComponent)
CLASS_MEMBER_CONSTRUCTOR(GuiToolstripCommand*(), NO_PARAMETER)
CLASS_MEMBER_GUIEVENT(Executed)
CLASS_MEMBER_GUIEVENT(DescriptionChanged)
CLASS_MEMBER_PROPERTY_EVENT_FAST(Image, DescriptionChanged)
CLASS_MEMBER_PROPERTY_EVENT_FAST(Text, DescriptionChanged)
CLASS_MEMBER_PROPERTY_EVENT_FAST(Shortcut, DescriptionChanged)
CLASS_MEMBER_PROPERTY_EVENT_FAST(ShortcutBuilder, DescriptionChanged)
CLASS_MEMBER_PROPERTY_EVENT_FAST(Enabled, DescriptionChanged)
END_CLASS_MEMBER(GuiToolstripCommand)
BEGIN_CLASS_MEMBER(GuiToolstripMenu)
CLASS_MEMBER_BASE(GuiMenu)
CLASS_MEMBER_CONSTRUCTOR(GuiToolstripMenu*(GuiToolstripMenu::IStyleController* _ GuiControl*), {L"styleController" _ L"owner"})
CLASS_MEMBER_PROPERTY_READONLY_FAST(ToolstripItems)
END_CLASS_MEMBER(GuiToolstripMenu)
BEGIN_CLASS_MEMBER(GuiToolstripMenuBar)
CLASS_MEMBER_BASE(GuiMenuBar)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiToolstripMenuBar)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ToolstripItems)
END_CLASS_MEMBER(GuiToolstripMenuBar)
BEGIN_CLASS_MEMBER(GuiToolstripToolBar)
CLASS_MEMBER_BASE(GuiControl)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiToolstripToolBar)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ToolstripItems)
END_CLASS_MEMBER(GuiToolstripToolBar)
BEGIN_CLASS_MEMBER(GuiToolstripButton)
CLASS_MEMBER_BASE(GuiMenuButton)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiToolstripToolBar)
CLASS_MEMBER_PROPERTY_FAST(Command)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ToolstripSubMenu)
CLASS_MEMBER_METHOD(CreateToolstripSubMenu, {L"subMenuStyleController"})
END_CLASS_MEMBER(GuiToolstripButton)
BEGIN_CLASS_MEMBER(GuiDocumentCommonInterface)
CLASS_MEMBER_PROPERTY_FAST(Document)
CLASS_MEMBER_PROPERTY_FAST(EditMode)
CLASS_MEMBER_GUIEVENT(ActiveHyperlinkChanged)
CLASS_MEMBER_GUIEVENT(ActiveHyperlinkExecuted)
CLASS_MEMBER_GUIEVENT(SelectionChanged)
CLASS_MEMBER_PROPERTY_READONLY_FAST(CaretBegin)
CLASS_MEMBER_PROPERTY_READONLY_FAST(CaretEnd)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ActiveHyperlinkReference)
CLASS_MEMBER_PROPERTY_READONLY_FAST(SelectionText)
CLASS_MEMBER_PROPERTY_READONLY_FAST(SelectionModel)
CLASS_MEMBER_METHOD(SetCaret, {L"begin" _ L"end" _ L"frontSide"})
CLASS_MEMBER_METHOD(CalculateCaretFromPoint, {L"point"})
CLASS_MEMBER_METHOD(GetCaretBounds, {L"caret" _ L"frontSide"})
CLASS_MEMBER_METHOD(NotifyParagraphUpdated, {L"index" _ L"oldCount" _ L"newCount" _ L"updatedText"})
CLASS_MEMBER_METHOD(EditRun, {L"begin" _ L"end" _ L"model"})
CLASS_MEMBER_METHOD(EditText, {L"begin" _ L"end" _ L"frontSide" _ L"text"})
CLASS_MEMBER_METHOD(EditStyle, {L"begin" _ L"end" _ L"style"})
CLASS_MEMBER_METHOD(EditImage, {L"begin" _ L"end" _ L"image"})
CLASS_MEMBER_METHOD(EditImage, {L"paragraphIndex" _ L"begin" _ L"end" _ L"reference" _ L"normalStyleName" _ L"activeStyleName"})
CLASS_MEMBER_METHOD(RemoveHyperlink, {L"paragraphIndex" _ L"begin" _ L"end"})
CLASS_MEMBER_METHOD(EditStyleName, {L"begin" _ L"end" _ L"styleName"})
CLASS_MEMBER_METHOD(RemoveStyleName, {L"begin" _ L"end" _ L"image"})
CLASS_MEMBER_METHOD(RenameStyle, {L"oldStyleName" _ L"newStyleName"})
CLASS_MEMBER_METHOD(ClearStyle, {L"begin" _ L"end"})
CLASS_MEMBER_METHOD(SummarizeStyle, {L"begin" _ L"end"})
CLASS_MEMBER_METHOD(SetParagraphAlignment, {L"begin" _ L"end" _ L"alignments"})
CLASS_MEMBER_METHOD(SelectAll, NO_PARAMETER)
CLASS_MEMBER_METHOD(CanCut, NO_PARAMETER)
CLASS_MEMBER_METHOD(CanCopy, NO_PARAMETER)
CLASS_MEMBER_METHOD(CanPaste, NO_PARAMETER)
CLASS_MEMBER_METHOD(Cut, NO_PARAMETER)
CLASS_MEMBER_METHOD(Copy, NO_PARAMETER)
CLASS_MEMBER_METHOD(Paste, NO_PARAMETER)
CLASS_MEMBER_METHOD(CanUndo, NO_PARAMETER)
CLASS_MEMBER_METHOD(CanRedo, NO_PARAMETER)
CLASS_MEMBER_METHOD(ClearUndoRedo, NO_PARAMETER)
CLASS_MEMBER_METHOD(NotifyModificationSaved, NO_PARAMETER)
CLASS_MEMBER_METHOD(Undo, NO_PARAMETER)
CLASS_MEMBER_METHOD(Redo, NO_PARAMETER)
END_CLASS_MEMBER(GuiDocumentCommonInterface)
BEGIN_ENUM_ITEM(GuiDocumentCommonInterface::EditMode)
ENUM_ITEM_NAMESPACE(GuiDocumentCommonInterface)
ENUM_NAMESPACE_ITEM(ViewOnly)
ENUM_NAMESPACE_ITEM(Selectable)
ENUM_NAMESPACE_ITEM(Editable)
END_ENUM_ITEM(GuiDocumentCommonInterface::EditMode)
BEGIN_CLASS_MEMBER(GuiDocumentViewer)
CLASS_MEMBER_BASE(GuiScrollContainer)
CLASS_MEMBER_BASE(GuiDocumentCommonInterface)
CONTROL_CONSTRUCTOR_PROVIDER(GuiDocumentViewer)
END_CLASS_MEMBER(GuiDocumentViewer)
BEGIN_CLASS_MEMBER(GuiDocumentLabel)
CLASS_MEMBER_BASE(GuiControl)
CLASS_MEMBER_BASE(GuiDocumentCommonInterface)
CONTROL_CONSTRUCTOR_CONTROLLER(GuiDocumentLabel)
END_CLASS_MEMBER(GuiDocumentLabel)
BEGIN_CLASS_MEMBER(GuiTextBoxCommonInterface)
CLASS_MEMBER_GUIEVENT(SelectionChanged)
CLASS_MEMBER_PROPERTY_FAST(Readonly)
CLASS_MEMBER_PROPERTY_EVENT_FAST(SelectionText, SelectionChanged)
CLASS_MEMBER_PROPERTY_EVENT_READONLY_FAST(CaretBegin, SelectionChanged)
CLASS_MEMBER_PROPERTY_EVENT_READONLY_FAST(CaretEnd, SelectionChanged)
CLASS_MEMBER_PROPERTY_EVENT_READONLY_FAST(CaretSmall, SelectionChanged)
CLASS_MEMBER_PROPERTY_EVENT_READONLY_FAST(CaretLarge, SelectionChanged)
CLASS_MEMBER_PROPERTY_READONLY_FAST(RowHeight)
CLASS_MEMBER_PROPERTY_READONLY_FAST(MaxWidth)
CLASS_MEMBER_PROPERTY_READONLY_FAST(MaxHeight)
CLASS_MEMBER_PROPERTY_FAST(Colorizer)
CLASS_MEMBER_PROPERTY_FAST(AutoComplete)
CLASS_MEMBER_PROPERTY_READONLY_FAST(EditVersion)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Modified)
CLASS_MEMBER_METHOD(CanCut, NO_PARAMETER)
CLASS_MEMBER_METHOD(CanCopy, NO_PARAMETER)
CLASS_MEMBER_METHOD(CanPaste, NO_PARAMETER)
CLASS_MEMBER_METHOD(Cut, NO_PARAMETER)
CLASS_MEMBER_METHOD(Copy, NO_PARAMETER)
CLASS_MEMBER_METHOD(Paste, NO_PARAMETER)
CLASS_MEMBER_METHOD(SelectAll, NO_PARAMETER)
CLASS_MEMBER_METHOD(Select, {L"begin" _ L"end"})
CLASS_MEMBER_METHOD(SetSelectionTextAsKeyInput, {L"value"})
CLASS_MEMBER_METHOD(GetRowText, {L"row"})
CLASS_MEMBER_METHOD(GetFragmentText, {L"start" _ L"end"})
CLASS_MEMBER_METHOD(GetRowWidth, {L"row"})
CLASS_MEMBER_METHOD(GetTextPosFromPoint, {L"point"})
CLASS_MEMBER_METHOD(GetPointFromTextPos, {L"pos"})
CLASS_MEMBER_METHOD(GetRectFromTextPos, {L"pos"})
CLASS_MEMBER_METHOD(GetNearestTextPos, {L"point"})
CLASS_MEMBER_METHOD(CanUndo, NO_PARAMETER)
CLASS_MEMBER_METHOD(CanRedo, NO_PARAMETER)
CLASS_MEMBER_METHOD(ClearUndoRedo, NO_PARAMETER)
CLASS_MEMBER_METHOD(NotifyModificationSaved, NO_PARAMETER)
CLASS_MEMBER_METHOD(Undo, NO_PARAMETER)
CLASS_MEMBER_METHOD(Redo, NO_PARAMETER)
END_CLASS_MEMBER(GuiTextBoxCommonInterface)
BEGIN_CLASS_MEMBER(ILanguageProvider)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(controls, ILanguageProvider)
CLASS_MEMBER_METHOD(CreateSymbolFromNode, {L"obj" _ L"executor" _ L"finder"})
CLASS_MEMBER_METHOD(FindReferencedSymbols, {L"obj" _ L"finder"})
CLASS_MEMBER_METHOD(FindPossibleSymbols, {L"obj" _ L"field" _ L"finder"})
END_CLASS_MEMBER(ILanguageProvider)
BEGIN_CLASS_MEMBER(RepeatingParsingExecutor)
CLASS_MEMBER_EXTERNALCTOR(Ptr<RepeatingParsingExecutor>(const WString&, bool, const WString&, Ptr<ILanguageProvider>), {L"grammar" _ L"enableAmbiguity" _ L"rule" _ L"provider"}, &CreateRepeatingParsingExecutor)
CLASS_MEMBER_METHOD(GetTokenIndex, {L"tokenName"})
CLASS_MEMBER_METHOD(GetSemanticId, {L"name"})
CLASS_MEMBER_METHOD(GetSemanticName, {L"id"})
END_CLASS_MEMBER(RepeatingParsingExecutor)
BEGIN_CLASS_MEMBER(GuiTextBoxColorizerBase)
CLASS_MEMBER_PROPERTY_READONLY_FAST(LexerStartState)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ContextStartState)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Colors)
CLASS_MEMBER_METHOD(RestartColorizer, NO_PARAMETER)
END_CLASS_MEMBER(GuiTextBoxColorizerBase)
BEGIN_CLASS_MEMBER(GuiTextBoxRegexColorizer)
CLASS_MEMBER_BASE(GuiTextBoxColorizerBase)
CLASS_MEMBER_CONSTRUCTOR(Ptr<GuiTextBoxRegexColorizer>(), NO_PARAMETER)
CLASS_MEMBER_PROPERTY_FAST(DefaultColor)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ExtraTokenIndexStart)
CLASS_MEMBER_PROPERTY_READONLY_FAST(TokenRegexes)
CLASS_MEMBER_PROPERTY_READONLY_FAST(TokenColors)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ExtraTokenColors)
CLASS_MEMBER_METHOD(AddToken, {L"regex" _ L"color"})
CLASS_MEMBER_METHOD(AddExtraToken, {L"color"})
CLASS_MEMBER_METHOD(ClearTokens, NO_PARAMETER)
CLASS_MEMBER_METHOD(Setup, NO_PARAMETER)
END_CLASS_MEMBER(GuiTextBoxRegexColorizer)
BEGIN_CLASS_MEMBER(GuiGrammarColorizer)
CLASS_MEMBER_BASE(GuiTextBoxRegexColorizer)
CLASS_MEMBER_CONSTRUCTOR(Ptr<GuiGrammarColorizer>(Ptr<RepeatingParsingExecutor>), {L"parsingExecutor"})
CLASS_MEMBER_PROPERTY_READONLY_FAST(ParsingExecutor)
CLASS_MEMBER_METHOD(BeginSetColors, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetColorNames, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetColor, {L"name"})
CLASS_MEMBER_METHOD_OVERLOAD(SetColor, {L"name" _ L"color"}, void(GuiGrammarColorizer::*)(const WString&, const ColorEntry&))
CLASS_MEMBER_METHOD_OVERLOAD(SetColor, {L"name" _ L"color"}, void(GuiGrammarColorizer::*)(const WString&, const Color&))
CLASS_MEMBER_METHOD(EndSetColors, NO_PARAMETER)
END_CLASS_MEMBER(GuiGrammarColorizer)
BEGIN_CLASS_MEMBER(GuiTextBoxAutoCompleteBase)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ListStartPosition)
CLASS_MEMBER_PROPERTY_READONLY_FAST(SelectedListItem)
CLASS_MEMBER_METHOD(IsListOpening, NO_PARAMETER)
CLASS_MEMBER_METHOD(OpenList, {L"startPosition"})
CLASS_MEMBER_METHOD(CloseList, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetListContent, {L"items"})
CLASS_MEMBER_METHOD(SelectPreviousListItem, NO_PARAMETER)
CLASS_MEMBER_METHOD(SelectNextListItem, NO_PARAMETER)
CLASS_MEMBER_METHOD(ApplySelectedListItem, NO_PARAMETER)
CLASS_MEMBER_METHOD(HighlightList, {L"editingText"})
END_CLASS_MEMBER(GuiTextBoxAutoCompleteBase)
BEGIN_CLASS_MEMBER(GuiGrammarAutoComplete)
CLASS_MEMBER_BASE(GuiTextBoxAutoCompleteBase)
CLASS_MEMBER_CONSTRUCTOR(Ptr<GuiGrammarAutoComplete>(Ptr<RepeatingParsingExecutor>), {L"parsingExecutor"})
CLASS_MEMBER_PROPERTY_READONLY_FAST(ParsingExecutor)
END_CLASS_MEMBER(GuiGrammarAutoComplete)
BEGIN_CLASS_MEMBER(GuiMultilineTextBox)
CLASS_MEMBER_BASE(GuiScrollView)
CLASS_MEMBER_BASE(GuiTextBoxCommonInterface)
CONTROL_CONSTRUCTOR_PROVIDER(GuiMultilineTextBox)
END_CLASS_MEMBER(GuiMultilineTextBox)
BEGIN_CLASS_MEMBER(GuiSinglelineTextBox)
CLASS_MEMBER_BASE(GuiControl)
CLASS_MEMBER_BASE(GuiTextBoxCommonInterface)
CONTROL_CONSTRUCTOR_PROVIDER(GuiSinglelineTextBox)
CLASS_MEMBER_PROPERTY_FAST(PasswordChar)
END_CLASS_MEMBER(GuiSinglelineTextBox)
BEGIN_CLASS_MEMBER(GuiSinglelineTextBox::IStyleProvider)
CLASS_MEMBER_BASE(GuiControl::IStyleProvider)
INTERFACE_EXTERNALCTOR(GuiSinglelineTextBox, IStyleProvider)
CLASS_MEMBER_METHOD(InstallBackground, {L"background"})
END_CLASS_MEMBER(GuiSinglelineTextBox::IStyleProvider)
BEGIN_CLASS_MEMBER(IDataVisualizerFactory)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(list, IDataVisualizerFactory)
CLASS_MEMBER_METHOD(CreateVisualizer, {L"font" _ L"styleProvider"})
END_CLASS_MEMBER(IDataVisualizerFactory)
BEGIN_CLASS_MEMBER(IDataVisualizer)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(list, IDataVisualizer)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Factory)
CLASS_MEMBER_PROPERTY_READONLY_FAST(BoundsComposition)
CLASS_MEMBER_PROPERTY_READONLY_FAST(DecoratedDataVisualizer)
CLASS_MEMBER_METHOD(BeforeVisualizeCell, {L"dataProvider" _ L"row" _ L"column"})
CLASS_MEMBER_METHOD(SetSelected, {L"value"})
END_CLASS_MEMBER(IDataVisualizer)
BEGIN_CLASS_MEMBER(IDataEditorCallback)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_METHOD(RequestSaveData, NO_PARAMETER);
END_CLASS_MEMBER(IDataEditorCallback)
BEGIN_CLASS_MEMBER(IDataEditorFactory)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(list, IDataEditorFactory)
CLASS_MEMBER_METHOD(CreateEditor, {L"callback"})
END_CLASS_MEMBER(IDataEditorFactory)
BEGIN_CLASS_MEMBER(IDataEditor)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(list, IDataEditor)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Factory)
CLASS_MEMBER_PROPERTY_READONLY_FAST(BoundsComposition)
CLASS_MEMBER_METHOD(BeforeEditCell, {L"dataProvider" _ L"row" _ L"column"})
CLASS_MEMBER_METHOD(ReinstallEditor, NO_PARAMETER)
END_CLASS_MEMBER(IDataEditor)
BEGIN_CLASS_MEMBER(IDataProviderCommandExecutor)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_METHOD(OnDataProviderColumnChanged, NO_PARAMETER)
CLASS_MEMBER_METHOD(OnDataProviderItemModified, {L"start" _ L"count" _ L"newCount"})
END_CLASS_MEMBER(IDataProviderCommandExecutor)
BEGIN_CLASS_MEMBER(IDataProvider)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(list, IDataProvider)
INTERFACE_IDENTIFIER(IDataProvider)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ColumnCount)
CLASS_MEMBER_PROPERTY_READONLY_FAST(SortedColumn)
CLASS_MEMBER_PROPERTY_READONLY_FAST(RowCount)
CLASS_MEMBER_METHOD(SetCommandExecutor, {L"value"})
CLASS_MEMBER_METHOD(GetColumnText, {L"column"})
CLASS_MEMBER_METHOD(GetColumnSize, {L"column"})
CLASS_MEMBER_METHOD(SetColumnSize, {L"column" _ L"value"})
CLASS_MEMBER_METHOD(GetColumnPopup, {L"column"})
CLASS_MEMBER_METHOD(IsColumnSortable, {L"column"})
CLASS_MEMBER_METHOD(SortByColumn, {L"column" _ L"ascending"})
CLASS_MEMBER_METHOD(IsSortOrderAscending, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetRowLargeImage, {L"row" _ L"column"})
CLASS_MEMBER_METHOD(GetRowSmallImage, {L"row" _ L"column"})
CLASS_MEMBER_METHOD(GetCellSpan, {L"row" _ L"column"})
CLASS_MEMBER_METHOD(GetCellText, {L"row" _ L"column"})
CLASS_MEMBER_METHOD(GetCellDataVisualizerFactory, {L"row" _ L"column"})
CLASS_MEMBER_METHOD(VisualizeCell, {L"row" _ L"column" _ L"dataVisualizer"})
CLASS_MEMBER_METHOD(GetCellDataEditorFactory, {L"row" _ L"column"})
CLASS_MEMBER_METHOD(BeforeEditCell, {L"row" _ L"column" _ L"dataEditor"})
CLASS_MEMBER_METHOD(SaveCellData, {L"row" _ L"column" _ L"dataEditor"})
END_CLASS_MEMBER(IDataProvider)
BEGIN_CLASS_MEMBER(IStructuredDataFilterCommandExecutor)
CLASS_MEMBER_BASE(IDescriptable)
CLASS_MEMBER_METHOD(OnFilterChanged, NO_PARAMETER)
END_CLASS_MEMBER(IStructuredDataFilterCommandExecutor)
BEGIN_CLASS_MEMBER(IStructuredDataFilter)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(list, IStructuredDataFilter)
CLASS_MEMBER_METHOD(SetCommandExecutor, {L"value"})
CLASS_MEMBER_METHOD(Filter, {L"row"})
END_CLASS_MEMBER(IStructuredDataFilter)
BEGIN_CLASS_MEMBER(IStructuredDataSorter)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(list, IStructuredDataSorter)
CLASS_MEMBER_METHOD(Compare, {L"row1" _ L"row2"})
END_CLASS_MEMBER(IStructuredDataSorter)
BEGIN_CLASS_MEMBER(IStructuredColumnProvider)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(list, IStructuredColumnProvider)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Text)
CLASS_MEMBER_PROPERTY_FAST(Size)
CLASS_MEMBER_PROPERTY_FAST(SortingState)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Popup)
CLASS_MEMBER_PROPERTY_READONLY_FAST(InherentFilter)
CLASS_MEMBER_PROPERTY_READONLY_FAST(InherentSorter)
CLASS_MEMBER_METHOD(GetCellText, {L"row"})
CLASS_MEMBER_METHOD(GetCellDataVisualizerFactory, {L"row"})
CLASS_MEMBER_METHOD(VisualizeCell, {L"row" _ L"dataVisualizer"})
CLASS_MEMBER_METHOD(GetCellDataEditorFactory, {L"row"})
CLASS_MEMBER_METHOD(BeforeEditCell, {L"row" _ L"dataEditor"})
CLASS_MEMBER_METHOD(SaveCellData, {L"row" _ L"dataEditor"})
END_CLASS_MEMBER(IStructuredColumnProvider)
BEGIN_CLASS_MEMBER(IStructuredDataProvider)
CLASS_MEMBER_BASE(IDescriptable)
INTERFACE_EXTERNALCTOR(list, IStructuredDataProvider)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ColumnCount)
CLASS_MEMBER_PROPERTY_READONLY_FAST(RowCount)
CLASS_MEMBER_METHOD(SetCommandExecutor, {L"value"})
CLASS_MEMBER_METHOD(GetColumn, {L"column"})
CLASS_MEMBER_METHOD(GetRowLargeImage, {L"row"})
CLASS_MEMBER_METHOD(GetRowSmallImage, {L"row"})
END_CLASS_MEMBER(IStructuredDataProvider)
BEGIN_CLASS_MEMBER(DataGridContentProvider)
CLASS_MEMBER_BASE(ListViewItemStyleProvider::IListViewItemContentProvider)
CLASS_MEMBER_CONSTRUCTOR(Ptr<DataGridContentProvider>(), NO_PARAMETER)
END_CLASS_MEMBER(DataGridContentProvider)
BEGIN_CLASS_MEMBER(GuiVirtualDataGrid)
CLASS_MEMBER_BASE(GuiVirtualListView)
CLASS_MEMBER_CONSTRUCTOR(GuiVirtualDataGrid*(GuiVirtualListView::IStyleProvider* _ list::IDataProvider*), {L"styleProvider" _ L"dataProvider"})
CLASS_MEMBER_CONSTRUCTOR(GuiVirtualDataGrid*(GuiVirtualListView::IStyleProvider* _ list::IStructuredDataProvider*), {L"styleProvider" _ L"dataProvider"})
CLASS_MEMBER_PROPERTY_EVENT_FAST(SelectedCell, SelectedCellChanged)
CLASS_MEMBER_PROPERTY_READONLY_FAST(DataProvider)
CLASS_MEMBER_PROPERTY_READONLY_FAST(StructuredDataProvider)
END_CLASS_MEMBER(GuiVirtualDataGrid)
BEGIN_CLASS_MEMBER(StructuredDataFilterBase)
CLASS_MEMBER_BASE(IStructuredDataFilter)
END_CLASS_MEMBER(StructuredDataFilterBase)
BEGIN_CLASS_MEMBER(StructuredDataMultipleFilter)
CLASS_MEMBER_BASE(StructuredDataFilterBase)
CLASS_MEMBER_METHOD(AddSubFilter, {L"value"})
CLASS_MEMBER_METHOD(RemoveSubFilter, {L"value"})
END_CLASS_MEMBER(StructuredDataMultipleFilter)
BEGIN_CLASS_MEMBER(StructuredDataAndFilter)
CLASS_MEMBER_BASE(StructuredDataMultipleFilter)
CLASS_MEMBER_CONSTRUCTOR(Ptr<StructuredDataAndFilter>(), NO_PARAMETER)
END_CLASS_MEMBER(StructuredDataAndFilter)
BEGIN_CLASS_MEMBER(StructuredDataOrFilter)
CLASS_MEMBER_BASE(StructuredDataMultipleFilter)
CLASS_MEMBER_CONSTRUCTOR(Ptr<StructuredDataOrFilter>(), NO_PARAMETER)
END_CLASS_MEMBER(StructuredDataOrFilter)
BEGIN_CLASS_MEMBER(StructuredDataNotFilter)
CLASS_MEMBER_BASE(StructuredDataFilterBase)
CLASS_MEMBER_CONSTRUCTOR(Ptr<StructuredDataNotFilter>(), NO_PARAMETER)
CLASS_MEMBER_METHOD(SetSubFilter, {L"value"})
END_CLASS_MEMBER(StructuredDataNotFilter)
BEGIN_CLASS_MEMBER(StructuredDataMultipleSorter)
CLASS_MEMBER_BASE(IStructuredDataSorter)
CLASS_MEMBER_CONSTRUCTOR(Ptr<StructuredDataMultipleSorter>(), NO_PARAMETER)
CLASS_MEMBER_METHOD(SetLeftSorter, {L"value"})
CLASS_MEMBER_METHOD(SetRightSorter, {L"value"})
END_CLASS_MEMBER(StructuredDataMultipleSorter)
BEGIN_CLASS_MEMBER(StructuredDataReverseSorter)
CLASS_MEMBER_BASE(IStructuredDataSorter)
CLASS_MEMBER_CONSTRUCTOR(Ptr<StructuredDataReverseSorter>(), NO_PARAMETER)
CLASS_MEMBER_METHOD(SetSubSorter, {L"value"})
END_CLASS_MEMBER(StructuredDataReverseSorter)
BEGIN_CLASS_MEMBER(StructuredDataProvider)
CLASS_MEMBER_BASE(IDataProvider)
CLASS_MEMBER_PROPERTY_READONLY_FAST(StructuredDataProvider)
CLASS_MEMBER_PROPERTY_FAST(AdditionalFilter)
END_CLASS_MEMBER(StructuredDataProvider)
BEGIN_CLASS_MEMBER(ListViewMainColumnDataVisualizer)
CLASS_MEMBER_BASE(IDataVisualizer)
CLASS_MEMBER_PROPERTY_READONLY_FAST(TextElement)
END_CLASS_MEMBER(ListViewMainColumnDataVisualizer)
BEGIN_CLASS_MEMBER(ListViewMainColumnDataVisualizer::Factory)
CLASS_MEMBER_BASE(IDataVisualizerFactory)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewMainColumnDataVisualizer::Factory>(), NO_PARAMETER)
END_CLASS_MEMBER(ListViewMainColumnDataVisualizer::Factory)
BEGIN_CLASS_MEMBER(ListViewSubColumnDataVisualizer)
CLASS_MEMBER_BASE(IDataVisualizer)
CLASS_MEMBER_PROPERTY_READONLY_FAST(TextElement)
END_CLASS_MEMBER(ListViewSubColumnDataVisualizer)
BEGIN_CLASS_MEMBER(ListViewSubColumnDataVisualizer::Factory)
CLASS_MEMBER_BASE(IDataVisualizerFactory)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ListViewSubColumnDataVisualizer::Factory>(), NO_PARAMETER)
END_CLASS_MEMBER(ListViewSubColumnDataVisualizer::Factory)
BEGIN_CLASS_MEMBER(HyperlinkDataVisualizer)
CLASS_MEMBER_BASE(ListViewSubColumnDataVisualizer)
END_CLASS_MEMBER(HyperlinkDataVisualizer)
BEGIN_CLASS_MEMBER(HyperlinkDataVisualizer::Factory)
CLASS_MEMBER_BASE(IDataVisualizerFactory)
CLASS_MEMBER_CONSTRUCTOR(Ptr<HyperlinkDataVisualizer::Factory>(), NO_PARAMETER)
END_CLASS_MEMBER(HyperlinkDataVisualizer::Factory)
BEGIN_CLASS_MEMBER(ImageDataVisualizer)
CLASS_MEMBER_BASE(IDataVisualizer)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ImageElement)
END_CLASS_MEMBER(ImageDataVisualizer)
BEGIN_CLASS_MEMBER(ImageDataVisualizer::Factory)
CLASS_MEMBER_BASE(IDataVisualizerFactory)
CLASS_MEMBER_CONSTRUCTOR(Ptr<ImageDataVisualizer::Factory>(), NO_PARAMETER)
END_CLASS_MEMBER(ImageDataVisualizer::Factory)
BEGIN_CLASS_MEMBER(CellBorderDataVisualizer)
CLASS_MEMBER_BASE(IDataVisualizer)
END_CLASS_MEMBER(CellBorderDataVisualizer)
BEGIN_CLASS_MEMBER(CellBorderDataVisualizer::Factory)
CLASS_MEMBER_BASE(IDataVisualizerFactory)
CLASS_MEMBER_CONSTRUCTOR(Ptr<CellBorderDataVisualizer::Factory>(Ptr<IDataVisualizerFactory>), {L"decoratedFactory"})
END_CLASS_MEMBER(CellBorderDataVisualizer::Factory)
BEGIN_CLASS_MEMBER(NotifyIconDataVisualizer)
CLASS_MEMBER_BASE(IDataVisualizer)
CLASS_MEMBER_PROPERTY_READONLY_FAST(LeftImageElement)
CLASS_MEMBER_PROPERTY_READONLY_FAST(RightImageElement)
END_CLASS_MEMBER(NotifyIconDataVisualizer)
BEGIN_CLASS_MEMBER(NotifyIconDataVisualizer::Factory)
CLASS_MEMBER_BASE(IDataVisualizerFactory)
CLASS_MEMBER_CONSTRUCTOR(Ptr<NotifyIconDataVisualizer::Factory>(Ptr<IDataVisualizerFactory>), {L"decoratedFactory"})
END_CLASS_MEMBER(NotifyIconDataVisualizer::Factory)
BEGIN_CLASS_MEMBER(TextBoxDataEditor)
CLASS_MEMBER_BASE(IDataEditor)
CLASS_MEMBER_PROPERTY_READONLY_FAST(TextBox)
END_CLASS_MEMBER(TextBoxDataEditor)
BEGIN_CLASS_MEMBER(TextBoxDataEditor::Factory)
CLASS_MEMBER_BASE(IDataEditorFactory)
CLASS_MEMBER_CONSTRUCTOR(Ptr<TextBoxDataEditor::Factory>(), NO_PARAMETER)
END_CLASS_MEMBER(TextBoxDataEditor::Factory)
BEGIN_CLASS_MEMBER(TextComboBoxDataEditor)
CLASS_MEMBER_BASE(IDataEditor)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ComboBoxControl)
CLASS_MEMBER_PROPERTY_READONLY_FAST(TextListControl)
END_CLASS_MEMBER(TextComboBoxDataEditor)
BEGIN_CLASS_MEMBER(TextComboBoxDataEditor::Factory)
CLASS_MEMBER_BASE(IDataEditorFactory)
CLASS_MEMBER_CONSTRUCTOR(Ptr<TextComboBoxDataEditor::Factory>(), NO_PARAMETER)
END_CLASS_MEMBER(TextComboBoxDataEditor::Factory)
BEGIN_CLASS_MEMBER(DateComboBoxDataEditor)
CLASS_MEMBER_BASE(IDataEditor)
CLASS_MEMBER_PROPERTY_READONLY_FAST(ComboBoxControl)
CLASS_MEMBER_PROPERTY_READONLY_FAST(DatePickerControl)
END_CLASS_MEMBER(DateComboBoxDataEditor)
BEGIN_CLASS_MEMBER(DateComboBoxDataEditor::Factory)
CLASS_MEMBER_BASE(IDataEditorFactory)
CLASS_MEMBER_CONSTRUCTOR(Ptr<DateComboBoxDataEditor::Factory>(), NO_PARAMETER)
END_CLASS_MEMBER(DateComboBoxDataEditor::Factory)
BEGIN_CLASS_MEMBER(GuiDatePicker)
CLASS_MEMBER_BASE(GuiControl)
CONTROL_CONSTRUCTOR_PROVIDER(GuiDatePicker)
CLASS_MEMBER_PROPERTY_EVENT_FAST(Date, DateChanged)
CLASS_MEMBER_PROPERTY_EVENT_FAST(DateFormat, DateFormatChanged)
CLASS_MEMBER_PROPERTY_EVENT_FAST(DateLocale, DateLocaleChanged)
CLASS_MEMBER_GUIEVENT(DateSelected);
CLASS_MEMBER_GUIEVENT(DateNavigated);
END_CLASS_MEMBER(GuiDatePicker)
BEGIN_CLASS_MEMBER(GuiDatePicker::IStyleProvider)
CLASS_MEMBER_BASE(GuiControl::IStyleProvider)
INTERFACE_EXTERNALCTOR(GuiDatePicker, IStyleProvider)
CLASS_MEMBER_PROPERTY_READONLY_FAST(BackgroundColor)
CLASS_MEMBER_PROPERTY_READONLY_FAST(PrimaryTextColor)
CLASS_MEMBER_PROPERTY_READONLY_FAST(SecondaryTextColor)
CLASS_MEMBER_METHOD(CreateDateButtonStyle, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateTextList, NO_PARAMETER)
CLASS_MEMBER_METHOD(CreateComboBoxStyle, NO_PARAMETER)
END_CLASS_MEMBER(GuiDatePicker::IStyleProvider)
BEGIN_CLASS_MEMBER(GuiDateComboBox)
CLASS_MEMBER_BASE(GuiComboBoxBase)
CLASS_MEMBER_CONSTRUCTOR(GuiDateComboBox*(GuiDateComboBox::IStyleController* _ GuiDatePicker*), {L"styleController" _ L"datePicker"})
CLASS_MEMBER_PROPERTY_EVENT_FAST(SelectedDate, SelectedDateChanged)
CLASS_MEMBER_PROPERTY_READONLY_FAST(DatePicker)
END_CLASS_MEMBER(GuiDateComboBox)
BEGIN_CLASS_MEMBER(GuiStringGrid)
CLASS_MEMBER_BASE(GuiVirtualDataGrid)
CONTROL_CONSTRUCTOR_PROVIDER(GuiStringGrid)
CLASS_MEMBER_METHOD_RENAME(GetGrids, Grids, NO_PARAMETER)
CLASS_MEMBER_PROPERTY_READONLY(Grids, GetGrids)
END_CLASS_MEMBER(GuiStringGrid)
BEGIN_CLASS_MEMBER(StringGridProvider)
CLASS_MEMBER_METHOD(InsertRow, {L"row"})
CLASS_MEMBER_METHOD(AppendRow, NO_PARAMETER)
CLASS_MEMBER_METHOD(MoveRow, {L"source" _ L"target"})
CLASS_MEMBER_METHOD(RemoveRow, {L"row"})
CLASS_MEMBER_METHOD(ClearRows, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetGridString, {L"row" _ L"column"})
CLASS_MEMBER_METHOD(SetGridString, {L"row" _ L"column" _ L"value"})
CLASS_MEMBER_METHOD(InsertColumn, {L"column" _ L"text" _ L"size"})
CLASS_MEMBER_METHOD(AppendColumn, {L"text" _ L"size"})
CLASS_MEMBER_METHOD(MoveColumn, {L"source" _ L"target"})
CLASS_MEMBER_METHOD(RemoveColumn, {L"column"})
CLASS_MEMBER_METHOD(ClearColumns, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetColumnText, {L"column"})
CLASS_MEMBER_METHOD(SetColumnText, {L"column" _ L"value"})
END_CLASS_MEMBER(StringGridProvider)
BEGIN_CLASS_MEMBER(GuiBindableTextList)
CLASS_MEMBER_BASE(GuiVirtualTextList)
CLASS_MEMBER_CONSTRUCTOR(GuiBindableTextList*(GuiBindableTextList::IStyleProvider*, list::TextItemStyleProvider::ITextItemStyleProvider*, Ptr<IValueEnumerable>), {L"styleProvider" _ L"itemStyleProvider" _ L"itemSource"})
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(TextProperty)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(CheckedProperty)
CLASS_MEMBER_PROPERTY_EVENT_READONLY_FAST(SelectedItem, SelectionChanged)
END_CLASS_MEMBER(GuiBindableTextList)
BEGIN_CLASS_MEMBER(GuiBindableListView)
CLASS_MEMBER_BASE(GuiVirtualListView)
CLASS_MEMBER_CONSTRUCTOR(GuiBindableListView*(GuiBindableListView::IStyleProvider*, Ptr<IValueEnumerable>), {L"styleProvider" _ L"itemSource"})
CLASS_MEMBER_PROPERTY_READONLY_FAST(DataColumns)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Columns)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(LargeImageProperty)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(SmallImageProperty)
CLASS_MEMBER_PROPERTY_EVENT_READONLY_FAST(SelectedItem, SelectionChanged)
END_CLASS_MEMBER(GuiBindableListView)
BEGIN_CLASS_MEMBER(GuiBindableTreeView)
CLASS_MEMBER_BASE(GuiVirtualTreeView)
CLASS_MEMBER_CONSTRUCTOR(GuiBindableTreeView*(GuiBindableTreeView::IStyleProvider*, const Value&), {L"styleProvider" _ L"itemSource"})
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(TextProperty)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(ImageProperty)
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(ChildrenProperty)
CLASS_MEMBER_PROPERTY_EVENT_READONLY_FAST(SelectedItem, SelectionChanged)
END_CLASS_MEMBER(GuiBindableTreeView)
BEGIN_CLASS_MEMBER(GuiBindableDataGrid)
CLASS_MEMBER_BASE(GuiVirtualDataGrid)
CLASS_MEMBER_CONSTRUCTOR(GuiBindableDataGrid*(GuiBindableDataGrid::IStyleProvider*, Ptr<IValueEnumerable>), {L"styleProvider" _ L"itemSource"})
END_CLASS_MEMBER(GuiBindableDataGrid)
#undef INTERFACE_IDENTIFIER
#undef CONTROL_CONSTRUCTOR_CONTROLLER
#undef INTERFACE_EXTERNALCTOR
#undef _
/***********************************************************************
Type Loader
***********************************************************************/
class GuiControlsTypeLoader : public Object, public ITypeLoader
{
public:
void Load(ITypeManager* manager)
{
GUIREFLECTIONCONTROLS_TYPELIST(ADD_TYPE_INFO)
}
void Unload(ITypeManager* manager)
{
}
};
#endif
bool LoadGuiControlTypes()
{
#ifndef VCZH_DEBUG_NO_REFLECTION
ITypeManager* manager=GetGlobalTypeManager();
if(manager)
{
Ptr<ITypeLoader> loader=new GuiControlsTypeLoader;
return manager->AddTypeLoader(loader);
}
#endif
return false;
}
}
}
}
/***********************************************************************
TypeDescriptors\GuiReflectionElements.cpp
***********************************************************************/
namespace vl
{
namespace reflection
{
namespace description
{
using namespace collections;
#ifndef VCZH_DEBUG_NO_REFLECTION
GUIREFLECTIONELEMENT_TYPELIST(IMPL_TYPE_INFO)
/***********************************************************************
External Functions
***********************************************************************/
template<typename T>
Ptr<T> Element_Constructor()
{
return T::Create();
}
text::TextLines* GuiColorizedTextElement_GetLines(GuiColorizedTextElement* thisObject)
{
return &thisObject->GetLines();
}
/***********************************************************************
Type Declaration
***********************************************************************/
#define _ ,
BEGIN_CLASS_MEMBER(IGuiGraphicsParagraph)
CLASS_MEMBER_BASE(IDescriptable)
END_CLASS_MEMBER(IGuiGraphicsParagraph)
BEGIN_ENUM_ITEM(IGuiGraphicsParagraph::CaretRelativePosition)
ENUM_ITEM_NAMESPACE(IGuiGraphicsParagraph)
ENUM_NAMESPACE_ITEM(CaretFirst)
ENUM_NAMESPACE_ITEM(CaretLast)
ENUM_NAMESPACE_ITEM(CaretLineFirst)
ENUM_NAMESPACE_ITEM(CaretLineLast)
ENUM_NAMESPACE_ITEM(CaretMoveLeft)
ENUM_NAMESPACE_ITEM(CaretMoveRight)
ENUM_NAMESPACE_ITEM(CaretMoveUp)
ENUM_NAMESPACE_ITEM(CaretMoveDown)
END_ENUM_ITEM(IGuiGraphicsParagraph::CaretRelativePosition)
BEGIN_ENUM_ITEM(ElementShape)
ENUM_CLASS_ITEM(Rectangle)
ENUM_CLASS_ITEM(Ellipse)
END_ENUM_ITEM(ElementShape)
BEGIN_CLASS_MEMBER(GuiSolidBorderElement)
CLASS_MEMBER_BASE(IGuiGraphicsElement)
CLASS_MEMBER_EXTERNALCTOR(Ptr<GuiSolidBorderElement>(), NO_PARAMETER, &Element_Constructor<GuiSolidBorderElement>)
CLASS_MEMBER_PROPERTY_FAST(Color)
CLASS_MEMBER_PROPERTY_FAST(Shape)
END_CLASS_MEMBER(GuiSolidBorderElement)
BEGIN_CLASS_MEMBER(GuiRoundBorderElement)
CLASS_MEMBER_BASE(IGuiGraphicsElement)
CLASS_MEMBER_EXTERNALCTOR(Ptr<GuiRoundBorderElement>(), NO_PARAMETER, &Element_Constructor<GuiRoundBorderElement>)
CLASS_MEMBER_PROPERTY_FAST(Color)
CLASS_MEMBER_PROPERTY_FAST(Radius)
END_CLASS_MEMBER(GuiRoundBorderElement)
BEGIN_CLASS_MEMBER(Gui3DBorderElement)
CLASS_MEMBER_BASE(IGuiGraphicsElement)
CLASS_MEMBER_EXTERNALCTOR(Ptr<Gui3DBorderElement>(), NO_PARAMETER, &Element_Constructor<Gui3DBorderElement>)
CLASS_MEMBER_METHOD(SetColors, {L"value1" _ L"value2"})
CLASS_MEMBER_PROPERTY_FAST(Color1)
CLASS_MEMBER_PROPERTY_FAST(Color2)
END_CLASS_MEMBER(Gui3DBorderElement)
BEGIN_CLASS_MEMBER(Gui3DSplitterElement)
CLASS_MEMBER_BASE(IGuiGraphicsElement)
CLASS_MEMBER_EXTERNALCTOR(Ptr<Gui3DSplitterElement>(), NO_PARAMETER, &Element_Constructor<Gui3DSplitterElement>)
CLASS_MEMBER_METHOD(SetColors, {L"value1" _ L"value2"})
CLASS_MEMBER_PROPERTY_FAST(Color1)
CLASS_MEMBER_PROPERTY_FAST(Color2)
CLASS_MEMBER_PROPERTY_FAST(Direction)
END_CLASS_MEMBER(Gui3DSplitterElement)
BEGIN_ENUM_ITEM(Gui3DSplitterElement::Direction)
ENUM_ITEM_NAMESPACE(Gui3DSplitterElement)
ENUM_NAMESPACE_ITEM(Horizontal)
ENUM_NAMESPACE_ITEM(Vertical)
END_ENUM_ITEM(Gui3DSplitterElement::Direction)
BEGIN_CLASS_MEMBER(GuiSolidBackgroundElement)
CLASS_MEMBER_BASE(IGuiGraphicsElement)
CLASS_MEMBER_EXTERNALCTOR(Ptr<GuiSolidBackgroundElement>(), NO_PARAMETER, &Element_Constructor<GuiSolidBackgroundElement>)
CLASS_MEMBER_PROPERTY_FAST(Color)
CLASS_MEMBER_PROPERTY_FAST(Shape)
END_CLASS_MEMBER(GuiSolidBackgroundElement)
BEGIN_CLASS_MEMBER(GuiGradientBackgroundElement)
CLASS_MEMBER_BASE(IGuiGraphicsElement)
CLASS_MEMBER_EXTERNALCTOR(Ptr<GuiGradientBackgroundElement>(), NO_PARAMETER, &Element_Constructor<GuiGradientBackgroundElement>)
CLASS_MEMBER_METHOD(SetColors, {L"value1" _ L"value2"})
CLASS_MEMBER_PROPERTY_FAST(Color1)
CLASS_MEMBER_PROPERTY_FAST(Color2)
CLASS_MEMBER_PROPERTY_FAST(Direction)
CLASS_MEMBER_PROPERTY_FAST(Shape)
END_CLASS_MEMBER(GuiGradientBackgroundElement)
BEGIN_ENUM_ITEM(GuiGradientBackgroundElement::Direction)
ENUM_ITEM_NAMESPACE(GuiGradientBackgroundElement)
ENUM_NAMESPACE_ITEM(Horizontal)
ENUM_NAMESPACE_ITEM(Vertical)
END_ENUM_ITEM(GuiGradientBackgroundElement::Direction)
BEGIN_CLASS_MEMBER(GuiSolidLabelElement)
CLASS_MEMBER_BASE(IGuiGraphicsElement)
CLASS_MEMBER_EXTERNALCTOR(Ptr<GuiSolidLabelElement>(), NO_PARAMETER, &Element_Constructor<GuiSolidLabelElement>)
CLASS_MEMBER_METHOD(SetAlignments, {L"horizontal" _ L"vertical"})
CLASS_MEMBER_PROPERTY_FAST(Color)
CLASS_MEMBER_PROPERTY_FAST(Font)
CLASS_MEMBER_PROPERTY_FAST(Text)
CLASS_MEMBER_PROPERTY_FAST(HorizontalAlignment)
CLASS_MEMBER_PROPERTY_FAST(VerticalAlignment)
CLASS_MEMBER_PROPERTY_FAST(WrapLine)
CLASS_MEMBER_PROPERTY_FAST(Ellipse)
CLASS_MEMBER_PROPERTY_FAST(Multiline)
CLASS_MEMBER_PROPERTY_FAST(WrapLineHeightCalculation)
END_CLASS_MEMBER(GuiSolidLabelElement)
BEGIN_CLASS_MEMBER(GuiImageFrameElement)
CLASS_MEMBER_BASE(IGuiGraphicsElement)
CLASS_MEMBER_EXTERNALCTOR(Ptr<GuiImageFrameElement>(), NO_PARAMETER, &Element_Constructor<GuiImageFrameElement>)
CLASS_MEMBER_METHOD(GetImage, NO_PARAMETER)
CLASS_MEMBER_METHOD_OVERLOAD(SetImage, {L"value"}, void(GuiImageFrameElement::*)(Ptr<INativeImage>))
CLASS_MEMBER_METHOD_OVERLOAD(SetImage, {L"image" _ L"frameIndex"}, void(GuiImageFrameElement::*)(Ptr<INativeImage> _ vint))
CLASS_MEMBER_PROPERTY(Image, GetImage, SetImage)
CLASS_MEMBER_PROPERTY_FAST(FrameIndex)
CLASS_MEMBER_PROPERTY_FAST(HorizontalAlignment)
CLASS_MEMBER_PROPERTY_FAST(VerticalAlignment)
CLASS_MEMBER_PROPERTY_FAST(Stretch)
CLASS_MEMBER_PROPERTY_FAST(Enabled)
END_CLASS_MEMBER(GuiImageFrameElement)
BEGIN_CLASS_MEMBER(GuiPolygonElement)
CLASS_MEMBER_BASE(IGuiGraphicsElement)
CLASS_MEMBER_EXTERNALCTOR(Ptr<GuiPolygonElement>(), NO_PARAMETER, &Element_Constructor<GuiPolygonElement>)
CLASS_MEMBER_METHOD_RENAME(GetPoints, GetPointsArray, NO_PARAMETER);
CLASS_MEMBER_METHOD_RENAME(SetPoints, SetPointsArray, {L"points"});
CLASS_MEMBER_PROPERTY(Points, GetPoints, SetPoints);
CLASS_MEMBER_PROPERTY_FAST(Size)
CLASS_MEMBER_PROPERTY_FAST(BorderColor)
CLASS_MEMBER_PROPERTY_FAST(BackgroundColor)
END_CLASS_MEMBER(GuiPolygonElement)
BEGIN_CLASS_MEMBER(text::TextLines)
CLASS_MEMBER_PROPERTY_READONLY_FAST(Count)
CLASS_MEMBER_PROPERTY_FAST(TabSpaceCount)
CLASS_MEMBER_PROPERTY_READONLY_FAST(RowHeight)
CLASS_MEMBER_PROPERTY_READONLY_FAST(MaxWidth)
CLASS_MEMBER_PROPERTY_READONLY_FAST(MaxHeight)
CLASS_MEMBER_PROPERTY_FAST(PasswordChar)
CLASS_MEMBER_METHOD_OVERLOAD(GetText, NO_PARAMETER, WString(text::TextLines::*)())
CLASS_MEMBER_METHOD_OVERLOAD(GetText, {L"start" _ L"end"}, WString(text::TextLines::*)(TextPos _ TextPos))
CLASS_MEMBER_METHOD(SetText, {L"value"})
CLASS_MEMBER_METHOD(RemoveLines, {L"start" _ L"end"})
CLASS_MEMBER_METHOD(IsAvailable, {L"pos"})
CLASS_MEMBER_METHOD(Normalize, {L"pos"})
CLASS_MEMBER_METHOD_OVERLOAD(Modify, {L"start" _ L"end" _ L"input"}, TextPos(text::TextLines::*)(TextPos _ TextPos _ const WString&))
CLASS_MEMBER_METHOD(Clear, NO_PARAMETER)
CLASS_MEMBER_METHOD(ClearMeasurement, NO_PARAMETER)
CLASS_MEMBER_METHOD(MeasureRow, {L"row"})
CLASS_MEMBER_METHOD(GetRowWidth, {L"row"})
CLASS_MEMBER_METHOD(GetTextPosFromPoint, {L"point"})
CLASS_MEMBER_METHOD(GetPointFromTextPos, {L"pos"})
CLASS_MEMBER_METHOD(GetRectFromTextPos, {L"pos"})
END_CLASS_MEMBER(text::TextLines)
BEGIN_STRUCT_MEMBER(text::ColorItem)
STRUCT_MEMBER(text)
STRUCT_MEMBER(background)
END_STRUCT_MEMBER(text::ColorItem)
BEGIN_STRUCT_MEMBER(text::ColorEntry)
STRUCT_MEMBER(normal)
STRUCT_MEMBER(selectedFocused)
STRUCT_MEMBER(selectedUnfocused)
END_STRUCT_MEMBER(text::ColorEntry)
BEGIN_CLASS_MEMBER(GuiColorizedTextElement)
CLASS_MEMBER_BASE(IGuiGraphicsElement)
CLASS_MEMBER_EXTERNALCTOR(Ptr<GuiColorizedTextElement>(), NO_PARAMETER, &Element_Constructor<GuiColorizedTextElement>)
CLASS_MEMBER_PROPERTY_FAST(Font)
CLASS_MEMBER_PROPERTY_FAST(PasswordChar)
CLASS_MEMBER_PROPERTY_FAST(ViewPosition)
CLASS_MEMBER_PROPERTY_FAST(VisuallyEnabled)
CLASS_MEMBER_PROPERTY_FAST(Focused)
CLASS_MEMBER_PROPERTY_FAST(CaretBegin)
CLASS_MEMBER_PROPERTY_FAST(CaretEnd)
CLASS_MEMBER_PROPERTY_FAST(CaretVisible)
CLASS_MEMBER_PROPERTY_FAST(CaretColor)
CLASS_MEMBER_EXTERNALMETHOD(GetLines, NO_PARAMETER, text::TextLines*(GuiColorizedTextElement::*)(), &GuiColorizedTextElement_GetLines)
CLASS_MEMBER_PROPERTY_READONLY(Lines, GetLines)
CLASS_MEMBER_PROPERTY_FAST(Colors)
END_CLASS_MEMBER(GuiColorizedTextElement)
BEGIN_CLASS_MEMBER(GuiDocumentElement)
CLASS_MEMBER_BASE(IGuiGraphicsElement)
CLASS_MEMBER_EXTERNALCTOR(Ptr<GuiDocumentElement>(), NO_PARAMETER, &Element_Constructor<GuiDocumentElement>)
CLASS_MEMBER_PROPERTY_FAST(Document)
CLASS_MEMBER_PROPERTY_READONLY_FAST(CaretBegin)
CLASS_MEMBER_PROPERTY_READONLY_FAST(CaretEnd)
CLASS_MEMBER_PROPERTY_FAST(CaretVisible)
CLASS_MEMBER_PROPERTY_FAST(CaretColor)
CLASS_MEMBER_METHOD(IsCaretEndPreferFrontSide, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetCaret, {L"begin" _ L"end" _ L"frontSide"})
CLASS_MEMBER_METHOD(CalculateCaret, {L"comparingCaret" _ L"position" _ L"preferFrontSide"})
CLASS_MEMBER_METHOD(CalculateCaretFromPoint, {L"point"})
CLASS_MEMBER_METHOD(GetCaretBounds, {L"caret" _ L"frontSide"})
CLASS_MEMBER_METHOD(NotifyParagraphUpdated, {L"index" _ L"oldCount" _ L"newCount" _ L"updatedText"})
CLASS_MEMBER_METHOD(EditRun, {L"begin" _ L"end" _ L"model"})
CLASS_MEMBER_METHOD(EditText, {L"begin" _ L"end" _ L"frontSide" _ L"text"})
CLASS_MEMBER_METHOD(EditStyle, {L"begin" _ L"end" _ L"style"})
CLASS_MEMBER_METHOD(EditImage, {L"begin" _ L"end" _ L"image"})
CLASS_MEMBER_METHOD(EditImage, {L"paragraphIndex" _ L"begin" _ L"end" _ L"reference" _ L"normalStyleName" _ L"activeStyleName"})
CLASS_MEMBER_METHOD(RemoveHyperlink, {L"paragraphIndex" _ L"begin" _ L"end"})
CLASS_MEMBER_METHOD(EditStyleName, {L"begin" _ L"end" _ L"styleName"})
CLASS_MEMBER_METHOD(RemoveStyleName, {L"begin" _ L"end" _ L"image"})
CLASS_MEMBER_METHOD(RenameStyle, {L"oldStyleName" _ L"newStyleName"})
CLASS_MEMBER_METHOD(ClearStyle, {L"begin" _ L"end"})
CLASS_MEMBER_METHOD(SummarizeStyle, {L"begin" _ L"end"})
CLASS_MEMBER_METHOD(SetParagraphAlignment, {L"begin" _ L"end" _ L"alignments"})
CLASS_MEMBER_METHOD(GetHyperlinkFromPoint, {L"point"})
END_CLASS_MEMBER(GuiDocumentElement)
#undef _
/***********************************************************************
Type Loader
***********************************************************************/
class GuiElementTypeLoader : public Object, public ITypeLoader
{
public:
void Load(ITypeManager* manager)
{
GUIREFLECTIONELEMENT_TYPELIST(ADD_TYPE_INFO)
}
void Unload(ITypeManager* manager)
{
}
};
#endif
bool LoadGuiElementTypes()
{
#ifndef VCZH_DEBUG_NO_REFLECTION
ITypeManager* manager=GetGlobalTypeManager();
if(manager)
{
Ptr<ITypeLoader> loader=new GuiElementTypeLoader;
return manager->AddTypeLoader(loader);
}
#endif
return false;
}
}
}
}
/***********************************************************************
TypeDescriptors\GuiReflectionEvents.cpp
***********************************************************************/
namespace vl
{
namespace reflection
{
namespace description
{
using namespace collections;
#ifndef VCZH_DEBUG_NO_REFLECTION
GUIREFLECTIONEVENT_TYPELIST(IMPL_TYPE_INFO)
/***********************************************************************
Type Declaration
***********************************************************************/
#define _ ,
#define EVENTARGS_CONSTRUCTOR(EVENTARGS)\
CLASS_MEMBER_CONSTRUCTOR(Ptr<EVENTARGS>(), NO_PARAMETER)\
CLASS_MEMBER_CONSTRUCTOR(Ptr<EVENTARGS>(GuiGraphicsComposition*), {L"composition"})
BEGIN_CLASS_MEMBER(GuiEventArgs)
EVENTARGS_CONSTRUCTOR(GuiEventArgs)
CLASS_MEMBER_FIELD(compositionSource)
CLASS_MEMBER_FIELD(eventSource)
CLASS_MEMBER_FIELD(handled)
END_CLASS_MEMBER(GuiEventArgs)
BEGIN_CLASS_MEMBER(GuiRequestEventArgs)
CLASS_MEMBER_BASE(GuiEventArgs)
EVENTARGS_CONSTRUCTOR(GuiRequestEventArgs)
CLASS_MEMBER_FIELD(cancel)
END_CLASS_MEMBER(GuiRequestEventArgs)
BEGIN_CLASS_MEMBER(GuiKeyEventArgs)
CLASS_MEMBER_BASE(GuiEventArgs)
EVENTARGS_CONSTRUCTOR(GuiKeyEventArgs)
CLASS_MEMBER_FIELD(code)
CLASS_MEMBER_FIELD(ctrl)
CLASS_MEMBER_FIELD(shift)
CLASS_MEMBER_FIELD(alt)
CLASS_MEMBER_FIELD(capslock)
END_CLASS_MEMBER(GuiKeyEventArgs)
BEGIN_CLASS_MEMBER(GuiCharEventArgs)
CLASS_MEMBER_BASE(GuiEventArgs)
EVENTARGS_CONSTRUCTOR(GuiCharEventArgs)
CLASS_MEMBER_FIELD(code)
CLASS_MEMBER_FIELD(ctrl)
CLASS_MEMBER_FIELD(shift)
CLASS_MEMBER_FIELD(alt)
CLASS_MEMBER_FIELD(capslock)
END_CLASS_MEMBER(GuiCharEventArgs)
BEGIN_CLASS_MEMBER(GuiMouseEventArgs)
CLASS_MEMBER_BASE(GuiEventArgs)
EVENTARGS_CONSTRUCTOR(GuiMouseEventArgs)
CLASS_MEMBER_FIELD(ctrl)
CLASS_MEMBER_FIELD(shift)
CLASS_MEMBER_FIELD(left)
CLASS_MEMBER_FIELD(middle)
CLASS_MEMBER_FIELD(right)
CLASS_MEMBER_FIELD(x)
CLASS_MEMBER_FIELD(y)
CLASS_MEMBER_FIELD(wheel)
CLASS_MEMBER_FIELD(nonClient)
END_CLASS_MEMBER(GuiMouseEventArgs)
BEGIN_CLASS_MEMBER(GuiItemEventArgs)
CLASS_MEMBER_BASE(GuiEventArgs)
EVENTARGS_CONSTRUCTOR(GuiItemEventArgs)
CLASS_MEMBER_FIELD(itemIndex)
END_CLASS_MEMBER(GuiItemEventArgs)
BEGIN_CLASS_MEMBER(GuiItemMouseEventArgs)
CLASS_MEMBER_BASE(GuiMouseEventArgs)
EVENTARGS_CONSTRUCTOR(GuiItemMouseEventArgs)
CLASS_MEMBER_FIELD(itemIndex)
END_CLASS_MEMBER(GuiItemMouseEventArgs)
BEGIN_CLASS_MEMBER(GuiNodeEventArgs)
CLASS_MEMBER_BASE(GuiEventArgs)
EVENTARGS_CONSTRUCTOR(GuiNodeEventArgs)
CLASS_MEMBER_FIELD(node)
END_CLASS_MEMBER(GuiNodeEventArgs)
BEGIN_CLASS_MEMBER(GuiNodeMouseEventArgs)
CLASS_MEMBER_BASE(GuiMouseEventArgs)
EVENTARGS_CONSTRUCTOR(GuiNodeMouseEventArgs)
CLASS_MEMBER_FIELD(node)
END_CLASS_MEMBER(GuiNodeMouseEventArgs)
#undef EVENTARGS_CONSTRUCTOR
#undef _
/***********************************************************************
Type Loader
***********************************************************************/
class GuiEventTypeLoader : public Object, public ITypeLoader
{
public:
void Load(ITypeManager* manager)
{
GUIREFLECTIONEVENT_TYPELIST(ADD_TYPE_INFO)
}
void Unload(ITypeManager* manager)
{
}
};
#endif
bool LoadGuiEventTypes()
{
#ifndef VCZH_DEBUG_NO_REFLECTION
ITypeManager* manager=GetGlobalTypeManager();
if(manager)
{
Ptr<ITypeLoader> loader=new GuiEventTypeLoader;
return manager->AddTypeLoader(loader);
}
#endif
return false;
}
}
}
}
/***********************************************************************
TypeDescriptors\GuiReflectionPlugin.cpp
***********************************************************************/
namespace vl
{
namespace reflection
{
namespace description
{
class GuiReflectionPlugin : public Object, public IGuiPlugin
{
public:
void Load()override
{
LoadPredefinedTypes();
LoadParsingTypes();
XmlLoadTypes();
JsonLoadTypes();
LoadGuiBasicTypes();
LoadGuiElementTypes();
LoadGuiCompositionTypes();
LoadGuiControlTypes();
LoadGuiTemplateTypes();
LoadGuiEventTypes();
}
void AfterLoad()override
{
}
void Unload()override
{
}
};
GUI_REGISTER_PLUGIN(GuiReflectionPlugin)
}
}
}
/***********************************************************************
TypeDescriptors\GuiReflectionTemplates.cpp
***********************************************************************/
namespace vl
{
namespace reflection
{
namespace description
{
using namespace collections;
using namespace parsing;
using namespace parsing::tabling;
using namespace parsing::xml;
using namespace stream;
#ifndef VCZH_DEBUG_NO_REFLECTION
GUIREFLECTIONTEMPLATES_TYPELIST(IMPL_TYPE_INFO)
/***********************************************************************
Type Declaration
***********************************************************************/
#define _ ,
#define INTERFACE_EXTERNALCTOR(CONTROL, INTERFACE)\
CLASS_MEMBER_EXTERNALCTOR(decltype(interface_proxy::CONTROL##_##INTERFACE::Create(0))(Ptr<IValueInterfaceProxy>), {L"proxy"}, &interface_proxy::CONTROL##_##INTERFACE::Create)
#define GUI_TEMPLATE_PROPERTY_REFLECTION(CLASS, TYPE, NAME)\
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(NAME)
BEGIN_ENUM_ITEM(BoolOption)
ENUM_CLASS_ITEM(AlwaysTrue)
ENUM_CLASS_ITEM(AlwaysFalse)
ENUM_CLASS_ITEM(Customizable)
END_ENUM_ITEM(BoolOption)
BEGIN_CLASS_MEMBER(GuiTemplate)
CLASS_MEMBER_BASE(GuiBoundsComposition)
CLASS_MEMBER_BASE(GuiInstanceRootObject)
CLASS_MEMBER_CONSTRUCTOR(GuiTemplate*(), NO_PARAMETER)
GuiTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiTemplate)
BEGIN_CLASS_MEMBER(GuiTemplate::IFactory)
INTERFACE_EXTERNALCTOR(GuiTemplate, IFactory)
CLASS_MEMBER_EXTERNALCTOR(Ptr<GuiTemplate::IFactory>(const List<ITypeDescriptor*>&), { L"types" }, &GuiTemplate::IFactory::CreateTemplateFactory)
CLASS_MEMBER_METHOD(CreateTemplate, NO_PARAMETER)
END_CLASS_MEMBER(GuiTemplate::IFactory)
BEGIN_CLASS_MEMBER(GuiControlTemplate)
CLASS_MEMBER_BASE(GuiTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiControlTemplate*(), NO_PARAMETER)
GuiControlTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiControlTemplate)
BEGIN_CLASS_MEMBER(GuiLabelTemplate)
CLASS_MEMBER_BASE(GuiControlTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiLabelTemplate*(), NO_PARAMETER)
GuiLabelTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiLabelTemplate)
BEGIN_CLASS_MEMBER(GuiSinglelineTextBoxTemplate)
CLASS_MEMBER_BASE(GuiControlTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiSinglelineTextBoxTemplate*(), NO_PARAMETER)
GuiSinglelineTextBoxTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiSinglelineTextBoxTemplate)
BEGIN_CLASS_MEMBER(GuiMultilineTextBoxTemplate)
CLASS_MEMBER_BASE(GuiScrollViewTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiMultilineTextBoxTemplate*(), NO_PARAMETER)
GuiMultilineTextBoxTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiMultilineTextBoxTemplate)
BEGIN_CLASS_MEMBER(GuiMenuTemplate)
CLASS_MEMBER_BASE(GuiControlTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiMenuTemplate*(), NO_PARAMETER)
END_CLASS_MEMBER(GuiMenuTemplate)
BEGIN_CLASS_MEMBER(GuiWindowTemplate)
CLASS_MEMBER_BASE(GuiControlTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiWindowTemplate*(), NO_PARAMETER)
GuiWindowTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiWindowTemplate)
BEGIN_CLASS_MEMBER(GuiButtonTemplate)
CLASS_MEMBER_BASE(GuiControlTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiButtonTemplate*(), NO_PARAMETER)
GuiButtonTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiButtonTemplate)
BEGIN_CLASS_MEMBER(GuiSelectableButtonTemplate)
CLASS_MEMBER_BASE(GuiButtonTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiSelectableButtonTemplate*(), NO_PARAMETER)
GuiSelectableButtonTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiSelectableButtonTemplate)
BEGIN_CLASS_MEMBER(GuiToolstripButtonTemplate)
CLASS_MEMBER_BASE(GuiSelectableButtonTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiToolstripButtonTemplate*(), NO_PARAMETER)
GuiToolstripButtonTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiToolstripButtonTemplate)
BEGIN_CLASS_MEMBER(GuiListViewColumnHeaderTemplate)
CLASS_MEMBER_BASE(GuiToolstripButtonTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiListViewColumnHeaderTemplate*(), NO_PARAMETER)
GuiListViewColumnHeaderTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiListViewColumnHeaderTemplate)
BEGIN_CLASS_MEMBER(GuiComboBoxTemplate)
CLASS_MEMBER_BASE(GuiToolstripButtonTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiComboBoxTemplate*(), NO_PARAMETER)
GuiComboBoxTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiComboBoxTemplate)
BEGIN_CLASS_MEMBER(GuiDatePickerTemplate)
CLASS_MEMBER_BASE(GuiControlTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiDatePickerTemplate*(), NO_PARAMETER)
GuiDatePickerTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiDatePickerTemplate)
BEGIN_CLASS_MEMBER(GuiDateComboBoxTemplate)
CLASS_MEMBER_BASE(GuiComboBoxTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiDateComboBoxTemplate*(), NO_PARAMETER)
GuiDateComboBoxTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiDateComboBoxTemplate)
BEGIN_CLASS_MEMBER(GuiScrollTemplate)
CLASS_MEMBER_BASE(GuiControlTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiScrollTemplate*(), NO_PARAMETER)
GuiScrollTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiScrollTemplate)
BEGIN_CLASS_MEMBER(GuiScrollViewTemplate)
CLASS_MEMBER_BASE(GuiControlTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiScrollViewTemplate*(), NO_PARAMETER)
GuiScrollViewTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiScrollViewTemplate)
BEGIN_CLASS_MEMBER(GuiTextListTemplate)
CLASS_MEMBER_BASE(GuiScrollViewTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiTextListTemplate*(), NO_PARAMETER)
GuiTextListTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiTextListTemplate)
BEGIN_CLASS_MEMBER(GuiListViewTemplate)
CLASS_MEMBER_BASE(GuiScrollViewTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiListViewTemplate*(), NO_PARAMETER)
GuiListViewTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiListViewTemplate)
BEGIN_CLASS_MEMBER(GuiTreeViewTemplate)
CLASS_MEMBER_BASE(GuiScrollViewTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiTreeViewTemplate*(), NO_PARAMETER)
GuiTreeViewTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiTreeViewTemplate)
BEGIN_CLASS_MEMBER(GuiTabTemplate)
CLASS_MEMBER_BASE(GuiControlTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiTabTemplate*(), NO_PARAMETER)
GuiTabTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiTabTemplate)
BEGIN_CLASS_MEMBER(GuiListItemTemplate)
CLASS_MEMBER_BASE(GuiTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiListItemTemplate*(), NO_PARAMETER)
GuiListItemTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiListItemTemplate)
BEGIN_CLASS_MEMBER(GuiTreeItemTemplate)
CLASS_MEMBER_BASE(GuiListItemTemplate)
CLASS_MEMBER_CONSTRUCTOR(GuiTreeItemTemplate*(), NO_PARAMETER)
GuiTreeItemTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_REFLECTION)
END_CLASS_MEMBER(GuiTreeItemTemplate)
#undef INTERFACE_EXTERNALCTOR
#undef _
/***********************************************************************
Type Loader
***********************************************************************/
class GuiTemplateTypeLoader : public Object, public ITypeLoader
{
public:
void Load(ITypeManager* manager)
{
GUIREFLECTIONTEMPLATES_TYPELIST(ADD_TYPE_INFO)
}
void Unload(ITypeManager* manager)
{
}
};
#endif
bool LoadGuiTemplateTypes()
{
#ifndef VCZH_DEBUG_NO_REFLECTION
ITypeManager* manager=GetGlobalTypeManager();
if(manager)
{
Ptr<ITypeLoader> loader=new GuiTemplateTypeLoader;
return manager->AddTypeLoader(loader);
}
#endif
return false;
}
}
}
}
| [
"[email protected]"
] | |
65750565558724288394ab67d9fa10be0cd2de19 | 698922de4ba41a01b0e1b0edd5542657d2ea47b5 | /tests/metavoxels/src/MetavoxelTests.h | 3b69c28f7913f2382dbbace44277846e47be8078 | [] | no_license | brotchie/hifi | b74ccbcb1b1de8415db5eb1087fc1ab008aa199c | 19b8f101d8994bd0f9b4a86a45fd0144ed9bc6eb | refs/heads/master | 2020-12-25T21:23:28.295238 | 2014-04-01T01:31:43 | 2014-04-01T01:31:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,116 | h | //
// MetavoxelTests.h
// metavoxel-tests
//
// Created by Andrzej Kapolka on 2/7/14.
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
//
#ifndef __interface__MetavoxelTests__
#define __interface__MetavoxelTests__
#include <QCoreApplication>
#include <QVariantList>
#include <DatagramSequencer.h>
class SequencedTestMessage;
/// Tests various aspects of the metavoxel library.
class MetavoxelTests : public QCoreApplication {
Q_OBJECT
public:
MetavoxelTests(int& argc, char** argv);
/// Performs our various tests.
/// \return true if any of the tests failed.
bool run();
};
/// Represents a simulated endpoint.
class Endpoint : public QObject {
Q_OBJECT
public:
Endpoint(const QByteArray& datagramHeader);
void setOther(Endpoint* other) { _other = other; }
/// Perform a simulation step.
/// \return true if failure was detected
bool simulate(int iterationNumber);
private slots:
void sendDatagram(const QByteArray& datagram);
void handleHighPriorityMessage(const QVariant& message);
void readMessage(Bitstream& in);
void handleReliableMessage(const QVariant& message);
void readReliableChannel();
private:
DatagramSequencer* _sequencer;
Endpoint* _other;
QList<QPair<QByteArray, int> > _delayedDatagrams;
float _highPriorityMessagesToSend;
QVariantList _highPriorityMessagesSent;
QList<SequencedTestMessage> _unreliableMessagesSent;
float _reliableMessagesToSend;
QVariantList _reliableMessagesSent;
CircularBuffer _dataStreamed;
};
/// A simple shared object.
class TestSharedObjectA : public SharedObject {
Q_OBJECT
Q_PROPERTY(float foo READ getFoo WRITE setFoo NOTIFY fooChanged)
public:
Q_INVOKABLE TestSharedObjectA(float foo = 0.0f);
virtual ~TestSharedObjectA();
void setFoo(float foo);
float getFoo() const { return _foo; }
signals:
void fooChanged(float foo);
private:
float _foo;
};
/// Another simple shared object.
class TestSharedObjectB : public SharedObject {
Q_OBJECT
public:
Q_INVOKABLE TestSharedObjectB();
virtual ~TestSharedObjectB();
};
/// A simple test message.
class TestMessageA {
STREAMABLE
public:
STREAM bool foo;
STREAM int bar;
STREAM float baz;
};
DECLARE_STREAMABLE_METATYPE(TestMessageA)
// Another simple test message.
class TestMessageB {
STREAMABLE
public:
STREAM QByteArray foo;
STREAM SharedObjectPointer bar;
};
DECLARE_STREAMABLE_METATYPE(TestMessageB)
// A test message that demonstrates inheritance and composition.
class TestMessageC : STREAM public TestMessageA {
STREAMABLE
public:
STREAM TestMessageB bong;
};
DECLARE_STREAMABLE_METATYPE(TestMessageC)
/// Combines a sequence number with a submessage; used for testing unreliable transport.
class SequencedTestMessage {
STREAMABLE
public:
STREAM int sequenceNumber;
STREAM QVariant submessage;
};
DECLARE_STREAMABLE_METATYPE(SequencedTestMessage)
#endif /* defined(__interface__MetavoxelTests__) */
| [
"[email protected]"
] | |
61ac326f35468f4a507f780e768dcd0e11199f8d | 33f6fe219626a9a7617188d679c7612935fca036 | /src/world/particles/systems/blueorbemitter.h | 9a913ecfbca4f692330b787325b5b99df8e1ba6b | [
"Zlib"
] | permissive | Eae02/tank-game | 0fbd19fc54a115c3ab60a2a44a5f5f8e3cf177d1 | 47d65f967fddd5702af0a1f91c18271c6faddfa0 | refs/heads/master | 2022-09-26T21:43:10.211083 | 2022-09-05T09:38:51 | 2022-09-05T09:38:51 | 73,844,310 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 713 | h | #pragma once
#include "../particleemitter.h"
#include "../spherevec2generator.h"
#include "../../../graphics/gl/texture2darray.h"
namespace TankGame
{
class BlueOrbEmitter : public ParticleEmitter
{
public:
explicit BlueOrbEmitter(ParticlesManager& particlesManager);
void SetTransformationProvider(const class ITransformationProvider* transformationProvider);
protected:
virtual glm::vec2 GeneratePosition(float subframeInterpolation) const override;
virtual glm::vec2 GenerateVelocity(float subframeInterpolation) const override;
private:
static std::unique_ptr<Texture2DArray> s_texture;
SphereVec2Generator m_positionGenerator;
SphereVec2Generator m_velocityGenerator;
};
}
| [
"[email protected]"
] | |
6f04898636ae46279b967c7a4d6b5cca82befa8e | 472716a1b886bc94b606cb69982852d2147f77f5 | /JappDefence/Constants.cpp | 70aa02ec9af015e19fb0a01a3e9b3297deec7b97 | [] | no_license | MattBulk/University | 8cf7f83eb5aff9503690d5903447c2da30945214 | ec634319d7ccf451822fb93e538e15ff978f6bc1 | refs/heads/master | 2021-09-24T09:25:00.956575 | 2018-10-06T19:18:59 | 2018-10-06T19:18:59 | 101,629,768 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 287 | cpp | #include "Constants.h"
const int GConst::STAGE_WIDTH;
const int GConst::STAGE_HEIGHT;
/** GUI CONSTANTS */
const int GConst::GUI_DIM;
/** GAME BUILD */
const int GConst::H_DIM;
const int GConst::W_DIM;
const int GConst::H_OFFSET;
const int GConst::TILE_SIZE;
const int GConst::B_DIM;
| [
"[email protected]"
] | |
e9445f0877048ea27618a0247ca4fb79a594f78c | 0161bbca7c04b50577072302f6e49839c07a8027 | /狐の帰り道/開発環境/狐の帰り道/SorceCode/BackGround/CBackGround.h | fa81e3d711cd3df75e9d73948d049eecc526d3fe | [] | no_license | Ina1206/WayBackTheFox | 36303a668f69ab445fa578d6a5ffabf922e99745 | ac9b9de35b1caa1a544334d63a8b77c231489bf2 | refs/heads/master | 2022-11-09T21:39:15.835756 | 2020-07-02T10:17:19 | 2020-07-02T10:17:19 | null | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 945 | h | #ifndef CBACK_GROUND_H
#define CBACK_GROUND_H
#include "..\Global.h"
#include "..\Drawing\Resource\CResourceManager.h"
/********************************************
* 背景オブジェクトクラス.
*****/
class CBackGround
{
public:
CBackGround();
~CBackGround();
//====================定数=======================//.
const D3DXVECTOR3 POSITION = D3DXVECTOR3(0.0f, 0.0f, 0.0f); //位置設定.
const float SCALE = 0.01f; //大きさ.
const D3DXVECTOR3 ROTATION = D3DXVECTOR3(0.0f, 3.2f, 0.0f); //回転角度.
//====================関数=======================//.
void Render(D3DXMATRIX& mView, D3DXMATRIX& mProj, D3DXVECTOR3& vLight, D3DXVECTOR3& vCameraPos); //描画処理関数.
private:
void Init(); //初期化処理関数.
void Release(); //解放処理関数.
//====================変数=========================//.
CDX9Mesh* m_pCDx9Mesh; //メッシュクラス.
};
#endif //#ifndef CBACK_GROUND_H. | [
"hera@PC-09"
] | hera@PC-09 |
047847a4050e0ec512d10927ce58bb58a2f2c74e | 71d42080afd73d6b93153f4668d5bf067a9d03f4 | /steper_move.ino | 697556a54a0c5f84748f6cfa0f39f3001ebd9865 | [] | no_license | R0ut/NEMA17-A4988-Stepper-Motor-Driver | 92d10e589da0651e92fd3ffebd1cadc108213082 | 70930ff6a11dc8d5df7cc380172f71513b1463c4 | refs/heads/master | 2021-07-23T08:30:46.632621 | 2017-11-02T17:24:54 | 2017-11-02T17:24:54 | 109,296,771 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,322 | ino | //ardiuno used pins
const int stepPin = 3;
const int dirPin = 4;
int del = 0; // delay between single mottor step
int steps = 0; //motor steps
void setup() {
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
Serial.begin(463611);
Serial.setTimeout(0);
digitalWrite(8,HIGH);//ms2
digitalWrite(9,LOW);//ms3
digitalWrite(10,LOW);//ms1
}
void loop() {
while(!Serial.available()); //Wait for data from PC
del = Serial.readString().toInt(); //Sets delay recived from PC
for(int i=0;i<=5;i++)
{
steps++;
Forwards(); //Execute one step forward
}
if(steps == 8400){
steps =0;
delayMicroseconds(1000);
for(int j=0;j<8400;j++){
Backward(); //Execute one step backward
}
}
Serial.println(steps); //Send data to PC through serial
}
//Forwards step
void Forwards()
{
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
digitalWrite(stepPin,HIGH);
delayMicroseconds(del);
digitalWrite(stepPin,LOW);
delayMicroseconds(del);
}
//Backword step
void Backward()
{
digitalWrite(dirPin,LOW); // Enables the motor to move in a back direction
digitalWrite(stepPin,HIGH);
delayMicroseconds(400);
digitalWrite(stepPin,LOW);
delayMicroseconds(400);
}
| [
"[email protected]"
] | |
2793aa096a0271df0d5ae8c0e7c595a0040cbbcb | 63c71060f36866bca4ac27304cef6d5755fdc35c | /src/JimoAPI/JimoExpr.h | 2fc4827825ae929d85b34bf3f474acd7a4cb6566 | [] | no_license | 15831944/barry_dev | bc8441cbfbd4b62fbb42bee3dcb79ff7f5fcaf8a | d4a83421458aa28ca293caa7a5567433e9358596 | refs/heads/master | 2022-03-24T07:00:26.810732 | 2015-12-22T07:19:58 | 2015-12-22T07:19:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,244 | h | ////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2005
// Packet Engineering, Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification is not permitted unless authorized in writing by a duly
// appointed officer of Packet Engineering, Inc. or its derivatives
//
// Description:
//
//
// Modification History:
// 2015/05/25 Created by Chen Ding
////////////////////////////////////////////////////////////////////////////
#ifndef Aos_JimoAPI_JimoCubeMap_h
#define Aos_JimoAPI_JimoCubeMap_h
//#include "JimoObj/Ptrs.h"
#include "SEInterfaces/Ptrs.h"
#include "Util/String.h"
#include <vector>
class AosRundata;
class AosNameValueDoc;
namespace Jimo
{
AosExprObjPtr jimoCreateNameValueExpr(
const OmnString &name,
const OmnString &value);
AosExprObjPtr jimoCreateNameValueExpr(
const OmnString &name,
const AosExprObjPtr &expr);
AosExprObjPtr jimoCreateNameValueExpr(
const OmnString &name,
const std::vector<AosExprObjPtr> &exprs);
AosExprObjPtr jimoCreateNameValueExpr(
const std::vector<AosExprObjPtr> &exprs);
AosExprObjPtr jimoCreateStrExpr(const OmnString &value);
};
#endif
| [
"[email protected]"
] | |
950a04ffe435120a601411e63c90005888a58f02 | 409df118ca2a128492e609e885a66f5d95bf4777 | /3rdparties/camera_models/src/camera_models/EquidistantCamera.cc | 18dc4b3ab126ffa87203eb6d61fa68d2f3fd4fa0 | [] | no_license | cggos/ARDemoGL | 09cd9de3fbd629b00f190498d6e045021d03a06b | 3070a462ce63e9544705a5ef29a01823efcd0ed2 | refs/heads/master | 2023-02-20T10:56:09.087971 | 2021-01-26T02:41:23 | 2021-01-26T02:41:23 | 332,771,379 | 3 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 20,442 | cc | #include "camodocal/camera_models/EquidistantCamera.h"
#include <cmath>
#include <cstdio>
#include <Eigen/Dense>
#include <iomanip>
#include <iostream>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/core/eigen.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include "camodocal/gpl/gpl.h"
namespace camodocal
{
EquidistantCamera::Parameters::Parameters()
: Camera::Parameters(KANNALA_BRANDT)
, m_k2(0.0)
, m_k3(0.0)
, m_k4(0.0)
, m_k5(0.0)
, m_mu(0.0)
, m_mv(0.0)
, m_u0(0.0)
, m_v0(0.0)
{
}
EquidistantCamera::Parameters::Parameters(const std::string& cameraName,
int w, int h,
double k2, double k3, double k4, double k5,
double mu, double mv,
double u0, double v0)
: Camera::Parameters(KANNALA_BRANDT, cameraName, w, h)
, m_k2(k2)
, m_k3(k3)
, m_k4(k4)
, m_k5(k5)
, m_mu(mu)
, m_mv(mv)
, m_u0(u0)
, m_v0(v0)
{
}
double&
EquidistantCamera::Parameters::k2(void)
{
return m_k2;
}
double&
EquidistantCamera::Parameters::k3(void)
{
return m_k3;
}
double&
EquidistantCamera::Parameters::k4(void)
{
return m_k4;
}
double&
EquidistantCamera::Parameters::k5(void)
{
return m_k5;
}
double&
EquidistantCamera::Parameters::mu(void)
{
return m_mu;
}
double&
EquidistantCamera::Parameters::mv(void)
{
return m_mv;
}
double&
EquidistantCamera::Parameters::u0(void)
{
return m_u0;
}
double&
EquidistantCamera::Parameters::v0(void)
{
return m_v0;
}
double
EquidistantCamera::Parameters::k2(void) const
{
return m_k2;
}
double
EquidistantCamera::Parameters::k3(void) const
{
return m_k3;
}
double
EquidistantCamera::Parameters::k4(void) const
{
return m_k4;
}
double
EquidistantCamera::Parameters::k5(void) const
{
return m_k5;
}
double
EquidistantCamera::Parameters::mu(void) const
{
return m_mu;
}
double
EquidistantCamera::Parameters::mv(void) const
{
return m_mv;
}
double
EquidistantCamera::Parameters::u0(void) const
{
return m_u0;
}
double
EquidistantCamera::Parameters::v0(void) const
{
return m_v0;
}
bool
EquidistantCamera::Parameters::readFromYamlFile(const std::string& filename)
{
cv::FileStorage fs(filename, cv::FileStorage::READ);
if (!fs.isOpened())
{
return false;
}
if (!fs["model_type"].isNone())
{
std::string sModelType;
fs["model_type"] >> sModelType;
if (sModelType.compare("KANNALA_BRANDT") != 0)
{
return false;
}
}
m_modelType = KANNALA_BRANDT;
fs["camera_name"] >> m_cameraName;
m_imageWidth = static_cast<int>(fs["image_width"]);
m_imageHeight = static_cast<int>(fs["image_height"]);
cv::FileNode n = fs["projection_parameters"];
m_k2 = static_cast<double>(n["k2"]);
m_k3 = static_cast<double>(n["k3"]);
m_k4 = static_cast<double>(n["k4"]);
m_k5 = static_cast<double>(n["k5"]);
m_mu = static_cast<double>(n["mu"]);
m_mv = static_cast<double>(n["mv"]);
m_u0 = static_cast<double>(n["u0"]);
m_v0 = static_cast<double>(n["v0"]);
return true;
}
void
EquidistantCamera::Parameters::writeToYamlFile(const std::string& filename) const
{
cv::FileStorage fs(filename, cv::FileStorage::WRITE);
fs << "model_type" << "KANNALA_BRANDT";
fs << "camera_name" << m_cameraName;
fs << "image_width" << m_imageWidth;
fs << "image_height" << m_imageHeight;
// projection: k2, k3, k4, k5, mu, mv, u0, v0
fs << "projection_parameters";
fs << "{" << "k2" << m_k2
<< "k3" << m_k3
<< "k4" << m_k4
<< "k5" << m_k5
<< "mu" << m_mu
<< "mv" << m_mv
<< "u0" << m_u0
<< "v0" << m_v0 << "}";
fs.release();
}
EquidistantCamera::Parameters&
EquidistantCamera::Parameters::operator=(const EquidistantCamera::Parameters& other)
{
if (this != &other)
{
m_modelType = other.m_modelType;
m_cameraName = other.m_cameraName;
m_imageWidth = other.m_imageWidth;
m_imageHeight = other.m_imageHeight;
m_k2 = other.m_k2;
m_k3 = other.m_k3;
m_k4 = other.m_k4;
m_k5 = other.m_k5;
m_mu = other.m_mu;
m_mv = other.m_mv;
m_u0 = other.m_u0;
m_v0 = other.m_v0;
}
return *this;
}
std::ostream&
operator<< (std::ostream& out, const EquidistantCamera::Parameters& params)
{
out << "Camera Parameters:" << std::endl;
out << " model_type " << "KANNALA_BRANDT" << std::endl;
out << " camera_name " << params.m_cameraName << std::endl;
out << " image_width " << params.m_imageWidth << std::endl;
out << " image_height " << params.m_imageHeight << std::endl;
// projection: k2, k3, k4, k5, mu, mv, u0, v0
out << "Projection Parameters" << std::endl;
out << " k2 " << params.m_k2 << std::endl
<< " k3 " << params.m_k3 << std::endl
<< " k4 " << params.m_k4 << std::endl
<< " k5 " << params.m_k5 << std::endl
<< " mu " << params.m_mu << std::endl
<< " mv " << params.m_mv << std::endl
<< " u0 " << params.m_u0 << std::endl
<< " v0 " << params.m_v0 << std::endl;
return out;
}
EquidistantCamera::EquidistantCamera()
: m_inv_K11(1.0)
, m_inv_K13(0.0)
, m_inv_K22(1.0)
, m_inv_K23(0.0)
{
}
EquidistantCamera::EquidistantCamera(const std::string& cameraName,
int imageWidth, int imageHeight,
double k2, double k3, double k4, double k5,
double mu, double mv,
double u0, double v0)
: mParameters(cameraName, imageWidth, imageHeight,
k2, k3, k4, k5, mu, mv, u0, v0)
{
// Inverse camera projection matrix parameters
m_inv_K11 = 1.0 / mParameters.mu();
m_inv_K13 = -mParameters.u0() / mParameters.mu();
m_inv_K22 = 1.0 / mParameters.mv();
m_inv_K23 = -mParameters.v0() / mParameters.mv();
}
EquidistantCamera::EquidistantCamera(const EquidistantCamera::Parameters& params)
: mParameters(params)
{
// Inverse camera projection matrix parameters
m_inv_K11 = 1.0 / mParameters.mu();
m_inv_K13 = -mParameters.u0() / mParameters.mu();
m_inv_K22 = 1.0 / mParameters.mv();
m_inv_K23 = -mParameters.v0() / mParameters.mv();
}
Camera::ModelType
EquidistantCamera::modelType(void) const
{
return mParameters.modelType();
}
const std::string&
EquidistantCamera::cameraName(void) const
{
return mParameters.cameraName();
}
int
EquidistantCamera::imageWidth(void) const
{
return mParameters.imageWidth();
}
int
EquidistantCamera::imageHeight(void) const
{
return mParameters.imageHeight();
}
void
EquidistantCamera::estimateIntrinsics(const cv::Size& boardSize,
const std::vector< std::vector<cv::Point3f> >& objectPoints,
const std::vector< std::vector<cv::Point2f> >& imagePoints)
{
Parameters params = getParameters();
double u0 = params.imageWidth() / 2.0;
double v0 = params.imageHeight() / 2.0;
double minReprojErr = std::numeric_limits<double>::max();
std::vector<cv::Mat> rvecs, tvecs;
rvecs.assign(objectPoints.size(), cv::Mat());
tvecs.assign(objectPoints.size(), cv::Mat());
params.k2() = 0.0;
params.k3() = 0.0;
params.k4() = 0.0;
params.k5() = 0.0;
params.u0() = u0;
params.v0() = v0;
// Initialize focal length
// C. Hughes, P. Denny, M. Glavin, and E. Jones,
// Equidistant Fish-Eye Calibration and Rectification by Vanishing Point
// Extraction, PAMI 2010
// Find circles from rows of chessboard corners, and for each pair
// of circles, find vanishing points: v1 and v2.
// f = ||v1 - v2|| / PI;
double f0 = 0.0;
for (size_t i = 0; i < imagePoints.size(); ++i)
{
std::vector<Eigen::Vector2d> center(boardSize.height);
double radius[boardSize.height];
for (int r = 0; r < boardSize.height; ++r)
{
std::vector<cv::Point2d> circle;
for (int c = 0; c < boardSize.width; ++c)
{
circle.push_back(imagePoints.at(i).at(r * boardSize.width + c));
}
fitCircle(circle, center[r](0), center[r](1), radius[r]);
}
for (int j = 0; j < boardSize.height; ++j)
{
for (int k = j + 1; k < boardSize.height; ++k)
{
// find distance between pair of vanishing points which
// correspond to intersection points of 2 circles
std::vector<cv::Point2d> ipts;
ipts = intersectCircles(center[j](0), center[j](1), radius[j],
center[k](0), center[k](1), radius[k]);
if (ipts.size() < 2)
{
continue;
}
double f = cv::norm(ipts.at(0) - ipts.at(1)) / M_PI;
params.mu() = f;
params.mv() = f;
setParameters(params);
for (size_t l = 0; l < objectPoints.size(); ++l)
{
estimateExtrinsics(objectPoints.at(l), imagePoints.at(l), rvecs.at(l), tvecs.at(l));
}
double reprojErr = reprojectionError(objectPoints, imagePoints, rvecs, tvecs, cv::noArray());
if (reprojErr < minReprojErr)
{
minReprojErr = reprojErr;
f0 = f;
}
}
}
}
if (f0 <= 0.0 && minReprojErr >= std::numeric_limits<double>::max())
{
std::cout << "[" << params.cameraName() << "] "
<< "# INFO: kannala-Brandt model fails with given data. " << std::endl;
return;
}
params.mu() = f0;
params.mv() = f0;
setParameters(params);
}
/**
* \brief Lifts a point from the image plane to the unit sphere
*
* \param p image coordinates
* \param P coordinates of the point on the sphere
*/
void
EquidistantCamera::liftSphere(const Eigen::Vector2d& p, Eigen::Vector3d& P) const
{
liftProjective(p, P);
}
/**
* \brief Lifts a point from the image plane to its projective ray
*
* \param p image coordinates
* \param P coordinates of the projective ray
*/
void
EquidistantCamera::liftProjective(const Eigen::Vector2d& p, Eigen::Vector3d& P) const
{
// Lift points to normalised plane
Eigen::Vector2d p_u;
p_u << m_inv_K11 * p(0) + m_inv_K13,
m_inv_K22 * p(1) + m_inv_K23;
// Obtain a projective ray
double theta, phi;
backprojectSymmetric(p_u, theta, phi);
P(0) = sin(theta) * cos(phi);
P(1) = sin(theta) * sin(phi);
P(2) = cos(theta);
}
/**
* \brief Project a 3D point (\a x,\a y,\a z) to the image plane in (\a u,\a v)
*
* \param P 3D point coordinates
* \param p return value, contains the image point coordinates
*/
void
EquidistantCamera::spaceToPlane(const Eigen::Vector3d& P, Eigen::Vector2d& p) const
{
double theta = acos(P(2) / P.norm());
double phi = atan2(P(1), P(0));
Eigen::Vector2d p_u = r(mParameters.k2(), mParameters.k3(), mParameters.k4(), mParameters.k5(), theta) * Eigen::Vector2d(cos(phi), sin(phi));
// Apply generalised projection matrix
p << mParameters.mu() * p_u(0) + mParameters.u0(),
mParameters.mv() * p_u(1) + mParameters.v0();
}
/**
* \brief Project a 3D point to the image plane and calculate Jacobian
*
* \param P 3D point coordinates
* \param p return value, contains the image point coordinates
*/
void
EquidistantCamera::spaceToPlane(const Eigen::Vector3d& P, Eigen::Vector2d& p,
Eigen::Matrix<double,2,3>& J) const
{
double theta = acos(P(2) / P.norm());
double phi = atan2(P(1), P(0));
Eigen::Vector2d p_u = r(mParameters.k2(), mParameters.k3(), mParameters.k4(), mParameters.k5(), theta) * Eigen::Vector2d(cos(phi), sin(phi));
// Apply generalised projection matrix
p << mParameters.mu() * p_u(0) + mParameters.u0(),
mParameters.mv() * p_u(1) + mParameters.v0();
}
/**
* \brief Projects an undistorted 2D point p_u to the image plane
*
* \param p_u 2D point coordinates
* \return image point coordinates
*/
void
EquidistantCamera::undistToPlane(const Eigen::Vector2d& p_u, Eigen::Vector2d& p) const
{
// Eigen::Vector2d p_d;
//
// if (m_noDistortion)
// {
// p_d = p_u;
// }
// else
// {
// // Apply distortion
// Eigen::Vector2d d_u;
// distortion(p_u, d_u);
// p_d = p_u + d_u;
// }
//
// // Apply generalised projection matrix
// p << mParameters.gamma1() * p_d(0) + mParameters.u0(),
// mParameters.gamma2() * p_d(1) + mParameters.v0();
}
void
EquidistantCamera::initUndistortMap(cv::Mat& map1, cv::Mat& map2, double fScale) const
{
cv::Size imageSize(mParameters.imageWidth(), mParameters.imageHeight());
cv::Mat mapX = cv::Mat::zeros(imageSize, CV_32F);
cv::Mat mapY = cv::Mat::zeros(imageSize, CV_32F);
for (int v = 0; v < imageSize.height; ++v)
{
for (int u = 0; u < imageSize.width; ++u)
{
double mx_u = m_inv_K11 / fScale * u + m_inv_K13 / fScale;
double my_u = m_inv_K22 / fScale * v + m_inv_K23 / fScale;
double theta, phi;
backprojectSymmetric(Eigen::Vector2d(mx_u, my_u), theta, phi);
Eigen::Vector3d P;
P << sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta);
Eigen::Vector2d p;
spaceToPlane(P, p);
mapX.at<float>(v,u) = p(0);
mapY.at<float>(v,u) = p(1);
}
}
cv::convertMaps(mapX, mapY, map1, map2, CV_32FC1, false);
}
cv::Mat
EquidistantCamera::initUndistortRectifyMap(cv::Mat& map1, cv::Mat& map2,
float fx, float fy,
cv::Size imageSize,
float cx, float cy,
cv::Mat rmat) const
{
if (imageSize == cv::Size(0, 0))
{
imageSize = cv::Size(mParameters.imageWidth(), mParameters.imageHeight());
}
cv::Mat mapX = cv::Mat::zeros(imageSize.height, imageSize.width, CV_32F);
cv::Mat mapY = cv::Mat::zeros(imageSize.height, imageSize.width, CV_32F);
Eigen::Matrix3f K_rect;
if (cx == -1.0f && cy == -1.0f)
{
K_rect << fx, 0, imageSize.width / 2,
0, fy, imageSize.height / 2,
0, 0, 1;
}
else
{
K_rect << fx, 0, cx,
0, fy, cy,
0, 0, 1;
}
if (fx == -1.0f || fy == -1.0f)
{
K_rect(0,0) = mParameters.mu();
K_rect(1,1) = mParameters.mv();
}
Eigen::Matrix3f K_rect_inv = K_rect.inverse();
Eigen::Matrix3f R, R_inv;
cv::cv2eigen(rmat, R);
R_inv = R.inverse();
for (int v = 0; v < imageSize.height; ++v)
{
for (int u = 0; u < imageSize.width; ++u)
{
Eigen::Vector3f xo;
xo << u, v, 1;
Eigen::Vector3f uo = R_inv * K_rect_inv * xo;
Eigen::Vector2d p;
spaceToPlane(uo.cast<double>(), p);
mapX.at<float>(v,u) = p(0);
mapY.at<float>(v,u) = p(1);
}
}
cv::convertMaps(mapX, mapY, map1, map2, CV_32FC1, false);
cv::Mat K_rect_cv;
cv::eigen2cv(K_rect, K_rect_cv);
return K_rect_cv;
}
int
EquidistantCamera::parameterCount(void) const
{
return 8;
}
const EquidistantCamera::Parameters&
EquidistantCamera::getParameters(void) const
{
return mParameters;
}
void
EquidistantCamera::setParameters(const EquidistantCamera::Parameters& parameters)
{
mParameters = parameters;
// Inverse camera projection matrix parameters
m_inv_K11 = 1.0 / mParameters.mu();
m_inv_K13 = -mParameters.u0() / mParameters.mu();
m_inv_K22 = 1.0 / mParameters.mv();
m_inv_K23 = -mParameters.v0() / mParameters.mv();
}
void
EquidistantCamera::readParameters(const std::vector<double>& parameterVec)
{
if (parameterVec.size() != parameterCount())
{
return;
}
Parameters params = getParameters();
params.k2() = parameterVec.at(0);
params.k3() = parameterVec.at(1);
params.k4() = parameterVec.at(2);
params.k5() = parameterVec.at(3);
params.mu() = parameterVec.at(4);
params.mv() = parameterVec.at(5);
params.u0() = parameterVec.at(6);
params.v0() = parameterVec.at(7);
setParameters(params);
}
void
EquidistantCamera::writeParameters(std::vector<double>& parameterVec) const
{
parameterVec.resize(parameterCount());
parameterVec.at(0) = mParameters.k2();
parameterVec.at(1) = mParameters.k3();
parameterVec.at(2) = mParameters.k4();
parameterVec.at(3) = mParameters.k5();
parameterVec.at(4) = mParameters.mu();
parameterVec.at(5) = mParameters.mv();
parameterVec.at(6) = mParameters.u0();
parameterVec.at(7) = mParameters.v0();
}
void
EquidistantCamera::writeParametersToYamlFile(const std::string& filename) const
{
mParameters.writeToYamlFile(filename);
}
std::string
EquidistantCamera::parametersToString(void) const
{
std::ostringstream oss;
oss << mParameters;
return oss.str();
}
void
EquidistantCamera::fitOddPoly(const std::vector<double>& x, const std::vector<double>& y,
int n, std::vector<double>& coeffs) const
{
std::vector<int> pows;
for (int i = 1; i <= n; i += 2)
{
pows.push_back(i);
}
Eigen::MatrixXd X(x.size(), pows.size());
Eigen::MatrixXd Y(y.size(), 1);
for (size_t i = 0; i < x.size(); ++i)
{
for (size_t j = 0; j < pows.size(); ++j)
{
X(i,j) = pow(x.at(i), pows.at(j));
}
Y(i,0) = y.at(i);
}
Eigen::MatrixXd A = (X.transpose() * X).inverse() * X.transpose() * Y;
coeffs.resize(A.rows());
for (int i = 0; i < A.rows(); ++i)
{
coeffs.at(i) = A(i,0);
}
}
void
EquidistantCamera::backprojectSymmetric(const Eigen::Vector2d& p_u,
double& theta, double& phi) const
{
double tol = 1e-10;
double p_u_norm = p_u.norm();
if (p_u_norm < 1e-10)
{
phi = 0.0;
}
else
{
phi = atan2(p_u(1), p_u(0));
}
int npow = 9;
if (mParameters.k5() == 0.0)
{
npow -= 2;
}
if (mParameters.k4() == 0.0)
{
npow -= 2;
}
if (mParameters.k3() == 0.0)
{
npow -= 2;
}
if (mParameters.k2() == 0.0)
{
npow -= 2;
}
Eigen::MatrixXd coeffs(npow + 1, 1);
coeffs.setZero();
coeffs(0) = -p_u_norm;
coeffs(1) = 1.0;
if (npow >= 3)
{
coeffs(3) = mParameters.k2();
}
if (npow >= 5)
{
coeffs(5) = mParameters.k3();
}
if (npow >= 7)
{
coeffs(7) = mParameters.k4();
}
if (npow >= 9)
{
coeffs(9) = mParameters.k5();
}
if (npow == 1)
{
theta = p_u_norm;
}
else
{
// Get eigenvalues of companion matrix corresponding to polynomial.
// Eigenvalues correspond to roots of polynomial.
Eigen::MatrixXd A(npow, npow);
A.setZero();
A.block(1, 0, npow - 1, npow - 1).setIdentity();
A.col(npow - 1) = - coeffs.block(0, 0, npow, 1) / coeffs(npow);
Eigen::EigenSolver<Eigen::MatrixXd> es(A);
Eigen::MatrixXcd eigval = es.eigenvalues();
std::vector<double> thetas;
for (int i = 0; i < eigval.rows(); ++i)
{
if (fabs(eigval(i).imag()) > tol)
{
continue;
}
double t = eigval(i).real();
if (t < -tol)
{
continue;
}
else if (t < 0.0)
{
t = 0.0;
}
thetas.push_back(t);
}
if (thetas.empty())
{
theta = p_u_norm;
}
else
{
theta = *std::min_element(thetas.begin(), thetas.end());
}
}
}
}
| [
"[email protected]"
] | |
25eb6fe03744f07522764fde90704980198d63bb | a3d6556180e74af7b555f8d47d3fea55b94bcbda | /content/browser/file_system_access/features.cc | 0af62a47bcf146930c65ac5a4a8d02beed7534b4 | [
"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 | 3,519 | cc | // 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.
#include "content/browser/file_system_access/features.h"
#include "base/feature_list.h"
#include "build/build_config.h"
namespace content::features {
// TODO(crbug.com/1370433): Remove this flag eventually.
// When enabled, drag-and-dropped files and directories will be checked against
// the File System Access blocklist. This feature was disabled since it broke
// some applications.
BASE_FEATURE(kFileSystemAccessDragAndDropCheckBlocklist,
"FileSystemAccessDragAndDropCheckBlocklist",
base::FEATURE_DISABLED_BY_DEFAULT);
// TODO(crbug.com/1381621): Remove this flag eventually.
// When enabled, move() will result in a promise rejection when the specified
// destination to move to exists. This feature was disabled since it does not
// match standard POSIX behavior. See discussion at
// https://github.com/whatwg/fs/pull/10#issuecomment-1322993643.
BASE_FEATURE(kFileSystemAccessDoNotOverwriteOnMove,
"FileSystemAccessDoNotOverwriteOnMove",
base::FEATURE_DISABLED_BY_DEFAULT);
// TODO(crbug.com/1140805): Remove this flag eventually.
// When enabled, move() supports moving local files (i.e. that do not live in
// the OPFS).
BASE_FEATURE(kFileSystemAccessMoveLocalFiles,
"FileSystemAccessMoveLocalFiles",
base::FEATURE_ENABLED_BY_DEFAULT);
// TODO(crbug.com/1114923): Remove this flag eventually.
// When enabled, the remove() method is enabled. Otherwise, throws a
// NotSupportedError DomException.
BASE_FEATURE(kFileSystemAccessRemove,
"FileSystemAccessRemove",
base::FEATURE_ENABLED_BY_DEFAULT);
// TODO(crbug.com/1394837): Remove this flag eventually.
// When enabled, a user gesture is required to rename a file if the site does
// not have write access to the parent. See http://b/254157070 for more context.
BASE_FEATURE(kFileSystemAccessRenameWithoutParentAccessRequiresUserActivation,
"FileSystemAccessRenameWithoutParentAccessRequiresUserActivation",
base::FEATURE_ENABLED_BY_DEFAULT);
// TODO(crbug.com/1247850): Remove this flag eventually.
// When enabled, move operations within the same file system that do not change
// the file extension will not be subject to safe browsing checks.
BASE_FEATURE(kFileSystemAccessSkipAfterWriteChecksIfUnchangingExtension,
"FileSystemAccessSkipAfterWriteChecksIfUnchangingExtension",
base::FEATURE_ENABLED_BY_DEFAULT);
// TODO(crbug.com/1421735): Remove this flag eventually.
// When enabled, GetFile() and GetEntries() on the directory handle resolve
// symbolic link (if any) and check the path against the blocklis, on POSIX.
// This feature was disabled since it broke some applications.
BASE_FEATURE(kFileSystemAccessDirectoryIterationSymbolicLinkCheck,
"FileSystemAccessDirectoryIterationSymbolicLinkCheck",
base::FEATURE_DISABLED_BY_DEFAULT);
#if BUILDFLAG(IS_MAC)
// TODO(crbug.com/1413443): Remove this flag eventually.
// When enabled, createWritable({ keepExistingData:true }) will create a swap
// file using APFS's built-in support for copy-on-write files instead of copying
// over the file's contents manually.
BASE_FEATURE(kFileSystemAccessCowSwapFile,
"FileSystemAccessCowSwapFile",
base::FEATURE_ENABLED_BY_DEFAULT);
#endif // BUILDFLAG(IS_MAC)
} // namespace content::features
| [
"[email protected]"
] | |
4e7630df1fdf2ee18465264ddbeea83573cd1f94 | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/curl/gumtree/curl_old_log_3092.cpp | 25cee0336ea5af19d0d5bc805d65c7d78ffddc26 | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 525 | cpp | fputs(
" be exact). To make commands take place after a successful trans‐\n"
" fer, prefix them with a dash ’-’. To make commands get sent\n"
" after libcurl has changed working directory, just before the\n"
" transfer command(s), prefix the command with ’+’ (this is only\n"
" supported for FTP). You may specify any number of commands. If\n"
" the server returns failure for one of the commands, the entire\n"
, stdout); | [
"[email protected]"
] | |
2267e71608b460fedbf9ac56076340c11c8960ac | 00898a0e0ac2ae92cd112d2febf8d2b16fb65da4 | /Project_code/PLC-Comm/include/QtPlatformSupport/5.5.0/QtPlatformSupport/private/qcfsocketnotifier_p.h | 66f23c66a18c3ce7d1e4274af0f87807da4c3d35 | [] | no_license | yisea123/AM-project | 24dd643a2f2086ea739cf48a4c6e8f95c11e42a7 | f1f7386a04985fcbd5d4fc00707cc5c3726c4ff4 | refs/heads/master | 2020-09-01T23:47:58.300736 | 2018-09-24T11:57:57 | 2018-09-24T11:57:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,476 | h | /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QCFSOCKETNOTIFIER_P_H
#define QCFSOCKETNOTIFIER_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/qabstracteventdispatcher.h>
#include <QtCore/qhash.h>
#include <CoreFoundation/CoreFoundation.h>
QT_BEGIN_NAMESPACE
struct MacSocketInfo {
MacSocketInfo() : socket(0), runloop(0), readNotifier(0), writeNotifier(0) {}
CFSocketRef socket;
CFRunLoopSourceRef runloop;
QObject *readNotifier;
QObject *writeNotifier;
};
typedef QHash<int, MacSocketInfo *> MacSocketHash;
typedef void (*MaybeCancelWaitForMoreEventsFn)(QAbstractEventDispatcher *hostEventDispacher);
// The CoreFoundationSocketNotifier class implements socket notifiers support using
// CFSocket for event dispatchers running on top of the Core Foundation run loop system.
// (currently Mac and iOS)
//
// The principal functions are registerSocketNotifier() and unregisterSocketNotifier().
//
// setHostEventDispatcher() should be called at startup.
// removeSocketNotifiers() should be called at shutdown.
//
class QCFSocketNotifier
{
public:
QCFSocketNotifier();
~QCFSocketNotifier();
void setHostEventDispatcher(QAbstractEventDispatcher *hostEventDispacher);
void setMaybeCancelWaitForMoreEventsCallback(MaybeCancelWaitForMoreEventsFn callBack);
void registerSocketNotifier(QSocketNotifier *notifier);
void unregisterSocketNotifier(QSocketNotifier *notifier);
void removeSocketNotifiers();
MacSocketHash macSockets;
QAbstractEventDispatcher *eventDispatcher;
MaybeCancelWaitForMoreEventsFn maybeCancelWaitForMoreEvents;
};
QT_END_NAMESPACE
#endif
| [
"[email protected]"
] | |
4ecd4a8df594c6bf8aec30b3d364b9ab2e95abdf | e70abd28dba76d3efe8f0c2f0b708f3c1346a402 | /9.이분탐색/2343.cpp | a2199310d20b68f3b56bf333b4893eaa2dd6f865 | [] | no_license | TaeBeomShin/1day-1ps | 3dab86833c1643a5954bfe62cf3de6098e138558 | a362105bd9139e82cbf7a9c896a06d37da10726b | refs/heads/master | 2023-08-20T10:05:04.880960 | 2021-10-15T14:39:58 | 2021-10-15T14:39:58 | 284,451,077 | 4 | 0 | null | null | null | null | UHC | C++ | false | false | 719 | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;cin>>n>>m;
int A[n]={0,},left=0,right=0;
for(int i=0;i<n;i++){
cin>>A[i];
left=max(left,A[i]);
right+=A[i];
}
// LEFT 블루레이의 최소크기(원소중 가장큰값)
// RIGHT 블루레이의 최대크기(모든 블루레이를 합친값.
while(left<=right){
int mid=(left+right)/2;
int count=1,sum=0;
for(int i=0;i<n;i++){
if(sum+A[i]<=mid){
sum+=A[i];
}else{//sum에 더했을때 블루레이의 크기를 넘는 경우.
sum=A[i];
count++;
}
}
if(count<=m){//블루레이의 개수가 더 작을 경우-> 크기를 줄인다.
right=mid-1;
}else{
left=mid+1;
}
}
cout<<left;
}
| [
"[email protected]"
] | |
be2204e3be9f514f925cbf12d7cfdfe7810ae92e | 43fbdd38d7964f5bff1e4395a5d50c9b91de068c | /iPixel.ino | ae9ba833ef84d56d7c23e749e15f07bb4297e5eb | [] | no_license | Sc1ence/iPixel | f0f531b8f09f1a00270ade8b6816ffe973eb905f | bd9b6caea86383d54e24ef4c4c01bd969aef76be | refs/heads/master | 2020-06-04T19:13:39.464748 | 2013-01-25T09:15:46 | 2013-01-25T09:15:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,491 | ino | #include <SPI.h>
#include <WS2801.h>
#include <TM1638.h>
//to draw a frame we need arround 20ms to send an image. the serial baudrate is
//NOT the bottleneck.
#define BAUD_RATE 115200
#define PANELS 1
#define PPP 64
//initialize pixels
// using default SPI pins
WS2801 strip = WS2801(64);
byte prev;
// define a module on data pin 8, clock pin 9 and strobe pin 7
TM1638 module(8, 9, 7);
byte error;
void setup()
{
//im your slave and wait for your commands, master!
Serial.begin(BAUD_RATE); //Setup high speed Serial
Serial.flush();
strip.begin(); // Start up the LED Strip
showWaitingPic();
error = 0;
module.setDisplayToString("Start");
}
void loop()
{
char data[192];
if (Serial.available() > 0)
{
byte type = Serial.read();
if(type == 'D')
{
int count = Serial.readBytes( data, 192);
if(count == 192)
{
for(int i = 0; i < PPP; i++)
{
strip.setPixelColor(i, Color(data[3*i],data[3*i+1],data[3*i+2]));
}
strip.show();
}
}
else if (type == 'I')
{
byte response[6];
response[0] = 'A';
response[1] = 'K';
response[2] = PANELS;
response[3] = PPP;
response[4] = Serial.available();
response[5] = error;
Serial.write(response, 6);
}
else if (type == 'S')
{
char action[18];
int count = Serial.readBytes(action, 18);
if(count == 18)
{
if(action[0] == 'S') //Want to set the display content?
{
module.clearDisplay();
char text[8];
for (int i = 1; i < 9; i++)
{
text[i-1] = action[i];
}
module.setDisplayToString(text);
}
if(action[9] == 'S') //Want to set the leds?
{
for (int i = 10; i < 18; i++)
{
switch (action[i])
{
case '0':
module.setLED(TM1638_COLOR_NONE, i-10);
break;
case '1':
module.setLED(TM1638_COLOR_GREEN, i-10);
break;
case '2':
module.setLED(TM1638_COLOR_RED, i-10);
break;
case '3':
module.setLED(TM1638_COLOR_GREEN + TM1638_COLOR_RED, i-10);
break;
}
}
}
}
}
else if(type == 'M')
{
char modedata[6];
int count = Serial.readBytes(modedata, 6);
if(count == 6)
{
switch(modedata[0])
{
case 'B':
blinken(modedata[1], modedata[2], modedata[3], modedata[4], modedata[5]);
break;
case 'F':
fade(modedata[1], modedata[2], modedata[3], modedata[4], modedata[5]);
break;
}
}
}
}
byte buttons = module.getButtons();
if(buttons != prev)
{
Serial.write('B');
Serial.write(buttons);
prev = buttons;
}
}
//modes
void blinken(int r, int g, int b, int del, int times) {
int dil = del*100;
for(int x = 0; x < times; x++)
{
for (int i=0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, Color(r,g,b));
}
strip.show();
delay(dil);
for (int i=0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, Color(0,0,0));
}
strip.show();
delay(dil);
}
}
void fade(int r, int g, int b, int del, int times)
{
}
// --------------------------------------------
// create initial image
// --------------------------------------------
void showWaitingPic() {
for (int i=0; i < strip.numPixels(); i++) {
if((i % 2) == 0)
{
strip.setPixelColor(i, Color(255,0,0));
}
strip.show();
}
delay(500);
for (int i=0; i < strip.numPixels(); i++) {
if((i % 2) != 0)
{
strip.setPixelColor(i, Color(0,0,255));
}
else
{
strip.setPixelColor(i, Color(0,0,0));
}
strip.show();
}
}
//Input a value 0 to 255 to get a color value.
//The colours are a transition r - g -b - back to r
uint32_t Wheel(byte WheelPos)
{
if (WheelPos < 85) {
return Color(WheelPos * 3, 255 - WheelPos * 3, 0);
} else if (WheelPos < 170) {
WheelPos -= 85;
return Color(255 - WheelPos * 3, 0, WheelPos * 3);
} else {
WheelPos -= 170;
return Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
}
// Create a 24 bit color value from R,G,B
uint32_t Color(byte r, byte g, byte b)
{
uint32_t c;
c = r;
c <<= 8;
c |= g;
c <<= 8;
c |= b;
return c;
}
| [
"[email protected]"
] | |
01fb3e49322a7fcdca7ddb315d03776069c841bd | 9e0bc34d83ad3b4ea98163a209216d11c7860db6 | /lshkit/trunk/3rd-party/boost/boost/mpl/int_fwd.hpp | 3bc98d4bd57ddf2d3a57eb533b81cfc415191752 | [
"GPL-3.0-only",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-mit-old-style",
"LicenseRef-scancode-boost-original",
"BSL-1.0",
"LicenseRef-scancode-stlport-4.5"
] | permissive | wzj1695224/BinClone | 07a00584f7b04bc1e6739cdc99d9fa0f4c812f8d | 3b6dedb9a1f08be6dbcdce8f3278351ef5530ed8 | refs/heads/master | 2020-04-27T17:17:42.556516 | 2019-03-13T07:53:23 | 2019-03-13T07:53:23 | 174,512,239 | 0 | 0 | Apache-2.0 | 2019-03-08T09:55:55 | 2019-03-08T09:55:55 | null | UTF-8 | C++ | false | false | 760 | hpp |
#ifndef BOOST_MPL_INT_FWD_HPP_INCLUDED
#define BOOST_MPL_INT_FWD_HPP_INCLUDED
// 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: int_fwd.hpp,v 1.3 2009/02/22 01:02:37 wdong-pku Exp $
// $Date: 2009/02/22 01:02:37 $
// $Revision: 1.3 $
#include <boost/mpl/aux_/adl_barrier.hpp>
#include <boost/mpl/aux_/nttp_decl.hpp>
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
template< BOOST_MPL_AUX_NTTP_DECL(int, N) > struct int_;
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
BOOST_MPL_AUX_ADL_BARRIER_DECL(int_)
#endif // BOOST_MPL_INT_FWD_HPP_INCLUDED
| [
"[email protected]"
] | |
7a9893f6ec663a0533c10a4e0f833fa32aad5cbf | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/httpd/gumtree/httpd_patch_hunk_1406.cpp | a4d707b59119ba13f80a2a4cbb345cd6f442bbf0 | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,030 | cpp | APR_BRIGADE_INSERT_TAIL(ctx->bb, e);
continue;
}
/* read */
apr_bucket_read(e, &data, &len, APR_BLOCK_READ);
+ if (!len) {
+ apr_bucket_delete(e);
+ continue;
+ }
+ if (len > APR_INT32_MAX) {
+ apr_bucket_split(e, APR_INT32_MAX);
+ apr_bucket_read(e, &data, &len, APR_BLOCK_READ);
+ }
/* first bucket contains zlib header */
- if (!ctx->inflate_init++) {
- if (len < 10) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
- "Insufficient data for inflate");
- return APR_EGENERAL;
- }
- else {
- zlib_method = data[2];
- zlib_flags = data[3];
+ if (ctx->header_len < sizeof(ctx->header)) {
+ apr_size_t rem;
+
+ rem = sizeof(ctx->header) - ctx->header_len;
+ if (len < rem) {
+ memcpy(ctx->header + ctx->header_len, data, len);
+ ctx->header_len += len;
+ apr_bucket_delete(e);
+ continue;
+ }
+ memcpy(ctx->header + ctx->header_len, data, rem);
+ ctx->header_len += rem;
+ {
+ int zlib_method;
+ zlib_method = ctx->header[2];
if (zlib_method != Z_DEFLATED) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"inflate: data not deflated!");
ap_remove_output_filter(f);
return ap_pass_brigade(f->next, bb);
}
- if (data[0] != deflate_magic[0] ||
- data[1] != deflate_magic[1] ||
- (zlib_flags & RESERVED) != 0) {
+ if (ctx->header[0] != deflate_magic[0] ||
+ ctx->header[1] != deflate_magic[1]) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"inflate: bad header");
return APR_EGENERAL ;
}
- data += 10 ;
- len -= 10 ;
- }
- if (zlib_flags & EXTRA_FIELD) {
- unsigned int bytes = (unsigned int)(data[0]);
- bytes += ((unsigned int)(data[1])) << 8;
- bytes += 2;
- if (len < bytes) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
- "inflate: extra field too big (not "
- "supported)");
- return APR_EGENERAL;
- }
- data += bytes;
- len -= bytes;
- }
- if (zlib_flags & ORIG_NAME) {
- while (len-- && *data++);
- }
- if (zlib_flags & COMMENT) {
- while (len-- && *data++);
- }
- if (zlib_flags & HEAD_CRC) {
- len -= 2;
- data += 2;
- }
+ ctx->zlib_flags = ctx->header[3];
+ if ((ctx->zlib_flags & RESERVED)) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+ "inflate: bad flags %02x",
+ ctx->zlib_flags);
+ return APR_EGENERAL;
+ }
+ }
+ if (len == rem) {
+ apr_bucket_delete(e);
+ continue;
+ }
+ data += rem;
+ len -= rem;
+ }
+
+ if (ctx->zlib_flags) {
+ rv = consume_zlib_flags(ctx, &data, &len);
+ if (rv == APR_SUCCESS) {
+ ctx->zlib_flags = 0;
+ }
+ if (!len) {
+ apr_bucket_delete(e);
+ continue;
+ }
}
/* pass through zlib inflate. */
ctx->stream.next_in = (unsigned char *)data;
ctx->stream.avail_in = len;
| [
"[email protected]"
] | |
96c94b7a4f8a9714c0682633c0539822557038e5 | 828d10b815a82fc2fb47926f2d75831e25c3fc9f | /Eletronica/PC2/TEMPERATURA_NIVEL_DE_BATERIA.ino | cb9830a258d3d0235fe8814e8ae581f17f7a7fd8 | [] | no_license | track-cooler/docs | c0d0eda67eea5abbc93f43ebd1d1f5490c2780f1 | 3961c4a1993575bd6e2b4c0bd9e64ff45f4ceae9 | refs/heads/master | 2023-01-24T07:34:25.139333 | 2020-11-29T17:46:29 | 2020-11-29T17:46:29 | 256,034,333 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 4,580 | ino | // Interfacing Arduino with DS18B20 temperature sensor
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h> // include LCD library code
//#include "BluetoothSerial.h"
#include <stdio.h>
#define DS18B20_PIN 10
#define vmax 3.6
//BluetoothSerial SerialBT;
LiquidCrystal_I2C lcd(0x20,16,2);
int raw_temp;
float temp=0.0;
char txt[] = " C ";
float voltage = 0.0;
float voltage1 = 0.0;
float voltage2 = 0.0;
void setup(){
lcd.init();
lcd.backlight();
//SerialBT.begin("ESP32")
}
void loop(){
// set cursor to first column, first row
if(ds18b20_read(&raw_temp)) {
Serial.print("Temperature= ");
temp = (float)raw_temp / 16; // Convert temperature raw value into degree Celsius (temp in °C = raw/16)
Serial.print(temp); // Print temperature value in degree Celsius
Serial.println(" ºC"); // Print '°C'
Serial.print("percentual da bateria= ");
// Display temperature on LCD
if(temp>=0){
lcd.setCursor(0, 0);//primeiro valor indica coluna, segundo linha
lcd.print("Temp= ");
lcd.setCursor(7, 0);
lcd.write(B00101011);
lcd.setCursor(8, 0);
lcd.print(temp,2);
lcd.setCursor(14, 0);
lcd.write(B11011111);
lcd.setCursor(15, 0);
lcd.print("C");
} else {
lcd.setCursor(0, 0);//primeiro valor indica coluna, segundo linha
lcd.print("Temp= ");
lcd.setCursor(6, 0);
//lcd.write(B00101101);
//lcd.setCursor(9, 0);
lcd.print(temp,2);
lcd.setCursor(14, 0);
lcd.write(B11011111);
lcd.setCursor(15, 0);
lcd.print("C");
}
voltage = (analogRead(A2)*vmax)/1023.0;
voltage1=float((voltage*28100)/4100);
voltage2=float((24/voltage1)*100);
lcd.setCursor(0,1);
lcd.write(B00100101);
lcd.setCursor(1,1);
lcd.print("Charge=");
lcd.setCursor(9,1);
lcd.print(voltage2,2);
lcd.setCursor(15,1);
lcd.write(B00100101);
//char bateria[3];
//gcvt(voltage, 3, bateria);
//for(int i = 0; i < sizeof(bateria); i++){
//SerialBT.write(bateria[i]);
//}
}
else {
Serial.println("Communication Error!");
lcd.setCursor(4, 1);
lcd.print(" Error! ");
}
delay(1000);
}
bool ds18b20_start(){
bool ret = 0;
digitalWrite(DS18B20_PIN, LOW); // Send reset pulse to the DS18B20 sensor
pinMode(DS18B20_PIN, OUTPUT);
delayMicroseconds(500); // Wait 500 us
pinMode(DS18B20_PIN, INPUT);
delayMicroseconds(100); //wait to read the DS18B20 sensor response
if (!digitalRead(DS18B20_PIN)) {
ret = 1; // DS18B20 sensor is present
delayMicroseconds(400); // Wait 400 us
}
return(ret);
}
void ds18b20_write_bit(bool value){
digitalWrite(DS18B20_PIN, LOW);
pinMode(DS18B20_PIN, OUTPUT);
delayMicroseconds(2);
digitalWrite(DS18B20_PIN, value);
delayMicroseconds(80);
pinMode(DS18B20_PIN, INPUT);
delayMicroseconds(2);
}
void ds18b20_write_byte(byte value){
byte i;
for(i = 0; i < 8; i++)
ds18b20_write_bit(bitRead(value, i));
}
bool ds18b20_read_bit(void) {
bool value;
digitalWrite(DS18B20_PIN, LOW);
pinMode(DS18B20_PIN, OUTPUT);
delayMicroseconds(2);
pinMode(DS18B20_PIN, INPUT);
delayMicroseconds(5);
value = digitalRead(DS18B20_PIN);
delayMicroseconds(100);
return value;
}
byte ds18b20_read_byte(void) {
byte i, value;
for(i = 0; i <8; i++)
bitWrite(value, i, ds18b20_read_bit());
return value;
}
bool ds18b20_read(int *raw_temp_value) {
if (!ds18b20_start()) // Send start pulse
return(0); // Return 0 if error
ds18b20_write_byte(0xCC); // Send skip ROM command
ds18b20_write_byte(0x44); // Send start conversion command
while(ds18b20_read_byte() == 0); // Wait for conversion complete
if (!ds18b20_start()) // Send start pulse
return(0); // Return 0 if error
ds18b20_write_byte(0xCC); // Send skip ROM command
ds18b20_write_byte(0xBE); // Send read command
*raw_temp_value = ds18b20_read_byte(); // Read temperature LSB byte and store it on raw_temp_value LSB byte
*raw_temp_value |= (unsigned int)(ds18b20_read_byte() << 8); // Read temperature MSB byte and store it on raw_temp_value MSB byte
return(1); // OK --> return 1
}
| [
"[email protected]"
] | |
5790b773326a58a60c674b2023ebcbd9a45511de | 792f2ee67210556f224daf88ef0b9785becadc9b | /yukicoder/427.cpp | 00274cbbd3d4b73c76d76d1bbb2d555ef352f318 | [] | no_license | firiexp/contest_log | e5b345286e7d69ebf2a599d4a81bdb19243ca18d | 6474a7127d3a2fed768ebb62031d5ff30eeeef86 | refs/heads/master | 2021-07-20T01:16:47.869936 | 2020-04-30T03:27:51 | 2020-04-30T03:27:51 | 150,196,219 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 419 | cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;
template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
int main() {
int h, w;
cin >> h >> w;
cout << (h > w ? "TATE\n" : "YOKO\n");
return 0;
}
| [
"[email protected]"
] | |
5fe0a228645048938ce86d5b205dbf9d6492aee2 | fb5b25b4fbe66c532672c14dacc520b96ff90a04 | /export/release/macos/obj/src/resources/__res_46.cpp | 1baa1cf418165bace9beed82975c538e037bee0a | [
"Apache-2.0"
] | permissive | Tyrcnex/tai-mod | c3849f817fe871004ed171245d63c5e447c4a9c3 | b83152693bb3139ee2ae73002623934f07d35baf | refs/heads/main | 2023-08-15T07:15:43.884068 | 2021-09-29T23:39:23 | 2021-09-29T23:39:23 | 383,313,424 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | true | 1,979 | cpp | // Generated by Haxe 4.1.5
namespace hx {
unsigned char __res_46[] = {
0x80, 0x00, 0x00, 0x80,
137,80,78,71,13,10,26,10,0,0,
0,13,73,72,68,82,0,0,0,18,
0,0,0,108,8,6,0,0,0,103,
230,226,230,0,0,0,32,99,72,82,
77,0,0,122,37,0,0,128,131,0,
0,249,255,0,0,128,233,0,0,117,
48,0,0,234,96,0,0,58,152,0,
0,23,111,146,95,197,70,0,0,1,
177,73,68,65,84,120,218,236,152,65,
174,130,48,20,69,239,37,142,136,155,
96,9,76,116,43,118,1,141,227,174,
132,177,129,57,110,69,39,14,88,128,
155,32,56,124,127,32,160,20,242,211,
242,205,143,131,215,129,70,124,61,105,
154,246,244,22,138,8,134,70,242,245,
35,172,113,232,79,17,193,227,241,64,
154,166,210,117,93,20,37,77,211,145,
241,252,32,163,33,62,140,0,38,144,
219,237,22,4,200,243,28,167,211,9,
0,224,156,67,242,254,103,40,100,169,
54,193,135,154,130,20,244,113,208,245,
122,13,238,232,215,178,255,150,162,40,
86,141,196,57,7,0,76,0,160,105,
26,246,15,162,33,69,81,16,0,54,
189,70,80,150,37,173,181,81,98,43,
203,146,51,195,125,196,144,3,228,29,
26,68,33,231,134,140,133,248,48,2,
152,64,238,247,123,16,32,203,50,156,
207,103,0,128,49,102,186,142,66,33,
75,181,186,105,21,244,189,160,203,229,
18,220,209,175,29,13,89,215,245,170,
145,24,99,166,134,236,31,68,67,234,
186,158,27,210,24,19,109,200,182,109,
159,115,212,67,86,79,178,181,22,34,
130,13,0,180,109,11,231,92,244,73,
98,173,149,166,105,72,242,115,199,17,
125,200,110,183,11,62,32,143,199,227,
24,72,39,235,40,20,178,84,171,155,
86,65,223,11,202,243,60,184,163,95,
59,110,218,191,92,252,68,132,73,31,
105,216,223,4,163,33,93,215,209,79,
108,0,16,101,72,17,25,51,100,66,
18,85,85,173,178,100,85,85,195,0,
212,144,106,72,5,169,33,213,144,191,
27,114,187,221,194,24,19,157,181,141,
49,115,67,254,53,176,211,135,236,247,
251,224,43,196,225,112,24,231,119,178,
142,66,33,75,181,186,105,21,244,189,
160,44,203,130,59,250,181,124,169,101,
253,171,177,137,33,7,175,172,129,104,
134,212,12,169,32,5,105,134,252,151,
12,249,51,0,250,29,76,70,79,78,
109,61,0,0,0,0,73,69,78,68,
174,66,96,130,0x00 };
}
| [
"[email protected]"
] | |
8c8bfa417951aea7396b2934159bce760290592e | 3351eb384dc6b63214e09c0895b33126d5cd7e6a | /剑指offer/剑指Offer/剑指Offer/45圆圈中最后剩下的数字.cpp | e8b25cb9128c375bfcf1c22c340c1ea0a597f205 | [] | no_license | Isanti2016/Practice | 7a903f2f02e8a1b3af785245d2bd5263ccab3744 | 2f10ee14db240cf29115bbd12ae5164ac69bc659 | refs/heads/master | 2021-01-16T21:24:40.710153 | 2017-10-17T10:58:54 | 2017-10-17T10:58:54 | 100,228,628 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 533 | cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include "Common_head.h"
using namespace std;
/*
从0,1,2,3....n-1排成一个圆圈,从数字0开始每次从这个圆圈中删除第m个数子,求圆圈中剩下的最后一个数字。
*/
int LastRemaining_Solution(int n, int m)
{
if (n < 1 || m < 1)
return -1;
int last = 0;
for (int i = 2; i <= n; ++i)//当i=1的时候最后剩下的一定是0
{
last = (last + m) % i;
}
return last;//要是从1开始排成一个圆,直接return last+1即可
} | [
"[email protected]"
] | |
90d395f21acc2bd9d7b19c9120be6b11c43ac6a5 | 704dfc475d6a81b35079d2584160a5be2beaafe3 | /lab_2/html_encode/html_encode_tests/html_encode_tests.cpp | de3150eff8fac835bf1fcececb4d808b8f4c9b65 | [] | no_license | MihaGoHard/OOP | 75bc6764265066ef3e2d66735b9a0233c4de5a81 | 79308c39680074a1cdbd7ced1466436684ae5563 | refs/heads/main | 2023-05-25T18:40:22.296646 | 2021-06-10T14:34:29 | 2021-06-10T14:34:29 | 338,836,980 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,262 | cpp | #define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include "../html_encode_app/EncodeHtmlPrintResult.h"
using namespace std;
TEST_CASE("Encode html from line")
{
SECTION("Doesn't change the empty string")
{
string str = "";
CHECK(EncodeHtml(str) == str);
}
SECTION("Doesn't change the string without specials")
{
string str = "Cat says Meow. What does the fox says?";
CHECK(EncodeHtml(str) == str);
}
SECTION("Change the string with specials")
{
string inStr = "Cat <says> \"Meow\". M&M's";
string outStr = "Cat <says> "Meow". M&M's";
CHECK(EncodeHtml(inStr) == outStr);
}
}
TEST_CASE("Encode html from input")
{
SECTION("Encode one line")
{
istringstream input("Cat <says> \"Meow\". M&M's");
stringstream output;
GetStringPrintEncodeHtml(input, output);
CHECK(output.str() == "Cat <says> "Meow". M&M's");
CHECK(input.eof());
}
SECTION("Encode some lines")
{
istringstream input("Cat <says> \"Meow\". M&M's \n Dog <says> \"Wof\". M&M's");
stringstream output;
GetStringPrintEncodeHtml(input, output);
CHECK(output.str() == "Cat <says> "Meow". M&M's \n Dog <says> "Wof". M&M's");
CHECK(input.eof());
}
}
| [
"[email protected]"
] | |
0c1654fdbcc542d7aeed49df07d56178579c694a | 4d1837866dafceb1f99992f283d3de4c90c826f9 | /servo_motor.ino | c7686cc8040fe594fe774828c49e95feb767ef69 | [] | no_license | minato-fourth/mini | 13c138849256c4dc1b751ca9a897f9f15d42782a | 45afdf9d9f7209f2560da78317d2786975890656 | refs/heads/main | 2023-06-01T06:06:08.590686 | 2021-06-09T13:46:14 | 2021-06-09T13:46:14 | 373,450,665 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,092 | ino | #include <Servo.h>
Servo servo_1;
Servo servo_2;
//mg996r initalizations
int servo_position=90;
int servo_1_pin=9;
int servo_2_pin=10;
int mapped_position;
int b;
int JoystickRight_var;
void setup() {
// Serial.begin(9600);
//mg996r setup
servo_1.attach(servo_1_pin);
servo_2.attach(servo_2_pin);
}
void motion_right(int JoystickRight_var)
{
///check this code
Serial.print(JoystickRight_var);
mapped_position=map(JoystickRight_var,0,1024,90,180);
servo_1.write(mapped_position);
servo_2.write(mapped_position);
}
void motion_left(int JoystickRight_var)
{
///check this code
// Serial.print(JoystickRight_var);
b=abs(JoystickRight_var);
// Serial.print("---------");
// Serial.print(b);
mapped_position=map(b,0,1023,90,0);
// Serial.print("---------");
// Serial.print(mapped_position);
servo_1.write(mapped_position);
servo_2.write(mapped_position);
}
void servo_motion_stop()
{
servo_1.write(servo_position);
servo_2.write(servo_position);
}
void loop() {
//servo_1.write(0);
//servo_2.write(0);
//delay(1000);
for(JoystickRight_var=-1023;JoystickRight_var<1023;JoystickRight_var+=30)
{
if(JoystickRight_var>3)
{
motion_right(JoystickRight_var);
delay(50);
// Serial.println("motion right");
}
else if(JoystickRight_var<-3)
{
motion_left(JoystickRight_var);
delay(50);
// Serial.println("motion left");
}
else
{
servo_motion_stop();
delay(50);
// Serial.println("servo motion stop");
}
}
for(JoystickRight_var=1023;JoystickRight_var>-1023;JoystickRight_var-=30)
{
if(JoystickRight_var>3)
{
motion_right(JoystickRight_var);
delay(50);
// Serial.println("motion right");
}
else if(JoystickRight_var<-3)
{
motion_left(JoystickRight_var);
delay(50);
// Serial.println("motion left");
}
else
{
servo_motion_stop();
delay(50);
// Serial.println("servo motion stop");
}
}
}
| [
"[email protected]"
] | |
45c404aff9bace23e958ad22fddd234ad6df61f7 | e102eb4fcdf6f1f5d519b713cd9451f79545afbd | /Source/FPSGame/Private/FPSObjectiveActor.cpp | cd551fa7ebe39e2b561d2e7160873430edbc83cc | [] | no_license | LoremasterLH/StealthGame | 201369c406539beee13e3748fbc84984e907a270 | 2349598673d88e3f25136a5618a1dae4184792eb | refs/heads/master | 2020-03-31T08:34:19.296818 | 2018-10-08T10:41:11 | 2018-10-08T10:41:11 | 152,063,315 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,450 | cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "FPSObjectiveActor.h"
#include "Components/StaticMeshComponent.h"
#include "Components/SphereComponent.h"
#include "Kismet/GameplayStatics.h"
#include "FPSCharacter.h"
// Sets default values
AFPSObjectiveActor::AFPSObjectiveActor()
{
MeshComp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("MeshComp"));
MeshComp->SetCollisionEnabled(ECollisionEnabled::NoCollision);
RootComponent = MeshComp;
SphereComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
SphereComp->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
SphereComp->SetCollisionResponseToAllChannels(ECR_Ignore);
SphereComp->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
SphereComp->SetupAttachment(MeshComp);
SetReplicates(true);
}
// Called when the game starts or when spawned
void AFPSObjectiveActor::BeginPlay()
{
Super::BeginPlay();
PlayEffects();
}
void AFPSObjectiveActor::PlayEffects()
{
UGameplayStatics::SpawnEmitterAtLocation(this, PickupFX, GetActorLocation());
UGameplayStatics::PlaySound2D(this, PickupSound);
}
void AFPSObjectiveActor::NotifyActorBeginOverlap(AActor* OtherActor)
{
Super::NotifyActorBeginOverlap(OtherActor);
PlayEffects();
if (Role == ROLE_Authority)
{
AFPSCharacter* MyCharacter = Cast<AFPSCharacter>(OtherActor);
if (MyCharacter)
{
MyCharacter->bIsCarryingObjective = true;
Destroy();
}
}
}
| [
"[email protected]"
] | |
98f03137df6dd46618e1c6eb7c73e3b648aa63cb | a5c4a56e82aabb7e1ad68a71e739523d8d44f7dc | /Placement Prep/Daily Works/July/16-7-20/reverse words in string.cpp | f27e2254b40f13c0352d061086689aac90333c23 | [] | no_license | SaiSundhar173/Hacktoberfest2021 | a99d20025b4335bc6499fdae4b6c9b134a2f51ff | 37ddf0edb34d135435155ac4ef36f837b4c96411 | refs/heads/master | 2023-08-28T05:29:16.390701 | 2021-10-26T14:56:00 | 2021-10-26T14:56:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,159 | cpp |
// https://leetcode.com/problems/reverse-words-in-a-string/
Sol 1:
class Solution {
public:
string reverseWords(string s) {
stringstream str(s);
stack<string>st;
while(str>>s){
st.push(s);
}
s="";
if(!st.empty()){
s+=st.top();
st.pop();
}
while(!st.empty()){
s+=' ';
s+=st.top();
st.pop();
}
return s;
}
};
Sol 2:
class Solution {
public:
string reverseWords(string s) {
string str;stack<string>st;
for(int i=0;i<s.size();i++){
if(s[i]==' ')
continue;
str="";
while(i<s.size() && s[i]!=' '){
// cout<<s[i]<<"&";
str+=s[i];i++;
}
// cout<<str<<endl;
st.push(str);
}
s="";
if(!st.empty()){
s+=st.top();
st.pop();
}
while(!st.empty()){
s+=' ';
s+=st.top();
st.pop();
}
return s;
}
}; | [
"[email protected]"
] | |
100f20d6492a5267662c0767a737f5e80059cb85 | 581d4d42c6f1679e897916f992e8766dbd77071c | /daycontang.cpp | e9be91b6f07ca86a1d66a2e08f61f5ba9d5e907a | [] | no_license | thudatdq123/testc- | 1c32d9c5fa1fc0abe40dab377842fed96ee1f8c4 | c202e824af6b57ff178937c17aaca26d737a7776 | refs/heads/master | 2023-01-04T15:37:19.763726 | 2020-10-24T07:20:45 | 2020-10-24T07:20:45 | 306,828,058 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 587 | cpp | #include<iostream>
#include<fstream>
using namespace std;
void daycontang(int a[],int n)
{
int l[100],t[100];
l[n+1]=1;
int jmax;
for (int i=n+1;i>=0;i--)
{
jmax=n+1;
for(int j=i+1;j<=n+1;j++)
{
if(a[j]>a[i] && l[j]>l[jmax]) jmax=j;
l[i]=l[jmax]+1;
t[i]=jmax;
}
}
int i=0;
while(i<n)
{
cout<<a[t[i]]<<' ';
i=t[i];
}
}
int main()
{
int a[100],n;
ifstream file;
file.open("E:\\C++\\daycontang.txt",ios_base::in);
file>>n;
for(int i=0;i<n;i++)
{
file>>a[i];
}
for(int i=n;i>0;i--)
{
a[i]=a[i-1];
}
a[0]=-10000;a[n+1]=10000;
daycontang(a,n);
}
| [
"[email protected]"
] | |
e78a98964787b68da1cdfd020c33420bd2dfab5a | 708d705801a3d3eddf7de104cc68e877017c99f3 | /IntegerNumber.cpp | 6811989b17a92cb066ab4e8c39afed392e420973 | [] | no_license | poxiaozheng/AbstractNumber | 19850f57b985b4a6609daa62c1336e1becd573eb | a84126d515c79038694bf6865ffb23ddd42614b1 | refs/heads/master | 2020-03-21T04:57:10.885829 | 2018-06-21T14:37:11 | 2018-06-21T14:37:11 | 138,136,139 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 453 | cpp | #include "IntegerNumber.h"
#include<iostream>
using namespace std;
IntegerNumber::IntegerNumber()
{
}
IntegerNumber::IntegerNumber(int a) :a(a)
{
}
void IntegerNumber::print()
{
cout << a << endl;
}
IntegerNumber IntegerNumber::operator+(const IntegerNumber & other)
{
return IntegerNumber(a + other.a);
}
IntegerNumber IntegerNumber::operator*(const IntegerNumber & other)
{
return IntegerNumber(a* other.a);
}
| [
"[email protected]"
] | |
a36781f343811996a4c549de4de9d5969c0fd9b2 | 87a1b702904a711af2546db81f2fbc26ad7dd954 | /chess/SceneGame.cpp | 740fa85015eef00f01ac22dd7fd4f350e9771452 | [] | no_license | Candypz/cocos2dxTest | b98f6435adf1f0af8ec04ca85fe246b5c4a05aca | 2f752cdab88c8a6ae3d6bb189fb4d775ccd83f29 | refs/heads/master | 2020-04-06T03:42:00.177140 | 2015-05-02T17:07:43 | 2015-05-02T17:07:43 | 34,954,802 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 3,475 | cpp | #include "SceneGame.h"
Scene *SceneGame::createScene(bool red){
Scene *scene = Scene::create();
Layer *layer = SceneGame::create(red);
scene->addChild(layer);
return scene;
}
bool SceneGame::init(bool red){
if (!Layer::init())
{
return false;
}
Size visibleSize = Director::getInstance()->getVisibleSize();
m_plateOffset = Point(20, 10);
this->m_stoneOffset = Point(60, 33);
this->m_d = 46;
m_redTrun = true;
//添加点击框
m_selectid = -1;
m_selectSprite = Sprite::create("chess/selected.png");
m_selectSprite->setVisible(false);//隐藏
m_selectSprite->setLocalZOrder(1000);
m_selectSprite->setScale(.8f);
addChild(m_selectSprite);
//添加桌子
Sprite *desk = Sprite::create("chess/floor.jpg");
desk->setPosition(Point(visibleSize.width / 2, visibleSize.height / 2));
desk->setScaleX(visibleSize.width / desk->getContentSize().width);
desk->setScaleY(visibleSize.height / desk->getContentSize().height);
addChild(desk);
//添加棋盘
Sprite *bg = Sprite::create("chess/background.png");
bg->setAnchorPoint(Point::ZERO);
bg->setPosition(m_plateOffset);
bg->setScale((visibleSize.height-m_plateOffset.y*2) / bg->getContentSize().height);
addChild(bg);
//添加棋子
for (int i = 0; i < 32; ++i){
m_s[i] = Stone::createStone(i,red);
m_s[i]->setPosition(Point(m_s[i]->getX()*m_d, m_s[i]->getY()*m_d) + m_stoneOffset);
addChild(m_s[i]);
}
//添加监听
auto listener = EventListenerTouchOneByOne::create();
listener->onTouchBegan = CC_CALLBACK_2(SceneGame::onTouchBegan, this);
Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, this);
return true;
}
SceneGame *SceneGame::create(bool red){
SceneGame *pRet = new SceneGame();
if (pRet){
if (pRet->init(red)){
pRet->autorelease();
}
else{
pRet->release();
return NULL;
}
}
else{
return NULL;
}
return pRet;
}
bool SceneGame::onTouchBegan(Touch *touch, Event *unused_event){
int x, y;
Point ptInWin = touch->getLocation();
if (!getClickPos(ptInWin, x, y)){
return false;
}
int clickid = getStone(x, y);
if (m_selectid == -1){
setScaleId(clickid);
}
else{
moveStone(m_selectid, clickid, x, y);
}
return true;
}
bool SceneGame::getClickPos(Point ptInWin, int &x, int &y){
for (x = 0; x <= 8; ++x){
for (y = 0; y <= 9; ++y){
Point ptInPlate = Point(x*m_d, y*m_d) + m_stoneOffset;
if (ptInWin.getDistance(ptInPlate) < m_d / 2){
return true;
}
}
}
return false;
}
int SceneGame::getStone(int x, int y){
Stone *s;
for (int i = 0; i < 32; ++i){
s = m_s[i];
if (s->getX() == x&&s->getY() == y&&!s->getDead()){
return s->getId();
}
}
return -1;
}
void SceneGame::setScaleId(int id){
if (id == -1){
return;
}
if (m_s[id]->getRed() != m_redTrun){
return ;
}
m_selectid = id;
m_selectSprite->setVisible(true);
m_selectSprite->setPosition(m_s[m_selectid]->getPosition());
}
Point SceneGame::getStonePos(int x, int y){
int xx = x*m_d;
int yy = y*m_d;
return Point(xx, yy) + m_stoneOffset;
}
void SceneGame::moveStone(int moveId, int clickid, int x, int y){
if ((clickid!=-1)&&(m_s[moveId]->getRed() == m_s[clickid]->getRed())){
setScaleId(clickid);
return;
}
if (clickid != -1){
m_s[clickid]->setDead(true);
m_s[clickid]->setVisible(false);
}
m_s[moveId]->setX(x);
m_s[moveId]->setY(y);
m_s[moveId]->setPosition(getStonePos(x,y));
m_selectid = -1;
m_selectSprite->setVisible(false);
m_redTrun = !m_redTrun;
} | [
"[email protected]"
] | |
32f5197723e8ab1a6e43d1778f06bf0d19dc9d26 | e1edf93837076bb0ebba29e7c7264f9cbc539afb | /문자열 %c로 입력 받는 방법.cpp | 8eae531121f8fab40f66391122728f07293ba629 | [] | no_license | proqk/Algorithm | 62882ed7b8401ee57238f07cef5571809020842f | d5300e8712dc92282aefee4d652cc1ec4c1cde78 | refs/heads/master | 2022-06-21T21:21:19.132839 | 2022-06-15T02:00:28 | 2022-06-15T02:00:28 | 67,300,887 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 381 | cpp | #include <stdio.h>
int main() {
//1 2 3 4 5 6 넣고 싶은데
int a[3000];
//scanf("%s", a); //정확히 나옴
for (int i = 1; i <= 6; i++) {
// scanf("%c", &a[i]); //1 2 3밖에 안 나옴
// scanf("%c ", &a[i]); //1 2 3 4 5 6 + 뭔가를 하나 더 넣어야 함
scanf(" %c", &a[i]); //<<<<<<이거 됨
}
for (int i = 1; i <= 6; i++) {
printf("%c ", a[i]);
}
}
| [
"[email protected]"
] | |
1335d63844a78ecc1f66877069e4189c8a08d4ec | 68fd2b5cb5582e1c800dfa65bfac7c9167045928 | /src/rpcrawtransaction.cpp | 17e1db83b2d7564883d327be3f829fb6c051e597 | [
"MIT"
] | permissive | transferdev/Transfermasterdata | 8e3df2fa0bb2c39fb87e46e9f6d0cc82847ba86f | 4a74b1b61141722994062c7eac5f58005e99d2e4 | refs/heads/master | 2021-01-25T12:14:28.807562 | 2015-08-13T13:06:46 | 2015-08-13T13:06:46 | 40,659,720 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 23,561 | cpp | // Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <boost/assign/list_of.hpp>
#include "base58.h"
#include "rpcserver.h"
#include "txdb.h"
#include "init.h"
#include "main.h"
#include "net.h"
#include "keystore.h"
#ifdef ENABLE_WALLET
#include "wallet.h"
#endif
using namespace std;
using namespace boost;
using namespace boost::assign;
using namespace json_spirit;
void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeHex)
{
txnouttype type;
vector<CTxDestination> addresses;
int nRequired;
out.push_back(Pair("asm", scriptPubKey.ToString()));
if (fIncludeHex)
out.push_back(Pair("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end())));
if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired))
{
out.push_back(Pair("type", GetTxnOutputType(type)));
return;
}
out.push_back(Pair("reqSigs", nRequired));
out.push_back(Pair("type", GetTxnOutputType(type)));
Array a;
BOOST_FOREACH(const CTxDestination& addr, addresses)
a.push_back(CBitcoinAddress(addr).ToString());
out.push_back(Pair("addresses", a));
}
void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
{
entry.push_back(Pair("txid", tx.GetHash().GetHex()));
entry.push_back(Pair("version", tx.nVersion));
entry.push_back(Pair("time", (int64_t)tx.nTime));
entry.push_back(Pair("locktime", (int64_t)tx.nLockTime));
Array vin;
BOOST_FOREACH(const CTxIn& txin, tx.vin)
{
Object in;
if (tx.IsCoinBase())
in.push_back(Pair("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end())));
else
{
in.push_back(Pair("txid", txin.prevout.hash.GetHex()));
in.push_back(Pair("vout", (int64_t)txin.prevout.n));
Object o;
o.push_back(Pair("asm", txin.scriptSig.ToString()));
o.push_back(Pair("hex", HexStr(txin.scriptSig.begin(), txin.scriptSig.end())));
in.push_back(Pair("scriptSig", o));
}
in.push_back(Pair("sequence", (int64_t)txin.nSequence));
vin.push_back(in);
}
entry.push_back(Pair("vin", vin));
Array vout;
for (unsigned int i = 0; i < tx.vout.size(); i++)
{
const CTxOut& txout = tx.vout[i];
Object out;
out.push_back(Pair("value", ValueFromAmount(txout.nValue)));
out.push_back(Pair("n", (int64_t)i));
Object o;
ScriptPubKeyToJSON(txout.scriptPubKey, o, false);
out.push_back(Pair("scriptPubKey", o));
vout.push_back(out);
}
entry.push_back(Pair("vout", vout));
if (hashBlock != 0)
{
entry.push_back(Pair("blockhash", hashBlock.GetHex()));
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock);
if (mi != mapBlockIndex.end() && (*mi).second)
{
CBlockIndex* pindex = (*mi).second;
if (pindex->IsInMainChain())
{
entry.push_back(Pair("confirmations", 1 + nBestHeight - pindex->nHeight));
entry.push_back(Pair("time", (int64_t)pindex->nTime));
entry.push_back(Pair("blocktime", (int64_t)pindex->nTime));
}
else
entry.push_back(Pair("confirmations", 0));
}
}
}
Value getrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"getrawtransaction <txid> [verbose=0]\n"
"If verbose=0, returns a string that is\n"
"serialized, hex-encoded data for <txid>.\n"
"If verbose is non-zero, returns an Object\n"
"with information about <txid>.");
uint256 hash;
hash.SetHex(params[0].get_str());
bool fVerbose = false;
if (params.size() > 1)
fVerbose = (params[1].get_int() != 0);
CTransaction tx;
uint256 hashBlock = 0;
if (!GetTransaction(hash, tx, hashBlock))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "No information available about transaction");
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << tx;
string strHex = HexStr(ssTx.begin(), ssTx.end());
if (!fVerbose)
return strHex;
Object result;
result.push_back(Pair("hex", strHex));
TxToJSON(tx, hashBlock, result);
return result;
}
#ifdef ENABLE_WALLET
Value listunspent(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 3)
throw runtime_error(
"listunspent [minconf=1] [maxconf=9999999] [\"address\",...]\n"
"Returns array of unspent transaction outputs\n"
"with between minconf and maxconf (inclusive) confirmations.\n"
"Optionally filtered to only include txouts paid to specified addresses.\n"
"Results are an array of Objects, each of which has:\n"
"{txid, vout, scriptPubKey, amount, confirmations}");
RPCTypeCheck(params, list_of(int_type)(int_type)(array_type));
int nMinDepth = 1;
if (params.size() > 0)
nMinDepth = params[0].get_int();
int nMaxDepth = 9999999;
if (params.size() > 1)
nMaxDepth = params[1].get_int();
set<CBitcoinAddress> setAddress;
if (params.size() > 2)
{
Array inputs = params[2].get_array();
BOOST_FOREACH(Value& input, inputs)
{
CBitcoinAddress address(input.get_str());
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Transfer address: ")+input.get_str());
if (setAddress.count(address))
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+input.get_str());
setAddress.insert(address);
}
}
Array results;
vector<COutput> vecOutputs;
assert(pwalletMain != NULL);
pwalletMain->AvailableCoins(vecOutputs, false);
BOOST_FOREACH(const COutput& out, vecOutputs)
{
if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth)
continue;
if(setAddress.size())
{
CTxDestination address;
if(!ExtractDestination(out.tx->vout[out.i].scriptPubKey, address))
continue;
if (!setAddress.count(address))
continue;
}
int64_t nValue = out.tx->vout[out.i].nValue;
const CScript& pk = out.tx->vout[out.i].scriptPubKey;
Object entry;
entry.push_back(Pair("txid", out.tx->GetHash().GetHex()));
entry.push_back(Pair("vout", out.i));
CTxDestination address;
if (ExtractDestination(out.tx->vout[out.i].scriptPubKey, address))
{
entry.push_back(Pair("address", CBitcoinAddress(address).ToString()));
if (pwalletMain->mapAddressBook.count(address))
entry.push_back(Pair("account", pwalletMain->mapAddressBook[address]));
}
entry.push_back(Pair("scriptPubKey", HexStr(pk.begin(), pk.end())));
if (pk.IsPayToScriptHash())
{
CTxDestination address;
if (ExtractDestination(pk, address))
{
const CScriptID& hash = boost::get<const CScriptID&>(address);
CScript redeemScript;
if (pwalletMain->GetCScript(hash, redeemScript))
entry.push_back(Pair("redeemScript", HexStr(redeemScript.begin(), redeemScript.end())));
}
}
entry.push_back(Pair("amount",ValueFromAmount(nValue)));
entry.push_back(Pair("confirmations",out.nDepth));
results.push_back(entry);
}
return results;
}
#endif
Value createrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 2)
throw runtime_error(
"createrawtransaction [{\"txid\":txid,\"vout\":n},...] {address:amount,...}\n"
"Create a transaction spending given inputs\n"
"(array of objects containing transaction id and output number),\n"
"sending to given address(es).\n"
"Returns hex-encoded raw transaction.\n"
"Note that the transaction's inputs are not signed, and\n"
"it is not stored in the wallet or transmitted to the network.");
RPCTypeCheck(params, list_of(array_type)(obj_type));
Array inputs = params[0].get_array();
Object sendTo = params[1].get_obj();
CTransaction rawTx;
BOOST_FOREACH(Value& input, inputs)
{
const Object& o = input.get_obj();
const Value& txid_v = find_value(o, "txid");
if (txid_v.type() != str_type)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing txid key");
string txid = txid_v.get_str();
if (!IsHex(txid))
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected hex txid");
const Value& vout_v = find_value(o, "vout");
if (vout_v.type() != int_type)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing vout key");
int nOutput = vout_v.get_int();
if (nOutput < 0)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive");
CTxIn in(COutPoint(uint256(txid), nOutput));
rawTx.vin.push_back(in);
}
set<CBitcoinAddress> setAddress;
BOOST_FOREACH(const Pair& s, sendTo)
{
CBitcoinAddress address(s.name_);
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Transfer address: ")+s.name_);
if (setAddress.count(address))
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_);
setAddress.insert(address);
CScript scriptPubKey;
scriptPubKey.SetDestination(address.Get());
int64_t nAmount = AmountFromValue(s.value_);
CTxOut out(nAmount, scriptPubKey);
rawTx.vout.push_back(out);
}
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << rawTx;
return HexStr(ss.begin(), ss.end());
}
Value decoderawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"decoderawtransaction <hex string>\n"
"Return a JSON object representing the serialized, hex-encoded transaction.");
RPCTypeCheck(params, list_of(str_type));
vector<unsigned char> txData(ParseHex(params[0].get_str()));
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
CTransaction tx;
try {
ssData >> tx;
}
catch (std::exception &e) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
}
Object result;
TxToJSON(tx, 0, result);
return result;
}
Value decodescript(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"decodescript <hex string>\n"
"Decode a hex-encoded script.");
RPCTypeCheck(params, list_of(str_type));
Object r;
CScript script;
if (params[0].get_str().size() > 0){
vector<unsigned char> scriptData(ParseHexV(params[0], "argument"));
script = CScript(scriptData.begin(), scriptData.end());
} else {
// Empty scripts are valid
}
ScriptPubKeyToJSON(script, r, false);
r.push_back(Pair("p2sh", CBitcoinAddress(script.GetID()).ToString()));
return r;
}
Value signrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 4)
throw runtime_error(
"signrawtransaction <hex string> [{\"txid\":txid,\"vout\":n,\"scriptPubKey\":hex,\"redeemScript\":hex},...] [<privatekey1>,...] [sighashtype=\"ALL\"]\n"
"Sign inputs for raw transaction (serialized, hex-encoded).\n"
"Second optional argument (may be null) is an array of previous transaction outputs that\n"
"this transaction depends on but may not yet be in the blockchain.\n"
"Third optional argument (may be null) is an array of base58-encoded private\n"
"keys that, if given, will be the only keys used to sign the transaction.\n"
"Fourth optional argument is a string that is one of six values; ALL, NONE, SINGLE or\n"
"ALL|ANYONECANPAY, NONE|ANYONECANPAY, SINGLE|ANYONECANPAY.\n"
"Returns json object with keys:\n"
" hex : raw transaction with signature(s) (hex-encoded string)\n"
" complete : 1 if transaction has a complete set of signature (0 if not)"
#ifdef ENABLE_WALLET
+ HelpRequiringPassphrase()
#endif
);
RPCTypeCheck(params, list_of(str_type)(array_type)(array_type)(str_type), true);
vector<unsigned char> txData(ParseHex(params[0].get_str()));
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
vector<CTransaction> txVariants;
while (!ssData.empty())
{
try {
CTransaction tx;
ssData >> tx;
txVariants.push_back(tx);
}
catch (std::exception &e) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
}
}
if (txVariants.empty())
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Missing transaction");
// mergedTx will end up with all the signatures; it
// starts as a clone of the rawtx:
CTransaction mergedTx(txVariants[0]);
bool fComplete = true;
// Fetch previous transactions (inputs):
map<COutPoint, CScript> mapPrevOut;
for (unsigned int i = 0; i < mergedTx.vin.size(); i++)
{
CTransaction tempTx;
MapPrevTx mapPrevTx;
CTxDB txdb("r");
map<uint256, CTxIndex> unused;
bool fInvalid;
// FetchInputs aborts on failure, so we go one at a time.
tempTx.vin.push_back(mergedTx.vin[i]);
tempTx.FetchInputs(txdb, unused, false, false, mapPrevTx, fInvalid);
// Copy results into mapPrevOut:
BOOST_FOREACH(const CTxIn& txin, tempTx.vin)
{
const uint256& prevHash = txin.prevout.hash;
if (mapPrevTx.count(prevHash) && mapPrevTx[prevHash].second.vout.size()>txin.prevout.n)
mapPrevOut[txin.prevout] = mapPrevTx[prevHash].second.vout[txin.prevout.n].scriptPubKey;
}
}
bool fGivenKeys = false;
CBasicKeyStore tempKeystore;
if (params.size() > 2 && params[2].type() != null_type)
{
fGivenKeys = true;
Array keys = params[2].get_array();
BOOST_FOREACH(Value k, keys)
{
CBitcoinSecret vchSecret;
bool fGood = vchSecret.SetString(k.get_str());
if (!fGood)
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key");
CKey key = vchSecret.GetKey();
tempKeystore.AddKey(key);
}
}
#ifdef ENABLE_WALLET
else
EnsureWalletIsUnlocked();
#endif
// Add previous txouts given in the RPC call:
if (params.size() > 1 && params[1].type() != null_type)
{
Array prevTxs = params[1].get_array();
BOOST_FOREACH(Value& p, prevTxs)
{
if (p.type() != obj_type)
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "expected object with {\"txid'\",\"vout\",\"scriptPubKey\"}");
Object prevOut = p.get_obj();
RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type));
string txidHex = find_value(prevOut, "txid").get_str();
if (!IsHex(txidHex))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "txid must be hexadecimal");
uint256 txid;
txid.SetHex(txidHex);
int nOut = find_value(prevOut, "vout").get_int();
if (nOut < 0)
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "vout must be positive");
string pkHex = find_value(prevOut, "scriptPubKey").get_str();
if (!IsHex(pkHex))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "scriptPubKey must be hexadecimal");
vector<unsigned char> pkData(ParseHex(pkHex));
CScript scriptPubKey(pkData.begin(), pkData.end());
COutPoint outpoint(txid, nOut);
if (mapPrevOut.count(outpoint))
{
// Complain if scriptPubKey doesn't match
if (mapPrevOut[outpoint] != scriptPubKey)
{
string err("Previous output scriptPubKey mismatch:\n");
err = err + mapPrevOut[outpoint].ToString() + "\nvs:\n"+
scriptPubKey.ToString();
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, err);
}
}
else
mapPrevOut[outpoint] = scriptPubKey;
// if redeemScript given and not using the local wallet (private keys
// given), add redeemScript to the tempKeystore so it can be signed:
if (fGivenKeys && scriptPubKey.IsPayToScriptHash())
{
RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)("redeemScript",str_type));
Value v = find_value(prevOut, "redeemScript");
if (!(v == Value::null))
{
vector<unsigned char> rsData(ParseHexV(v, "redeemScript"));
CScript redeemScript(rsData.begin(), rsData.end());
tempKeystore.AddCScript(redeemScript);
}
}
}
}
#ifdef ENABLE_WALLET
const CKeyStore& keystore = ((fGivenKeys || !pwalletMain) ? tempKeystore : *pwalletMain);
#else
const CKeyStore& keystore = tempKeystore;
#endif
int nHashType = SIGHASH_ALL;
if (params.size() > 3 && params[3].type() != null_type)
{
static map<string, int> mapSigHashValues =
boost::assign::map_list_of
(string("ALL"), int(SIGHASH_ALL))
(string("ALL|ANYONECANPAY"), int(SIGHASH_ALL|SIGHASH_ANYONECANPAY))
(string("NONE"), int(SIGHASH_NONE))
(string("NONE|ANYONECANPAY"), int(SIGHASH_NONE|SIGHASH_ANYONECANPAY))
(string("SINGLE"), int(SIGHASH_SINGLE))
(string("SINGLE|ANYONECANPAY"), int(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY))
;
string strHashType = params[3].get_str();
if (mapSigHashValues.count(strHashType))
nHashType = mapSigHashValues[strHashType];
else
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid sighash param");
}
bool fHashSingle = ((nHashType & ~SIGHASH_ANYONECANPAY) == SIGHASH_SINGLE);
// Sign what we can:
for (unsigned int i = 0; i < mergedTx.vin.size(); i++)
{
CTxIn& txin = mergedTx.vin[i];
if (mapPrevOut.count(txin.prevout) == 0)
{
fComplete = false;
continue;
}
const CScript& prevPubKey = mapPrevOut[txin.prevout];
txin.scriptSig.clear();
// Only sign SIGHASH_SINGLE if there's a corresponding output:
if (!fHashSingle || (i < mergedTx.vout.size()))
SignSignature(keystore, prevPubKey, mergedTx, i, nHashType);
// ... and merge in other signatures:
BOOST_FOREACH(const CTransaction& txv, txVariants)
{
txin.scriptSig = CombineSignatures(prevPubKey, mergedTx, i, txin.scriptSig, txv.vin[i].scriptSig);
}
if (!VerifyScript(txin.scriptSig, prevPubKey, mergedTx, i, STANDARD_SCRIPT_VERIFY_FLAGS, 0))
fComplete = false;
}
Object result;
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << mergedTx;
result.push_back(Pair("hex", HexStr(ssTx.begin(), ssTx.end())));
result.push_back(Pair("complete", fComplete));
return result;
}
Value sendrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 1)
throw runtime_error(
"sendrawtransaction <hex string>\n"
"Submits raw transaction (serialized, hex-encoded) to local node and network.");
RPCTypeCheck(params, list_of(str_type));
// parse hex string from parameter
vector<unsigned char> txData(ParseHex(params[0].get_str()));
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
CTransaction tx;
// deserialize binary data stream
try {
ssData >> tx;
}
catch (std::exception &e) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
}
uint256 hashTx = tx.GetHash();
// See if the transaction is already in a block
// or in the memory pool:
CTransaction existingTx;
uint256 hashBlock = 0;
if (GetTransaction(hashTx, existingTx, hashBlock))
{
if (hashBlock != 0)
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("transaction already in block ")+hashBlock.GetHex());
// Not in block, but already in the memory pool; will drop
// through to re-relay it.
}
else
{
// push to local node
if (!AcceptToMemoryPool(mempool, tx, true, NULL))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected");
}
RelayTransaction(tx, hashTx);
return hashTx.GetHex();
}
Value searchrawtransactions(const Array ¶ms, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 4)
throw runtime_error(
"searchrawtransactions <address> [verbose=1] [skip=0] [count=100]\n");
CBitcoinAddress address(params[0].get_str());
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
CTxDestination dest = address.Get();
std::vector<uint256> vtxhash;
if (!FindTransactionsByDestination(dest, vtxhash))
throw JSONRPCError(RPC_DATABASE_ERROR, "Cannot search for address");
int nSkip = 0;
int nCount = 100;
bool fVerbose = true;
if (params.size() > 1)
fVerbose = (params[1].get_int() != 0);
if (params.size() > 2)
nSkip = params[2].get_int();
if (params.size() > 3)
nCount = params[3].get_int();
if (nSkip < 0)
nSkip += vtxhash.size();
if (nSkip < 0)
nSkip = 0;
if (nCount < 0)
nCount = 0;
std::vector<uint256>::const_iterator it = vtxhash.begin();
while (it != vtxhash.end() && nSkip--) it++;
Array result;
while (it != vtxhash.end() && nCount--) {
CTransaction tx;
uint256 hashBlock;
if (!GetTransaction(*it, tx, hashBlock))
{
// throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Cannot read transaction from disk");
Object obj;
obj.push_back(Pair("ERROR", "Cannot read transaction from disk"));
result.push_back(obj);
}
else
{
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << tx;
string strHex = HexStr(ssTx.begin(), ssTx.end());
if (fVerbose) {
Object object;
TxToJSON(tx, hashBlock, object);
object.push_back(Pair("hex", strHex));
result.push_back(object);
} else {
result.push_back(strHex);
}
}
it++;
}
return result;
}
| [
"[email protected]"
] | |
c1e94c426da37ffce6cb41062d7dc7cb457acea8 | 86c5fcc16cac12fb7b952281ee65246a9ff2e93e | /01_C++Project/44-Singleton/44-Singleton/ObjectList.h | bc7ae8369c5dc59602c0e534d308eab7244c8172 | [] | no_license | eungyu-kim/c-pluse-exam | b44df7b597386b62cdcce4c017e983b794ff1844 | a3bdf3c4efa3e8a2db2b28c46426fb10470c8c6b | refs/heads/master | 2021-09-22T18:23:50.650680 | 2018-09-13T14:52:21 | 2018-09-13T14:52:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 363 | h | // ObjectList.h
#pragma once
#include <vector>
#include <iostream>
using namespace std;
class IntList : public vector<int>
{
static IntList intList;
private:
IntList()
{
}
IntList(const IntList &)
{
}
public:
static IntList &GetIntList()
{
return intList;
}
};
class IntListUser
{
public:
void PushBack(int val);
void Write(IntList &intList);
}; | [
"[email protected]"
] | |
edabd3864db908a4a2512f94f98f9d857a5fbe01 | 9de53b71dfde879c7201ec4e7f67e4d5b65a28a0 | /Src/game.cpp | f7db671f95a3a025c3a1421b2bed9613f1143cb9 | [] | no_license | ATLANT-Z/ATLANT-Progect | 9d257b2ebe57e140f249fe8911bad46fd34f922f | ace16cc3dfb3322fb044c50d36a9e15946bb49e0 | refs/heads/master | 2021-01-21T21:14:55.802771 | 2017-06-24T14:32:03 | 2017-06-24T14:32:03 | 94,792,946 | 0 | 0 | null | 2017-06-22T03:52:30 | 2017-06-19T15:36:37 | C++ | UTF-8 | C++ | false | false | 13,394 | cpp | #define _CRT_SECURE_NO_WARNINGS
#include"game.h"
#include"dynamic_array.h"
#include<iostream>
#include<Windows.h>
#include<time.h>
using namespace std;
namespace warships
{
Map::Map()
{
create_array(table_mode, getHeight(), getWidth());// player field
fill_array(table_mode, getHeight(), getWidth(), 0);
create_array(table_state, getHeight(), getWidth());
fill_array(table_state, getHeight(), getWidth(), 0);
setShips();
}
void Map::render(Game&game)
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(handle, { 0, 0 });
for (unsigned int y = 0; y < getHeight(); y++)
{
for (unsigned int x = 0; x < getWidth(); x++)
{
switch (table_mode[y][x])
{
case CLOSE:
if (table_state[y][x] == SHIP_HERE && game.getIsOver())
{
SetConsoleTextAttribute(handle, 7 * 16 + 9);
cout << (char)254;
}
else
{
SetConsoleTextAttribute(handle, 8);
cout << (char)219;
}
break;
case OPEN:
SetConsoleTextAttribute(handle, 7 * 16 + 9);
if (table_state[y][x] == EMPTY || table_state[y][x] == NEAR_SHIP)
{
cout << ' ';
}
else if (table_state[y][x] == MISS)
{
SetConsoleTextAttribute(handle, 3 * 16 + 9);
cout << '*';
}
else if (table_state[y][x] == DESTROY)
{
SetConsoleTextAttribute(handle, 8 * 16 + 12);
cout << (char)35;
}
else if (table_state[y][x] == EXPLODED)
{
SetConsoleTextAttribute(handle, 8 * 16 + 12);
cout << (char)253;
}
else
cout << table_state[y][x];
break;
}
}
cout << endl;
}
SetConsoleTextAttribute(handle, 8 + 0);
}
void Map::renderp()
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
for (unsigned int y = 0; y < getHeight(); y++)
{
SetConsoleCursorPosition(handle, { 12, y });
for (unsigned int x = 0; x < getWidth(); x++)
{
switch (table_mode[y][x])
{
case CLOSE:
if (table_state[y][x] == EMPTY || table_state[y][x] == NEAR_SHIP)
{
SetConsoleTextAttribute(handle, 8);
cout << (char)219;
}
else if (table_state[y][x] == SHIP_HERE)
{
SetConsoleTextAttribute(handle, 7 * 16 + 9);
cout << (char)254;
}
break;
case OPEN:
SetConsoleTextAttribute(handle, 7 * 16 + 9);
if (table_state[y][x] == EMPTY || table_state[y][x] == NEAR_SHIP)
{
cout << ' ';
}
else if (table_state[y][x] == SHIP_HERE)
{
cout << (char)254;
}
else if (table_state[y][x] == MISS)
{
SetConsoleTextAttribute(handle, 3 * 16 + 9);
cout << '*';
}
else if (table_state[y][x] == DESTROY)
{
SetConsoleTextAttribute(handle, 8 * 16 + 12);
cout << (char)35;
}
else if (table_state[y][x] == EXPLODED)
{
SetConsoleTextAttribute(handle, 8 * 16 + 12);
cout << (char)253;
}
else
cout << table_state[y][x];
break;
}
}
cout << endl;
}
SetConsoleTextAttribute(handle, 8 + 0);
SetConsoleCursorPosition(handle, { 25, 1 });
cout << "LEFT_BUTTON : Fire " << endl;
SetConsoleCursorPosition(handle, { 25, 2 });
cout << "RIGHT_BUTTON: Menu " << endl;
SetConsoleCursorPosition(handle, { 25, 3 });
}
void Map::setShips()
{
SetShipAuto(4);
SetShipAuto(3);
SetShipAuto(3);
SetShipAuto(2);
SetShipAuto(2);
SetShipAuto(2);
SetShipAuto(1);
SetShipAuto(1);
SetShipAuto(1);
SetShipAuto(1);
}
int Map::chekCoord(int y, int x)
{
if (x >= 0 && y >= 0 && x < getWidth() && y < getHeight())
{
if (table_state[y][x] == EMPTY)
{
return 1;
}
else
return 0;
}
return 0;
}
void Map::SetShipAuto(int deck_)
{
unsigned int cell_ships = 0;
bool mistake = true;
do
{
int x = rand() % getWidth();
int y = rand() % getHeight();
bool horizont = rand() % 2;
if (table_state[y][x] == EMPTY)
{
short empcl = 0;
for (int i = 0; i < deck_; i++)
{
if (horizont)
{
empcl += chekCoord(y, x + i);
}
else
{
empcl += chekCoord(y + i, x);
}
}
if (empcl == deck_ && horizont)
{
for (int i = 0; i < deck_; i++)
{
table_state[y][x + i] = SHIP_HERE;
++cell_ships;
}
}
else if (empcl == deck_ && !horizont)
{
for (int i = 0; i < deck_; i++)
{
table_state[y + i][x] = SHIP_HERE;
++cell_ships;
}
}
}
} while (cell_ships < deck_ && mistake);
//_______________________________________________________ chek
for (int y = 0; y < getHeight(); y++)
for (int x = 0; x < getWidth(); x++)
{
if (table_state[y][x] == SHIP_HERE)//_____________If there ship...
for (int i = 0; i < 8; i++)
{
int dx, dy;//_______________Chek cells near
switch (i)
{
case 0: dx = 0, dy = -1; break;
case 1: dx = 1, dy = -1; break;
case 2: dx = 1, dy = 0; break;
case 3: dx = 1, dy = 1; break;
case 4: dx = 0, dy = 1; break;
case 5: dx = -1, dy = 1; break;
case 6: dx = -1, dy = 0; break;
case 7: dx = -1, dy = -1; break;
}
dx += x;
dy += y;
if (dx >= 0 && dy >= 0 && dx < getWidth() && dy < getHeight())// ____ WIthin the game field
if (table_state[dy][dx] == EMPTY)
{
table_state[dy][dx] = NEAR_SHIP;
}
}
}
};
void Player::openCell(Game&game, Map&map, unsigned int x, unsigned int y, bool AI)
{
switch (map.table_mode[y][x])
{
case OPEN:
break;
case CLOSE:
map.table_mode[y][x] = OPEN;
if (map.table_state[y][x] == SHIP_HERE)
{
map.table_state[y][x] = DESTROY;
if (AI)
game.destroyPlayerShip();
else
game.destroyCompShip();
if (ChekDestroy(map, y, x))// need explosion?
{
map.table_state[y][x] = EXPLODED; // explosion
explosion(map, y, x); // Explosion of neighboring cells
}
Sleep(10); //pause on explosion;
update();
}
else if (map.table_state[y][x] == EMPTY || map.table_state[y][x] == NEAR_SHIP)
{
map.table_state[y][x] = MISS;
if (AI)
PlayerTurn = true;
else
PlayerTurn = false;
break;
}
break;
}
}
bool Player::ChekDestroy(Map&map, const int y, const int x, const int cheky, int const chekx)
{
for (int i = 0; i < 4; i++)
{
int dy, dx;
switch (i)
{
case 0: dx = 0, dy = -1; break;
case 1: dx = 1, dy = 0; break;
case 2: dx = 0, dy = 1; break;
case 3: dx = -1, dy = 0; break;
}
dy += y;
dx += x;
if (dx >= 0 && dy >= 0 && dx < getWidth() && dy < getHeight())
{
if (map.table_state[dy][dx] == NEAR_SHIP || map.table_state[dy][dx] == MISS)
continue;
else if (map.table_state[dy][dx] == SHIP_HERE)
{
return false;
break;
}
else if (map.table_state[dy][dx] == DESTROY)
{
if (dy == cheky && dx == chekx)
continue;
else
{
if (ChekDestroy(map, dy, dx, y, x))
continue;
else
return false;
}
}
}
}
return true;
}
void Player::explosion(Map&map, unsigned int y, unsigned int x)
{
for (int i = 0; i < 8; i++)
{
int dx, dy;
switch (i)
{
case 0: dx = 0, dy = -1; break;
case 1: dx = 1, dy = -1; break;
case 2: dx = 1, dy = 0; break;
case 3: dx = 1, dy = 1; break;
case 4: dx = 0, dy = 1; break;
case 5: dx = -1, dy = 1; break;
case 6: dx = -1, dy = 0; break;
case 7: dx = -1, dy = -1; break;
}
dx += x;
dy += y;
if (dx >= 0 && dy >= 0 && dx < getWidth() && dy < getHeight())
{
if (map.table_state[dy][dx] == DESTROY)
{
map.table_state[dy][dx] = EXPLODED;
explosion(map, dy, dx);
}
else if (map.table_state[dy][dx] == NEAR_SHIP)
{
map.table_mode[dy][dx] = OPEN;
map.table_state[dy][dx] = MISS;
}
else if (map.table_state[dy][dx] == EXPLODED || map.table_state[dy][dx] == MISS)
{
continue;
}
}
}
}
void Record::setRecord(Game&game)
{
record.pShips = game.playerShips;
FILE * f;
fopen_s(&f, "record.txt", "a");
char ships[4];
_itoa(record.pShips, ships, 10);
char * rec = new char[50];
rec = record.name;
strcat(rec, "-");
strcat(rec, ships);
strcat(rec, "\n");
fputs(rec, f);
fclose(f);
}
void Record::hallOfFame(const int x, const int y, Game&game)
{
setPlayerShips(game.getPlayerShips());
setCompShips(game.getCompShips());
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(handle, { x, y });
if (record.name)
cout << "Login : " << record.name << " - ships : " << record.pShips << " Enemy ships : " << record.cShips << endl << endl;
if (game.getIsOver())
{
showRecords(game);
}
}
void Record::showRecords(Game&game)
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(handle, 10);
cout << "Last records :\n";
setRecord(game);
FILE * f;
fopen_s(&f, "record.txt", "r");
if (!f)
{
cout << "Wrong filename!\n";
return;
}
while (!feof(f))
putchar(fgetc(f));
fclose(f);
}
void Menu::menu(Game&game, Record &record)
{
renderm(game);
bool menu = true;
do
{
action = getAction();
switch (action.mode)
{
case Game::LEFT_BUTTON:
if (action.coord.X >= 0 && action.coord.X < 10 && action.coord.Y >= 0 && action.coord.Y < 3)
{
menu = false;
}
if (action.coord.X >= 11 && action.coord.X < 20 && action.coord.Y >= 0 && action.coord.Y < 3 && game.getIsGameBegin())
{
record.hallOfFame(0, 5,game);
}
break;
case Game::RIGHT_BUTTON:
break;
}
} while (menu);
}
void Menu::renderm(Game&game)
{
system("cls");
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(handle, 7 * 16 + 9);
for (int y = 0; y < 3; y++) // (0,0) - (10,3)
{
for (int x = 0; x < 10; x++)
{
SetConsoleCursorPosition(handle, { x, y });
if (y == 1 && x == 3)
cout << "PLAY";
else if (!(y == 1 && x >= 3 && x < 7))
cout << ' ';
}
}
if (game.getIsGameBegin())
{
SetConsoleTextAttribute(handle, 7 * 16 + 9);
for (int y = 0; y < 3; y++) // (11,0) - (20,3)
{
for (int x = 11; x < 22; x++)
{
SetConsoleCursorPosition(handle, { x, y });
if (y == 1 && x == 12)
cout << "STATISTIC";
else if (!(y == 1 && x >= 12 && x < 21))
cout << ' ';
}
}
}
SetConsoleTextAttribute(handle, 7 + 0);
}
void Game::processinput(Game&game, Player player, Player enemy, Record & record, Menu&menu, Map&playerMap, Map&compMap)
{
action = getAction();
switch (action.mode)
{
case LEFT_BUTTON:
if (action.coord.X >= 0 && action.coord.X < game.getWidth() &&
action.coord.Y >= 0 && action.coord.Y < game.getHeight())
enemy.openCell(game, compMap, action.coord.X, action.coord.Y); // Fasle - it's not computer turn
break;
case RIGHT_BUTTON:// records
menu.menu(game, record);
system("cls");
compMap.render(game);
playerMap.renderp();
break;
}
}
void Game::prepareGame(Record & record)
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
system("cls");
system("mode con cols=100 lines=75");
isOver = false;
char * name = new char[51];
cout << "HEY!!! Welcome to the World of Warships \nEnter ur name pls : ";
cin.getline(name, 50);
record.setName(name);
/*cout << "If u want set ships write : 0 \nIf u want set ships auto write : 1 \n";
bool auto_set = true;
cin >> auto_set;
cout << "If u want set mode EDITOR : 1 \nElse : 0 \n";
cin >> editor;*/
isWin = false;
isGameBegin = true;
system("cls");
SetConsoleCursorPosition(handle, { 25, 0 });
SetConsoleTextAttribute(handle, 13);
cout << "Your Login : " << record.getName() << endl;
SetConsoleTextAttribute(handle, 8 + 0);
}
void Game::run(Game&game)
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
srand(time(0));
Menu menu;
Record record;
menu.menu(game, record);
prepareGame(record);
Map playerMap;
Map compMap;
Player player;
Player comp;
Mouse mouse;
AI computer;
compMap.render(game);
playerMap.renderp();
while (!isOver)
{
processinput(game, player, comp, record, menu, playerMap, compMap);
update();
compMap.render(game);
playerMap.renderp();
computer.simpleAi(game, playerMap, player);
update();
compMap.render(game);
playerMap.renderp();
SetConsoleTextAttribute(handle, 13);
SetConsoleCursorPosition(handle, { 22, 11 });
cout << compShips;
}
compMap.render(game);
if (isWin)
{
SetConsoleTextAttribute(handle, 13);
SetConsoleCursorPosition(handle, { 22, 11 });
cout << "WIN!!\n";
record.hallOfFame(0,13,game);
}
else
{
SetConsoleTextAttribute(handle, 14);
SetConsoleCursorPosition(handle, { 22, 11 });
cout << "DEFEAT!!\n";
}
}
}
| [
"[email protected]"
] | |
bde8bf47d42194ee138ba308be12b8775c1c3e7b | 768371d8c4db95ad629da1bf2023b89f05f53953 | /applayerprotocols/httptransportfw/Test/T_HttpOnline/cinc112633_2.h | 6dac230cd612599205675efe2a03137bb2b7c747 | [] | no_license | SymbianSource/oss.FCL.sf.mw.netprotocols | 5eae982437f5b25dcf3d7a21aae917f5c7c0a5bd | cc43765893d358f20903b5635a2a125134a2ede8 | refs/heads/master | 2021-01-13T08:23:16.214294 | 2010-10-03T21:53:08 | 2010-10-03T21:53:08 | 71,899,655 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,730 | h | // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//
#ifndef CINC112633_2_H_
#define CINC112633_2_H_
#include <http.h>
#include <http/mhttpfiltercreationcallback.h>
#include <http/mhttpauthenticationcallback.h>
#include "HttpTestCore.h"
// User Include
#include "TestScripts.h"
/**
Derived test case class : test cookies
*/
class CINC112633_2: public CHttpTestTransBase,
public MHTTPTransactionCallback,
public MHTTPAuthenticationCallback
{
public:
static CINC112633_2* NewL(TInt aTestNumber, CScriptFile* aIniSettingsFile);
virtual ~CINC112633_2();
public:
virtual void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent);
virtual TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent);
virtual TBool GetCredentialsL(const TUriC8& aURI, RString aRealm,
RStringF aAuthenticationType,
RString& aUsername,
RString& aPassword);
protected:
CINC112633_2(TInt aTestNumber, CScriptFile* aIniSettingsFile);
const TDesC& TestName();
virtual void DoRunL();
virtual TInt RunError(TInt aErr);
virtual void DoCancel();
void ConfigureSessionFiltersL(TFilterConfigurationIterator* aFilterConfigIter);
private:
CScriptFile* iIniSettingsFile;
protected:
TInt iFailureError;
TInt iTestNumber;
};
#endif /*CINC112633_2_2_H_*/
| [
"[email protected]"
] | |
10eab3af614630d596983430fb9662eaca6d463c | 5f3f88b6dec9db0ed16ed7091fe56f11d3910a94 | /termProject/main.cpp | 3e65b5f413cece356160d78395e11bdd706e5408 | [] | no_license | fullop2/OOP | 1f73183f82bf3a1e6adace4d55f742c3a6110986 | ab2dc3d223dce76b653e8403afd6c3ee2048135a | refs/heads/master | 2020-07-23T19:55:56.520532 | 2020-01-27T03:28:05 | 2020-01-27T03:28:05 | 207,690,146 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 95 | cpp | #include "Game.h"
// test
int main()
{
Game game = Game();
game.update();
return 0;
} | [
"[email protected]"
] | |
c0341a0c14b6f30f8ffbf34d435bbf25298db035 | 7b7e152a33ed88dcd291d118c5e7b1391c746a6d | /Solutions/Topological-And-Heap-Sort/Problem_210_course_schedule_ii.cpp | 42b226e6d72e18bedf96894ba3d48c9deeeeedb0 | [] | no_license | AOE-khkhan/advanced-interview-prep20 | 21fd1846270e11bc9841edfdf4e3db6fef52a82e | 689bb73cbf5102b821e6e57b2036e6c8f0384ef9 | refs/heads/master | 2022-10-07T12:51:32.239085 | 2020-06-06T04:03:13 | 2020-06-06T04:03:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,367 | cpp | /*
UCLA ACM ICPC: Interview Track Leetcode Problem Solutions
Disclaimer: This is not the only valid solution and we do not claim our solutions
to be optimal in terms of runtime or memory usage, we are merely giving example
solutions to questions for learning purposes only
Course Schedule II
Leetcode Problem 210
https://leetcode.com/problems/course-schedule-ii/
*/
// There are a total of n courses you have to take, labeled from 0 to n-1.
// Some courses may have prerequisites, for example to take course 0 you
// have to first take course 1, which is expressed as a pair: [0,1]
// Given the total number of courses and a list of prerequisite pairs,
// return the ordering of courses you should take to finish all courses.
// There may be multiple correct orders, you just need to return one of them.
// If it is impossible to finish all courses, return an empty array.
class Solution {
public:
// This problem is essentially topological sort,
// but we must return one such sort if possible.
vector<int> findOrder(int numCourses, vector<vector<int>>& prerequisites) {
// We want to keep track of certain information given a node
// * What nodes it points to
// * How many incoming edges it has from visited nodes
// * Whether we have visited the node yet
// This section of code builds up this information
vector<list<int>> graph(numCourses); // Adjacency list
vector<int> incoming(numCourses, 0);
vector<bool> visited(numCourses, false);
for(vector<int> e: prerequisites) {
graph[e[1]].push_back(e[0]);
incoming[e[0]]++;
}
// This queue will store nodes that aren't visited
// and have zero incoming edges. We pick nodes from
// here to put into our topological sort
queue<int> q;
for(int i = 0; i < numCourses; i++) {
if(incoming[i] == 0) q.push(i);
}
vector<int> topoSort;
while(!q.empty()) {
// Get a node from the queue and add it to
// the topological sort. Also mark it as
// visited
int cur = q.front(); q.pop();
topoSort.push_back(cur);
visited[cur] = true;
// Add nodes that the current node points to
// to the queue only if we haven't visited it
// and it has no incoming edges
for(int node: graph[cur]) {
incoming[node]--;
if(!visited[node] && incoming[node] == 0) {
q.push(node);
}
}
}
// A valid topological sort should contain all
// `numCourses` nodes. If it doesn't, we return
// an empty vector
if(topoSort.size() != numCourses) return {};
else return topoSort;
}
};
// Time Complexity: O(V + E) where V is the number of nodes
// and E is the number of edges. We loop through all nodes
// a few times, which is O(V). The while loop with the
// queue potentially processes all edges, which is O(E)
// Space Complexity: O(V + E) where V is the number of nodes
// and E is the number of edges. This is because the adjacency
// list takes up O(V + E) space, and it is the biggest data
// structure we have in our algorithm | [
"[email protected]"
] | |
219acf90a0567a15d96cc8edb3e788d072a2a7eb | efd5e93943e5a540e3475deec3b7ec05ee29b998 | /Build/Aestheticube_BackUpThisFolder_ButDontShipItWithYourGame/il2cppOutput/GenericMethods5.cpp | a17d310395eff762f0c174735d87860d49653d96 | [] | no_license | bluooga/Aestheticube-Reborn | 681ad76c2d41927272bb3981200940ee8243d881 | d7fdd311cede4509f5728eeeeae7790c1581fe75 | refs/heads/master | 2022-04-21T01:19:04.943996 | 2020-04-13T09:10:34 | 2020-04-13T09:10:34 | 254,889,670 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 132 | cpp | version https://git-lfs.github.com/spec/v1
oid sha256:f43511e34c60cd80325b0275a03d65662e461caafed8836c5e1634773ec2b815
size 2117127
| [
"[email protected]"
] | |
50f5a6cdec11a24e9cf659cc8cac2faba4496a56 | 826e9c5d929194b8820a3e4353b19fe47034c51f | /ЛР/1/1.cpp | 119ceae58a0d40a9bb27f99074e8d71fa46d7326 | [] | no_license | Jetris02/LR-3 | 5b82fd8f5eb8441a4ec409e0b7a5aa2b9d37d8c8 | feef33c2fa05e078718f1fb90bb73cf4932522c4 | refs/heads/main | 2023-06-10T11:40:19.606824 | 2021-07-05T08:34:33 | 2021-07-05T08:34:33 | 383,066,320 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 913 | cpp | #include <iostream>
using namespace std;
void set(int* a, int size)
{
cout << "Введите элементы массива\n";
for (int i = 0; i < size; i++)
cin >> a[i];
}
void get(int* a, int size)
{
cout << "\nМассив\n";
for (int i = 0; i < size; i++)
cout << a[i] << " ";
cout << endl;
}
int* change(int* a, int& size)
{
int* b;
int M = 0, j = 0;
for (int i = 0; i < size; i++)
{
if (a[i] >= 0)
M++;
}
b = new int[M];
for (int i = 0; i < size; i++)
{
if (a[i] >= 0)
{
b[j] = a[i];
j++;
}
}
size = M;
a = b;
return a;
}
void main()
{
setlocale(LC_ALL, "Russian");
int* array;
int N;
cout << "Введите количество элементов в массиве\n";
cin >> N;
array = new int[N];
set(array, N);
get(array, N);
array = change(array, N);
get(array, N);
system("pause");
} | [
"[email protected]"
] | |
69d0b1a0019640ec32bbd8fe80531942f76553a4 | cd25fb9c6a9d39a6b8a64c85dbcf8bbdb2465a6d | /src/pose/Polynomial.cc | 03aad60f802c29025d5aa63f9e54894d918678da | [
"MIT"
] | permissive | donaldmunro/PlanarTrainer | 075cd80ba43c948768be02471930185c7e279bd2 | c990ad78226d260730f0af2d9d1e65d6aa5fd444 | refs/heads/master | 2020-03-27T22:09:55.152963 | 2018-09-03T13:38:03 | 2018-09-03T13:38:03 | 147,209,741 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,817 | cc | // Copyright (C) 2013 The Regents of the University of California (Regents).
// All rights reserved.
//
// 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.
//
// * Neither the name of The Regents or University of California nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// 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 HOLDERS 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.
//
// Please contact the author of this library if you have any questions.
// Author: Chris Sweeney ([email protected])
#include "Polynomial.h"
#include <complex>
#include <cmath>
int SolveQuadratic(const double a, const double b, const double c,
std::complex<double> *roots)
{
// If the equation is actually linear.
if (a == 0.0)
{
roots[0] = -1.0 * c / b;
return 1;
}
const double D = b * b - 4 * a * c;
const double sqrt_D = std::sqrt(std::abs(D));
// Real roots.
if (D >= 0)
{
// Stable quadratic roots according to BKP Horn.
// http://people.csail.mit.edu/bkph/articles/Quadratics.pdf
if (b >= 0)
{
roots[0] = (-b - sqrt_D) / (2.0 * a);
roots[1] = (2.0 * c) / (-b - sqrt_D);
}
else
{
roots[0] = (2.0 * c) / (-b + sqrt_D);
roots[1] = (-b + sqrt_D) / (2.0 * a);
}
return 2;
}
// Use the normal quadratic formula for the complex case.
roots[0].real(-b / (2.0 * a));
roots[1].real(-b / (2.0 * a));
roots[0].imag(sqrt_D / (2.0 * a));
roots[1].imag(-sqrt_D / (2.0 * a));
return 2;
}
// Provides solutions to the equation a*x^2 + b*x + c = 0.
int SolveQuadraticReals(const double a, const double b, const double c,
double *roots)
{
std::complex<double> complex_roots[2];
int num_complex_solutions = SolveQuadratic(a, b, c, complex_roots);
int num_real_solutions = 0;
for (int i = 0; i < num_complex_solutions; i++)
{
roots[num_real_solutions++] = complex_roots[i].real();
}
return num_real_solutions;
}
int SolveQuadraticReals(const double a, const double b, const double c,
const double tolerance, double *roots)
{
std::complex<double> complex_roots[2];
int num_complex_solutions = SolveQuadratic(a, b, c, complex_roots);
int num_real_solutions = 0;
for (int i = 0; i < num_complex_solutions; i++)
{
if (std::abs(complex_roots[i].imag()) < tolerance)
{
roots[num_real_solutions++] = complex_roots[i].real();
}
}
return num_real_solutions;
} | [
"[email protected]"
] | |
d3f6e7d76ccfcc0bd35ba77036d551aa27204d85 | 3c540dcae526f66773b37741fcbd5108865fa5ec | /longPrefix.cpp | 95b13968949aecefafc7b304c64c7d43069f16c1 | [] | no_license | nguyenton68/leetcode_sol | 391cf3e74b0c784325e4d68e33e6da0c2fe5a897 | 3d8eb57957c8c3eb9680fec159c7c17546d8d5f3 | refs/heads/master | 2021-03-22T04:57:21.255706 | 2017-09-02T01:27:14 | 2017-09-02T01:27:14 | 101,822,365 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,098 | cpp | /* Longest path of all strings in the array
* Start with the first string: add each char into the result string
* Second loop to go through all strings left in the vector. CHeck if 2 strings next to each other are the same in the vertical index or not
*/
#include<iostream>
#include<vector>
#include<string>
using namespace std;
string longPrefix(vector<string> &strs)
{
string res="";
/* Condition for this loop is tricky, it should not be the size of the vector. If vector has 2 elements, then the answer is wrong */
for(int idx=0; strs.size()>0; res+=strs[0][idx], idx++)
{
for(int i=0; i<strs.size(); i++)
{
/* If the current string is smaller than the first string, no further loop
* Or the vertical index of the 2 strings are not the same
*/
if(idx >=strs[i].size() || (i>0 && (strs[i][idx] != strs[i-1][idx])))
return res;
}
}
return res;
}
int main()
{
vector<string> str;
str.push_back("time");
str.push_back("that");
str.push_back("thought");
string result;
result = longPrefix(str);
cout<<"Result string= "<<result<<endl;
}
| [
"[email protected]"
] | |
87ca4d40c83160e7af0b639fd4418ff2da965067 | 492976adfdf031252c85de91a185bfd625738a0c | /src/Game/AI/AI/aiSwitchWheel.h | 8233a13a2e3c57a96496bcc060454e5fadda76ff | [] | no_license | zeldaret/botw | 50ccb72c6d3969c0b067168f6f9124665a7f7590 | fd527f92164b8efdb746cffcf23c4f033fbffa76 | refs/heads/master | 2023-07-21T13:12:24.107437 | 2023-07-01T20:29:40 | 2023-07-01T20:29:40 | 288,736,599 | 1,350 | 117 | null | 2023-09-03T14:45:38 | 2020-08-19T13:16:30 | C++ | UTF-8 | C++ | false | false | 909 | h | #pragma once
#include "KingSystem/ActorSystem/actAiAi.h"
namespace uking::ai {
class SwitchWheel : public ksys::act::ai::Ai {
SEAD_RTTI_OVERRIDE(SwitchWheel, ksys::act::ai::Ai)
public:
explicit SwitchWheel(const InitArg& arg);
~SwitchWheel() override;
bool init_(sead::Heap* heap) override;
void enter_(ksys::act::ai::InlineParamPack* params) override;
void leave_() override;
void loadParams_() override;
protected:
// static_param at offset 0x38
const float* mRotateStartRad_s{};
// static_param at offset 0x40
const float* mRotateEndRad_s{};
// static_param at offset 0x48
const float* mReverseEndRad_s{};
// static_param at offset 0x50
const float* mReverseStartRad_s{};
// static_param at offset 0x58
const bool* mIsAbleToReverse_s{};
// map_unit_param at offset 0x60
const int* mRotAxis_m{};
};
} // namespace uking::ai
| [
"[email protected]"
] | |
b465375897b4c285f894f47295087015d0561ba0 | 777a75e6ed0934c193aece9de4421f8d8db01aac | /src/Providers/UNIXProviders/X509CredentialFilterEntry/UNIX_X509CredentialFilterEntry_FREEBSD.hxx | 6a9a982e917b36371ea4c9b6ed5af1020e97f671 | [
"MIT"
] | permissive | brunolauze/openpegasus-providers-old | 20fc13958016e35dc4d87f93d1999db0eae9010a | b00f1aad575bae144b8538bf57ba5fd5582a4ec7 | refs/heads/master | 2021-01-01T20:05:44.559362 | 2014-04-30T17:50:06 | 2014-04-30T17:50:06 | 19,132,738 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 148 | hxx | #ifdef PEGASUS_OS_FREEBSD
#ifndef __UNIX_X509CREDENTIALFILTERENTRY_PRIVATE_H
#define __UNIX_X509CREDENTIALFILTERENTRY_PRIVATE_H
#endif
#endif
| [
"[email protected]"
] | |
13ebb1fc5102cb8c227b892d0d3577f20a26e709 | 57abfc3adf70bda81181b94232c9a7fb41183fb6 | /gb.cpp | 825620be9e676c67d1ec764bffeb28360db40171 | [] | no_license | mike-sw/gbd | 91b1bcf44b4e79718d65de48bfd84d359540485d | 566e44c31677d5ca4d53f80423e23b4d335049ef | refs/heads/master | 2021-01-19T17:49:23.282579 | 2019-10-30T13:59:56 | 2019-10-30T13:59:56 | 101,087,512 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 96,214 | cpp | /*
This is a gameboy binary disassembler... technically for the Custom(-ized from the Z80) 8-bit Sharp LR35902
*/
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string.h>
#include <sstream>
using namespace std;
int counter=0; //Keeps track of what address we're disassembling
void printByteAsHex(unsigned char byte)
{
cout << " " << setw(2) << setfill('0') << hex << (int)byte;
}
int convertHextoInt(string hexstr) {
return (int)strtol(hexstr.c_str(), 0, 16);
}
unsigned char getNext8Bits(ifstream &file)
{
char *buffer = new char [1]; //We're going to read this in 1 byte chunks
file.read(buffer,1); //Read the next byte
return *buffer;
}
void print8BitLine(string instruction, string description, string impactedRegister, unsigned char byte1)
{
printByteAsHex(byte1);
//Print the value of these bytes into our function
//cout << setfill('*') << setw(15) << instruction;
cout << "\t\t" << instruction;
printByteAsHex(byte1); //Print the value
//cout << setfill('-') << setw(30);
cout << "\t\t";
//Print the value of these bytes into the description of this function
printByteAsHex(byte1);
cout << impactedRegister;
//cout << setfill('+') << setw(45) << description;
cout << "\t" << description;
//Advance our addresses appropriately
counter=counter+2;
}
void print16BitLine(string instruction, string description, string impactedRegister, unsigned char byte1, unsigned char byte2)
{
//We have to swap bytes 1 and 2 because of endianness
//cout << " ";
printByteAsHex(byte1);
printByteAsHex(byte2);
//Print the value of these bytes into our function
//cout << setfill('*') << setw(15) << instruction;
cout << "\t\t" << instruction;
printByteAsHex(byte2);
printByteAsHex(byte1);
//cout << setfill('-') << setw(30);
cout << "\t";
//Print the value of these bytes into the description of this function
printByteAsHex(byte2);
printByteAsHex(byte1);
cout << impactedRegister;
cout << "\t" << description;
//cout << setfill('+') << setw(45) << description;
//Advance our addresses appropriately
counter=counter+3;
}
void printLine(string instruction, string description)
{
//cout << setfill('*') << setw(15) << instruction;
//cout << setfill('+') << setw(45) << description;
cout << "\t\t" << instruction << "\t\t" << description;
counter++;
}
bool isAddressSpecial(int address, unsigned char data) //It's worth noting that address is passed as a DECIMAL
{
//This data provided by the EXCELLENT documentation here: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header
if(address==256) //100h, our OEP
{
cout << "\t\t<-- Gameboy starts execution here" << endl;
return true;
}
if(address>=260 && address<=307)//Our nintendo logo
{
cout << "\t\t<-- Nintendo logo" << endl;
return true;
}
if(address>=308 && address<=323)
{
cout << "\t\t<-- Game Title" << endl;
return true;
}
if(address==325)//Our manufacturer/publisher code
{
cout << "\t\t<-- Manufacturer and Publisher code" << endl;
return true;
}
if(address==326) //Do we have super gameboy functionality?
{
cout << "\t\t<-- SGB Functionality (";
printByteAsHex(data);
//Read our provided data and determine what the functionality is
switch(data)
{
case 0x00: //No
cout << "= No)" << endl;
break;
case 0x03: //Yes
cout << "= Yes)" << endl;
break;
default:
cout << " = Unknown)" << endl;
break;
}
return true;
}
if(address==327) //What type of cartridge is this?
{
cout << "\t\t<-- Cartridge type, Memory Bank Controller, and Misc Hardware (";
switch(data)
{
case 0x00: //Rom only
cout << "ROM Only)" << endl;
break;
case 0x01:
cout << "MBC1)" << endl;
break;
case 0x02:
cout << "MBC1+RAM)" << endl;
break;
case 0x03:
cout << "MBC1+RAM+Battery)" << endl;
break;
case 0x05:
cout << "MBC2)" << endl;
break;
case 0x06:
cout << "MBC2+Battery)" << endl;
break;
case 0x08:
cout << "ROM+RAM)" << endl;
break;
case 0x09:
cout << "ROM+RAM+Battery)" << endl;
break;
case 0x0B:
cout << "MMM01)" << endl;
break;
case 0x0C:
cout << "MMM01+RAM)" << endl;
break;
case 0x0D:
cout << "MMM01+RAM+Battery)" << endl;
break;
case 0x0F:
cout << "MBC3+Timer+Battery)" << endl;
break;
case 0x10:
cout << "MBC3+Timer+RAM+Battery)" << endl;
break;
case 0x11:
cout << "MBC3)" << endl;
break;
case 0x12:
cout << "MBC3+RAM)" << endl;
break;
case 0x13:
cout << "MBC3+RAM+Battery)" << endl;
break;
case 0x19:
cout << "MBC5)" << endl;
break;
case 0x1A:
cout << "MBC5+RAM)" << endl;
break;
case 0x1B:
cout << "MBC5+RAM+Battery)" << endl;
break;
case 0x1C:
cout << "MBC5+Rumble)" << endl;
break;
case 0x1D:
cout << "MBC5+Rumble+RAM)" << endl;
break;
case 0x1E:
cout << "MBC5+Rumble+RAM+Battery)" << endl;
break;
case 0x20:
cout << "MBC6)" << endl;
break;
case 0x22:
cout << "MBC7+Sensor+Rumble+RAM+Battery)" << endl;
break;
case 0xFC:
cout << "Gameboy Pocket Camera)" << endl;
break;
case 0xFD:
cout << "Bandai Tama5)" << endl;
break;
case 0xFE:
cout << "HuC3)" << endl;
break;
case 0xFF:
cout << "HuC1+RAM+Battery)" << endl;
break;
default:
cout << "Unknown)" << endl;
break;
}
return true;
}
if(address==328) //How big is our cartridge?
{
//We can calculate this by grabbing the value, multiplying by 32, and adding 32
cout << "\t\t<-- The size of the cartridge" << endl;
return true;
}
if(address==329) //How much RAM is available via the cartridge?
{
cout << "\t\t<-- Amount of RAM on the Cartridge (";
switch(data)
{
case 0x00:
cout << "None)" << endl;
break;
case 0x01:
cout << "2kb)" << endl;
break;
case 0x02:
cout << "8kb)" << endl;
break;
case 0x03:
cout << "32kb)" << endl;
break;
case 0x04:
cout << "128kb)" << endl;
break;
case 0x05:
cout << "64kb)" << endl;
break;
default:
cout << "Unknown)" << endl;
break;
}
return true;
}
if(address==330) //Geographic distribution of the cartridge, basically "Are we in Japan?"
{
cout << "\t\t<-- Distribution (";
switch(data)
{
case 0x00:
cout << "Japan)" << endl;
break;
case 0x01:
cout << "Non-Japan)" << endl;
break;
default:
cout << "Unknown)" << endl;
break;
}
return true;
}
if(address==331) //Legacy publisher code. If we show 33, then we need to go above to determine the publisher
{
cout << "\t\t<-- Legacy publisher code (";
switch(data)
{
case 0x33:
cout << "See 0x0144-0x0155. This ROM is too new!)" << endl;
break;
default:
cout << "Unknown)" << endl;
break;
}
return true;
}
if(address==332) //ROM Version number. Usually 0, but it could be something else
{
cout << "\t\t<-- ROM Version number (";
printByteAsHex(data);
cout << ")" << endl;
return true;
}
if(address==333) //header checksum of bytes 0x0134 through 0x014C
{
cout << "\t\t<-- Header (0x0134 - 0x014C) checksum (";
printByteAsHex(data);
cout << ")" << endl;
return true;
}
if(address==334 || address==335) //Global ROM Checksum (unused)
{
cout << "\t\t<-- Full-ROM checksum (";
printByteAsHex(data);
cout << ")" << endl;
return true;
}
return false;
}
int main(int argc, char * argv[])
{
string startAssemblyAtAddressStr="0";
int targetAddress=0;
int stopAddress=9999999;
if(argc<2)
{
cout << endl << "gbd - Gameboy Binary Disassembler" << endl << "https://github.com/mike-sw" << endl << endl;
cout << "Usage: gbd filename.gb" << endl << endl;
cout << "Arguments:" << endl << "-start - Start disassembling at a specific address" << endl;
cout << "-stop - Stop disassembly at a specific address" << endl << endl;
//exit();
}
else
{
cout << "Disassembling " << argv[1] << "..." << endl;
//We may or may not have arguments following, but if we do, let's interpret them here
if(argc>=2) //We have a file name, and an additional set of arguments
{
//OK, if we have more arguments, we want to step through them all
for(int arg=2;arg<argc;arg++) //Start with the second argument (technically the 3rd...)
{
string argument(argv[arg]);
if(argument=="-a" || argument=="-start") //Start disassembly at this address
{
startAssemblyAtAddressStr=argv[arg+1];
//cout << "arg = " << argv[arg+1] << endl;
//The user's given us their desired address in hex, so let's convert it to decimal for our counter
targetAddress=convertHextoInt(argv[arg+1]); //Now counter holds the appropriate decimal number
cout << "Starting at 0x" << startAssemblyAtAddressStr << "..." << endl;
}
if(argument=="-stop")
{
stopAddress=convertHextoInt(argv[arg+1]);
cout << "Stopping at 0x" << argv[arg+1] << "..." << endl;
}
}
}
//Now let's do a little error catching to let the user know that they're asking for something unreasonable
if(targetAddress>stopAddress) //The user specifies a start address which is after the stop address
{
cout << "Warning: We can't stop disassembly before we've started! (targetAddress>stopAddress)" << endl;
}
cout << endl;
//counter = stoi(startAssemblyAtAddressStr);
//Grab our first argument (our filename to open)
ifstream inputfile (argv[1], ifstream::binary);
unsigned char *buffer = new unsigned char [1]; //Set up our buffer
//Let's get the length of the file
inputfile.seekg(0, inputfile.end);
int length = inputfile.tellg();
inputfile.seekg(0, inputfile.beg);
//And we'll declare some variables to handle the CB prefix opcodes
unsigned char tempCB;
unsigned char thisByteCB;
unsigned char byte1,byte2;
//Scan until the file is done
while(!inputfile.eof())
{
if(counter >= targetAddress && counter <= stopAddress)
{
cout << setw(4) << setfill('0') << hex << counter << ":" << setw(1); //Print our current address in the left margin
*buffer = getNext8Bits(inputfile); //Read a byte from the file
printByteAsHex(*buffer);//Print our opcode
unsigned char thisByte = *buffer; //Get the current opcode by itself
//We only want to print opcodes as if they're ASCII if they actually fall in the appropriate range
//We don't want to try to print the unprintable
if(*buffer >= 32 && *buffer<=126) cout << " " << (char)*buffer;
/*
Gameboy .gb files are basically images of the cartridge. Like Windows PE files, these are composite formats,
with lots of moving parts. There's some interesting things to note about how these .gb files are built.
The OEP (Original Entry Point) for a gameboy game is 0x0100. This is where we start execution.
Addresses 0x0104 - 0x0133 is the bytes that make up the Nintendo startup logo
We want to note these in our disassembler output, and not disassemble them!
*/
if(isAddressSpecial(counter, thisByte))
{
counter++;
}
else
{
/*
Now, as we parse our opcodes, print what they are
*/
switch(*buffer)
{
case 0x00:
printLine("NOP", "No Operation");
break;
case 0x01: //LD BC,d16
//Since this is a 16-bit function, pull both arguments
byte1 = getNext8Bits(inputfile);
byte2 = getNext8Bits(inputfile);
print16BitLine("LD BC", "Load a 16-bit immediate value into registers BC", "->BC", byte1, byte2);
break;
case 0x02:
printLine("LD (BC),A","Load an 8-bit value from A into 16-bit register BC");
break;
case 0x03:
printLine("INC BC", "Increment Register");
//cout << "INC BC\t\t\t\t\tIncrement Register";
break;
case 0x04:
printLine("INC B","Increment Register");
break;
case 0x05:
printLine("DEC B", "Decrement Register");
break;
case 0x06: //LD B, d8
byte1 = getNext8Bits(inputfile);
print8BitLine("LD B", "Load a 8-bit immediate value into register B", "->B", byte1);
break;
case 0x07: //RCLA, check here for more info: https://hax.iimarckus.org/topic/1617/
printLine("RLCA","Rotate Left, carry A");
break;
case 0x08:
printLine("LD (a16),SP", "");
break;
case 0x09:
printLine("ADD HL, BC", "Add the values in registers HL and BC");
break;
case 0x0A:
printLine("LD A,(BC)", "");
break;
case 0x0B:
printLine("DEC BC","Decrement Register");
break;
case 0x0C:
printLine("INC C","Increment Register");
break;
case 0x0D:
printLine("DEC C","Decrement Register");
break;
case 0x0E:
byte1 = getNext8Bits(inputfile);
print8BitLine("LD c,", "Load a 8-bit immediate value into register C", "->C", byte1);
// printLine("LD C,d8", "");
break;
case 0x0F:
printLine("RRCA","");
break;
case 0x10:
printLine("STOP 0","Stop the CPU");
break;
case 0x11:
byte1 = getNext8Bits(inputfile);
byte2 = getNext8Bits(inputfile);
print16BitLine("LD DE,", "Load a 16-bit immediate value into registers DE", "->DE", byte1,byte2);
//printLine("LD DE,d16", "");
break;
case 0x12:
printLine("LD (DE),A","");
break;
case 0x13:
printLine("INC DE","Increment Register");
break;
case 0x14:
printLine("INC D","Increment Register");
break;
case 0x15:
printLine("DEC D", "Decrement Register");
break;
case 0x16:
byte1 = getNext8Bits(inputfile);
print8BitLine("LD D,", "Load a 8-bit immediate value into register D", "->D", byte1);
//printLine("LD D,d8", "");
break;
case 0x17:
printLine("RLA","");
break;
case 0x18:
printLine("JR r8", "");
break;
case 0x19:
printLine("ADD HL,DE","");
break;
case 0x1A:
printLine("LD A,(DE)","");
break;
case 0x1B:
printLine("DEC DE", "Decrement Register");
break;
case 0x1C:
printLine("INC E", "Increment Register");
break;
case 0x1D:
printLine("DEC E", "Decrement Register");
break;
case 0x1E:
//printLine("LD E,d8", "");
byte1 = getNext8Bits(inputfile);
print8BitLine("LD E,", "Load a 8-bit immediate value into register E", "->E", byte1);
break;
case 0x1F:
printLine("RRA","");
break;
case 0x20:
printLine("JR NZ,r8", "");
break;
case 0x21:
//printLine("LD HL,d16", "");
byte1 = getNext8Bits(inputfile);
byte2 = getNext8Bits(inputfile);
print16BitLine("LD HL,", "Load a 16-bit immediate value into registers HL", "->HL", byte1,byte2);
break;
case 0x22:
printLine("LD(HL+),A","");
break;
case 0x23:
printLine("INC HL","Increment Register");
break;
case 0x24:
printLine("INC H","Increment Register");
break;
case 0x25:
printLine("DEC H","Decrement Register");
break;
case 0x26:
//printLine("LD H,d8", "");
byte1 = getNext8Bits(inputfile);
print8BitLine("LD H,", "Load a 8-bit immediate value into register H", "->H", byte1);
break;
case 0x27:
printLine("DAA","Converts A into packed BCD");
break;
case 0x28:
printLine("JR Z,r8", "");
break;
case 0x29:
printLine("ADD HL,HL","");
break;
case 0x2A:
printLine("LD A,(HL+)","");
break;
case 0x2B:
printLine("DEC HL","Decrement Register");
break;
case 0x2C:
printLine("INC L","Increment Register");
break;
case 0x2D:
printLine("DEC L","Decrement Register");
break;
case 0x2E:
byte1 = getNext8Bits(inputfile);
print8BitLine("LD L,", "Load a 8-bit immediate value into register L", "->L", byte1);
//printLine("LD L,d8", "");
break;
case 0x2F:
printLine("CPL","Complement A");
break;
case 0x30:
printLine("JR NC,r8", "");
break;
case 0x31:
//printLine("LD SP,d16", "");
byte1 = getNext8Bits(inputfile);
byte2 = getNext8Bits(inputfile);
print16BitLine("LD HL,", "Load a 16-bit immediate value into registers HL", "->HL", byte1,byte2);
break;
case 0x32:
printLine("LD (HL-),A","");
break;
case 0x33:
printLine("INC SP","Increment Register");
break;
case 0x34:
printLine("INC (HL)","Increment Register");
break;
case 0x35:
printLine("DEC (HL)","Decrement Register");
break;
case 0x36:
printLine("LD (HL),d8", "");
break;
case 0x37:
printLine("SCF","");
break;
case 0x38:
printLine("JR C,r8", "");
break;
case 0x39:
printLine("ADD HL,SP","");
break;
case 0x3A:
printLine("LD A,(HL-)","");
break;
case 0x3B:
printLine("DEC SP","Decrement Register");
break;
case 0x3C:
printLine("INC A","Increment Register");
break;
case 0x3D:
printLine("DEC A","Decrement Register");
break;
case 0x3E:
//printLine("LD A,d8", "");
byte1 = getNext8Bits(inputfile);
print8BitLine("LD A,", "Load a 8-bit immediate value into register A", "->A", byte1);
break;
case 0x3F:
printLine("CCF","");
break;
case 0x40:
printLine("LD B,B","B->B\tCopy register B into itself, usually used as a flag reset");
break;
case 0x41:
printLine("LD B,C","C->B\tCopy the value in register C into register B");
break;
case 0x42:
printLine("LD B,D","D->B\tCopy the value in register D into register B");
break;
case 0x43:
printLine("LD B,E","E->B\tCopy the value in register E into register B");
break;
case 0x44:
printLine("LD B,H","H->B\tCopy the value in register H into register B");
break;
case 0x45:
printLine("LD B,L","L->B\tCopy the value in register L into register B");
break;
case 0x46:
printLine("LD B,(HL)","HL->B\tCopy the value in register HL into register B");
break;
case 0x47:
printLine("LD B,A","A->B\tCopy the value in register A into register B");
break;
case 0x48:
printLine("LD C,B","B->C\tCopy the value in register B into register C");
break;
case 0x49:
printLine("LD C,C","C->C\tCopy register C into itself, usually used as a flag reset");
break;
case 0x4A:
printLine("LD C,D","D->C\tCopy the value in register D into register C");
break;
case 0x4B:
printLine("LD C,E","E->C\tCopy the value in register E into register C");
break;
case 0x4C:
printLine("LD C,H","H->C\tCopy the value in register H into register C");
break;
case 0x4D:
printLine("LD C,L","L->C\tCopy the value in register L into register C");
break;
case 0x4E:
printLine("LD C,(HL)","HL->C\tCopy the value in register HL into register C");
break;
case 0x4F:
printLine("LD C,A","A->C\tCopy the value in register A into register C");
break;
case 0x50:
printLine("LD D,B","B->D\tCopy the value in register B into register D");
break;
case 0x51:
printLine("LD D,C","C->D\tCopy the value in register C into register D");
break;
case 0x52:
printLine("LD D,D","D->D\tCopy register D into itself, usually used as a flag reset");
break;
case 0x53:
printLine("LD D,E","E->D\tCopy the value in register E into register D");
break;
case 0x54:
printLine("LD D,H","H->D\tCopy the value in register H into register D");
break;
case 0x55:
printLine("LD D,L","L->D\tCopy the value in register L into register D");
break;
case 0x56:
printLine("LD D,(HL)","HL->D\tCopy the value in register HL into register D");
break;
case 0x57:
printLine("LD D,A","A->D\tCopy the value in register A into register D");
break;
case 0x58:
printLine("LD E,B","B->E\tCopy the value in register B into register E");
break;
case 0x59:
printLine("LD E,C","C->E\tCopy the value in register C into register E");
break;
case 0x5A:
printLine("LD E,D","E->E\tCopy the value in register E into register E");
break;
case 0x5B:
printLine("LD E,E","E->E\tCopy register E into itself, usually used as a flag reset");
break;
case 0x5C:
printLine("LD E,H","H->E\tCopy the value in register H into register E");
break;
case 0x5D:
printLine("LD E,L","L->E\tCopy the value in register L into register E");
break;
case 0x5E:
printLine("LD E,(HL)","HL->E\tCopy the value in register HL into register E");
break;
case 0x5F:
printLine("LD E,A","A->E\tCopy the value in register A into register E");
break;
case 0x60:
printLine("LD H,B","B->H\tCopy the value in register B into register H");
break;
case 0x61:
printLine("LD H,C","C->H\tCopy the value in register C into register H");
break;
case 0x62:
printLine("LD H,D","D->H\tCopy the value in register D into register H");
break;
case 0x63:
printLine("LD H,B","B->H\tCopy the value in register B into register H");
break;
case 0x64:
printLine("LD H,H","H->H\tCopy the value in register H into itself");
break;
case 0x65:
printLine("LD H,L","L->H\tCopy the value in register L into register H");
break;
case 0x66:
printLine("LD H,(HL)","");
break;
case 0x67:
printLine("LD H,A","A->H\tCopy the value in register A into register H");
break;
case 0x68:
printLine("LD L,B","B->H\tCopy the value in register B into register H");
break;
case 0x69:
printLine("LD L,C","C->L\tCopy the value in register C into register L");
break;
case 0x6A:
printLine("LD L,D","D->L\tCopy the value in register D into register L");
break;
case 0x6B:
printLine("LD L,E","E->L\tCopy the value in register E into register L");
break;
case 0x6C:
printLine("LD L,H","H->L\tCopy the value in register H into register L");
break;
case 0x6D:
printLine("LD L,L","L->L\tCopy the value in register D into itself");
break;
case 0x6E:
printLine("LD L,(HL)","");
break;
case 0x6F:
printLine("LD L,A","A->L\tCopy the value in register A into register L");
break;
case 0x70:
printLine("LD (HL),B","");
break;
case 0x71:
printLine("LD (HL),C","");
break;
case 0x72:
printLine("LD (HL),D","");
break;
case 0x73:
printLine("LD (HL),E","");
break;
case 0x74:
printLine("LD (HL),H","");
break;
case 0x75:
printLine("LD (HL),L","");
break;
case 0x76:
printLine("HALT","Pause the CPU until an interrupt occurs");
break;
case 0x77:
printLine("LD (HL),A","");
break;
case 0x78:
printLine("LD A,B","B->A\tCopy the value in register B into register A");
break;
case 0x79:
printLine("LD A,C","C->A\tCopy the value in register C into register A");
break;
case 0x7A:
printLine("LD A,D","D->A\tCopy the value in register D into register A");
break;
case 0x7B:
printLine("LD A,E","E->A\tCopy the value in register E into register A");
break;
case 0x7C:
printLine("LD A,H","H->A\tCopy the value in register H into register A");
break;
case 0x7D:
printLine("LD A,L","L->A\tCopy the value in register L into register A");
break;
case 0x7E:
printLine("LD A,(HL)","");
break;
case 0x7F:
printLine("LD A,A","C->A\tCopy the value in register C into itself");
break;
case 0x80:
printLine("ADD A,B","A+B\tAdd the values in registers A and B, with the result stored in A");
break;
case 0x81:
printLine("ADD A,C","A+C\tAdd the values in registers A and C, with the result stored in A");
break;
case 0x82:
printLine("ADD A,D","A+D\tAdd the values in registers A and D, with the result stored in A");
break;
case 0x83:
printLine("ADD A,E","A+E\tAdd the values in registers A and E, with the result stored in A");
break;
case 0x84:
printLine("ADD A,H","A+H\tAdd the values in registers A and H, with the result stored in A");
break;
case 0x85:
printLine("ADD A,L","A+L\tAdd the values in registers A and L, with the result stored in A");
break;
case 0x86:
printLine("ADD A,(HL)","A+HL\tAdd the values in registers A and HL, with the result stored in A");
break;
case 0x87:
printLine("ADD A,A","A+A\tAdd the values in registers A and A, with the result stored in A");
break;
case 0x88:
printLine("ADC A,B","A+B\tAdd A+B, and carry flag to A");
break;
case 0x89:
printLine("ADC A,C","A+B\tAdd A+C, and carry flag to A");
break;
case 0x8A:
printLine("ADC A,D","A+B\tAdd A+D, and carry flag to A");
break;
case 0x8B:
printLine("ADC A,E","A+B\tAdd A+E, and carry flag to A");
break;
case 0x8C:
printLine("ADC A,H","A+B\tAdd A+H, and carry flag to A");
break;
case 0x8D:
printLine("ADC A,L","A+B\tAdd A+L, and carry flag to A");
break;
case 0x8E:
printLine("ADC A,(HL)","A+B\tAdd A+HL, and carry flag to A");
break;
case 0x8F:
printLine("ADC A,A","A+B\tAdd A+A, and carry flag to A");
break;
case 0x90:
printLine("SUB B","");
break;
case 0x91:
printLine("SUB C","");
break;
case 0x92:
printLine("SUB D","");
break;
case 0x93:
printLine("SUB E","");
break;
case 0x94:
printLine("SUB H","");
break;
case 0x95:
printLine("SUB L","");
break;
case 0x96:
printLine("SUB (HL)","");
break;
case 0x97:
printLine("SUB A","");
break;
case 0x98:
printLine("SBC A,B","");
break;
case 0x99:
printLine("SBC A,C","");
break;
case 0x9A:
printLine("SBC A,D","");
break;
case 0x9B:
printLine("SBC A,E","");
break;
case 0x9C:
printLine("SBC A,H","");
break;
case 0x9D:
printLine("SBC A,L","");
break;
case 0x9E:
printLine("SBC A,(HL)","");
break;
case 0x9F:
printLine("SBC A,A","");
break;
case 0xA0:
printLine("AND B","B && A\tDo the binary AND operation against B and A");
break;
case 0xA1:
printLine("AND C","C && A\tDo the binary AND operation against C and A");
break;
case 0xA2:
printLine("AND D","D && A\tDo the binary AND operation against D and A");
break;
case 0xA3:
printLine("AND E","E && A\tDo the binary AND operation against E and A");
break;
case 0xA4:
printLine("AND H","H && A\tDo the binary AND operation against H and A");
break;
case 0xA5:
printLine("AND L","L && A\tDo the binary AND operation against L and A");
break;
case 0xA6:
printLine("AND (HL)","HL && A\tDo the binary AND operation against HL and A");
break;
case 0xA7: //AND A
printLine("AND A","A && A\tDo the binary AND operation against A and A");
break;
case 0xA8:
printLine("XOR B","A XOR B\tXor the values in registers A and B, with the result stored in A");
break;
case 0xA9:
printLine("XOR C","A XOR C\tXor the values in registers A and C, with the result stored in A");
break;
case 0xAA:
printLine("XOR D","A XOR D\tXor the values in registers A and D, with the result stored in A");
break;
case 0xAB:
printLine("XOR E","A XOR E\tXor the values in registers A and E, with the result stored in A");
break;
case 0xAC:
printLine("XOR H","A XOR H\tXor the values in registers A and H, with the result stored in A");
break;
case 0xAD:
printLine("XOR L","A XOR L\tXor the values in registers A and L, with the result stored in A");
break;
case 0xAE:
printLine("XOR (HL)","A XOR HL\tXor the values in registers A and HL, with the result stored in A");
break;
case 0xAF:
printLine("XOR A","A XOR A\tXor the values in register A against itself. A now equals zero.");
break;
case 0xB0:
printLine("OR B","A || B\tOr the values in registers A and B, with the result stored in A");
break;
case 0xB1:
printLine("OR C","A || C\tOr the values in registers A and C, with the result stored in A");
break;
case 0xB2:
printLine("OR D","A || D\tOr the values in registers A and D, with the result stored in A");
break;
case 0xB3:
printLine("OR E","A || E\tOr the values in registers A and E, with the result stored in A");
break;
case 0xB4:
printLine("OR H","A || H\tOr the values in registers A and H, with the result stored in A");
break;
case 0xB5:
printLine("OR L","A || L\tOr the values in registers A and L, with the result stored in A");
break;
case 0xB6:
printLine("OR (HL)","A || HL\tOr the values in registers A and HL, with the result stored in A");
break;
case 0xB7:
printLine("OR A","A || A\tA OR'd by itself is just the value of A. This is used to clear flags.");
break;
case 0xB8:
printLine("CP B","if(A==B)\tCompare A to B. Essentially do A-B, and see if ZF is set");
break;
case 0xB9:
printLine("CP C","if(A==C)\tCompare A to C. Essentially do A-C, and see if ZF is set");
break;
case 0xBA:
printLine("CP D","if(A==D)\tCompare A to D. Essentially do A-D, and see if ZF is set");
break;
case 0xBB:
printLine("CP E","if(A==E)\tCompare A to E. Essentially do A-E, and see if ZF is set");
break;
case 0xBC:
printLine("CP H","if(A==H)\tCompare A to H. Essentially do A-H, and see if ZF is set");
break;
case 0xBD:
printLine("CP L","if(A==L)\tCompare A to L. Essentially do A-L, and see if ZF is set");
break;
case 0xBE:
printLine("CP (HL)","if(A==HL)\tCompare A to HL. Essentially do A-HL, and see if ZF is set");
break;
case 0xBF:
printLine("CP A","if(A==A)\tCompare A to A. Essentially do A-A. ZF will always be set, as A-A=0");
break;
case 0xC0:
printLine("RET NZ","");
break;
case 0xC1:
printLine("POP BC","Pop two bytes off of the stack, and store them in BC");
break;
case 0xC2:
printLine("JP NZ,a16","");
break;
case 0xC3: //JP a16
byte1 = getNext8Bits(inputfile);
byte2 = getNext8Bits(inputfile);
print16BitLine("JP ", "Jump to the specified 16-bit address", "->PC", byte1, byte2);
//printLine("JP a16", "");
break;
case 0xC4:
printLine("CALL NZ,a16", "");
break;
case 0xC5:
printLine("PUSH BC","BC->Stack\tPush this register pair onto the stack");
break;
case 0xC6:
printLine("ADD A,d8", "");
break;
case 0xC7:
printLine("RST 00H\t\t\t\t\tCall the code at 00",""); //According to https://www.cemetech.net/forum/viewtopic.php?t=6744
break;
case 0xC8:
printLine("RET Z","Return if the Zero flag is set");
break;
case 0xC9:
printLine("RET","Pop two bytes from the stack and jump to that address");
break;
case 0xCA:
printLine("JP Z,a16", "");
break;
case 0xCB:
/*
0xCB is a PREFIX opcode. This means that it's meant to be used like CB xx, and is used to hold another series of opcodes.
We need to pair it with the byte immediately following to perform the relevant function
*/
//We need to get the next byte
*buffer = getNext8Bits(inputfile);
tempCB = *buffer;
printByteAsHex(tempCB);
thisByteCB = *buffer; //Get the current opcode by itself
//And now we get to do the second huge switch/case to handle CB prefixed instructions
switch(thisByteCB)
{
case 0x00:
printLine("RLC B","");
break;
case 0x01:
printLine("RLC C","");
break;
case 0x02:
printLine("RLC D","");
break;
case 0x03:
printLine("RLC E","");
break;
case 0x04:
printLine("RLC H","");
break;
case 0x05:
printLine("RLC L","");
break;
case 0x06:
printLine("RLC (HL)","");
break;
case 0x07:
printLine("RLC A","");
break;
case 0x08:
printLine("RRC B","");
break;
case 0x09:
printLine("RRC C","");
break;
case 0x0A:
printLine("RRC D","");
break;
case 0x0B:
printLine("RRC E","");
break;
case 0x0C:
printLine("RRC H","");
break;
case 0x0D:
printLine("RRC L","");
break;
case 0x0E:
printLine("RRC (HL)","");
break;
case 0x0F:
printLine("RRC A","");
break;
case 0x10:
printLine("RL B","");
break;
case 0x11:
printLine("RL C","");
break;
case 0x12:
printLine("RL D","");
break;
case 0x13:
printLine("RL E","");
break;
case 0x14:
printLine("RL H","");
break;
case 0x15:
printLine("RLC L","");
break;
case 0x16:
printLine("RLC (HL)","");
break;
case 0x17:
printLine("RL A","");
break;
case 0x18:
printLine("RR B","");
break;
case 0x19:
printLine("RR C","");
break;
case 0x1A:
printLine("RR D","");
break;
case 0x1B:
printLine("RR E","");
break;
case 0x1C:
printLine("RR H","");
break;
case 0x1D:
printLine("RR L","");
break;
case 0x1E:
printLine("RR (HL)","");
break;
case 0x1F:
printLine("RR A","");
break;
case 0x20:
printLine("SLA B","");
break;
case 0x21:
printLine("SLA C","");
break;
case 0x22:
printLine("SLA D","");
break;
case 0x23:
printLine("SLA E","");
break;
case 0x24:
printLine("SLA H","");
break;
case 0x25:
printLine("SLA L","");
break;
case 0x26:
printLine("SLA (HL)","");
break;
case 0x27:
printLine("SLA A","");
break;
case 0x28:
printLine("SRA B","");
break;
case 0x29:
printLine("SRA C","");
break;
case 0x2A:
printLine("SRA D","");
break;
case 0x2B:
printLine("SRA E","");
break;
case 0x2C:
printLine("SRA H","");
break;
case 0x2D:
printLine("SRA L","");
break;
case 0x2E:
printLine("SRA (HL)","");
break;
case 0x2F:
printLine("SRA A","");
break;
case 0x30:
printLine("SWAP B","");
break;
case 0x31:
printLine("SWAP C","");
break;
case 0x32:
printLine("SWAP D","");
break;
case 0x33:
printLine("SWAP E","");
break;
case 0x34:
printLine("SWAP H","");
break;
case 0x35:
printLine("SWAP L","");
break;
case 0x36:
printLine("SWAP (HL)","");
break;
case 0x37:
printLine("SWAP A","");
break;
case 0x38:
printLine("SRL B","");
break;
case 0x39:
printLine("SRL C","");
break;
case 0x3A:
printLine("SRL D","");
break;
case 0x3B:
printLine("SRL E","");
break;
case 0x3C:
printLine("SRL H","");
break;
case 0x3D:
printLine("SRL L","");
break;
case 0x3E:
printLine("SRL (HL)","");
break;
case 0x3F:
printLine("SRL A","");
break;
case 0x40:
printLine("BIT 0,B","");
break;
case 0x41:
printLine("BIT 0,C","");
break;
case 0x42:
printLine("BIT 0,D","");
break;
case 0x43:
printLine("BIT 0,E","");
break;
case 0x44:
printLine("BIT 0,H","");
break;
case 0x45:
printLine("BIT 0,L","");
break;
case 0x46:
printLine("BIT 0,(HL)","");
break;
case 0x47:
printLine("BIT 0,A","");
break;
case 0x48:
printLine("BIT 1,B","");
break;
case 0x49:
printLine("BIT 1,C","");
break;
case 0x4A:
printLine("BIT 1,D","");
break;
case 0x4B:
printLine("BIT 1,E","");
break;
case 0x4C:
printLine("BIT 1,H","");
break;
case 0x4D:
printLine("BIT 1,L","");
break;
case 0x4E:
printLine("BIT 1,(HL)","");
break;
case 0x4F:
printLine("BIT 1,A","");
break;
case 0x50:
printLine("BIT 2,B","");
break;
case 0x51:
printLine("BIT 2,C","");
break;
case 0x52:
printLine("BIT 2,D","");
break;
case 0x53:
printLine("BIT 2,E","");
break;
case 0x54:
printLine("BIT 2,H","");
break;
case 0x55:
printLine("BIT 2,L","");
break;
case 0x56:
printLine("BIT 2,(HL)","");
break;
case 0x57:
printLine("BIT 2,A","");
break;
case 0x58:
printLine("BIT 3,B","");
break;
case 0x59:
printLine("BIT 3,C","");
break;
case 0x5A:
printLine("BIT 3,D","");
break;
case 0x5B:
printLine("BIT 3,E","");
break;
case 0x5C:
printLine("BIT 3,H","");
break;
case 0x5D:
printLine("BIT 3,L","");
break;
case 0x5E:
printLine("BIT 3,(HL)","");
break;
case 0x5F:
printLine("BIT 3,A","");
break;
case 0x60:
printLine("BIT 4,B","");
break;
case 0x61:
printLine("BIT 4,C","");
break;
case 0x62:
printLine("BIT 4,D","");
break;
case 0x63:
printLine("BIT 4,E","");
break;
case 0x64:
printLine("BIT 4,H","");
break;
case 0x65:
printLine("BIT 4,L","");
break;
case 0x66:
printLine("BIT 4,(HL)","");
break;
case 0x67:
printLine("BIT 4,A","");
break;
case 0x68:
printLine("BIT 5,B","");
break;
case 0x69:
printLine("BIT 5,C","");
break;
case 0x6A:
printLine("BIT 5,D","");
break;
case 0x6B:
printLine("BIT 5,E","");
break;
case 0x6C:
printLine("BIT 5,H","");
break;
case 0x6D:
printLine("BIT 5,L","");
break;
case 0x6E:
printLine("BIT 5,(HL)","");
break;
case 0x6F:
printLine("BIT 5,A","");
break;
case 0x70:
printLine("BIT 6,B","");
break;
case 0x71:
printLine("BIT 6,C","");
break;
case 0x72:
printLine("BIT 6,D","");
break;
case 0x73:
printLine("BIT 6,E","");
break;
case 0x74:
printLine("BIT 6,H","");
break;
case 0x75:
printLine("BIT 6,L","");
break;
case 0x76:
printLine("BIT 6,(HL)","");
break;
case 0x77:
printLine("BIT 6,A","");
break;
case 0x78:
printLine("BIT 7,B","");
break;
case 0x79:
printLine("BIT 7,C","");
break;
case 0x7A:
printLine("BIT 7,D","");
break;
case 0x7B:
printLine("BIT 7,E","");
break;
case 0x7C:
printLine("BIT 7,H","");
break;
case 0x7D:
printLine("BIT 7,L","");
break;
case 0x7E:
printLine("BIT 7,(HL)","");
break;
case 0x7F:
printLine("BIT 7,A","");
break;
case 0x80:
printLine("RES 0,B","");
break;
case 0x81:
printLine("RES 0,C","");
break;
case 0x82:
printLine("RES 0,D","");
break;
case 0x83:
printLine("RES 0,E","");
break;
case 0x84:
printLine("RES 0,H","");
break;
case 0x85:
printLine("RES 0,L","");
break;
case 0x86:
printLine("RES 0,(HL)","");
break;
case 0x87:
printLine("RES 0,A","");
break;
case 0x88:
printLine("RES 1,B","");
break;
case 0x89:
printLine("RES 1,C","");
break;
case 0x8A:
printLine("RES 1,D","");
break;
case 0x8B:
printLine("RES 1,E","");
break;
case 0x8C:
printLine("RES 1,H","");
break;
case 0x8D:
printLine("RES 1,L","");
break;
case 0x8E:
printLine("RES 1,(HL)","");
break;
case 0x8F:
printLine("RES 1,A","");
break;
case 0x90:
printLine("RES 2,B","");
break;
case 0x91:
printLine("RES 2,C","");
break;
case 0x92:
printLine("RES 2,D","");
break;
case 0x93:
printLine("RES 2,E","");
break;
case 0x94:
printLine("RES 2,H","");
break;
case 0x95:
printLine("RES 2,L","");
break;
case 0x96:
printLine("RES 2,(HL)","");
break;
case 0x97:
printLine("RES 2,A","");
break;
case 0x98:
printLine("RES 3,B","");
break;
case 0x99:
printLine("RES 3,C","");
break;
case 0x9A:
printLine("RES 3,D","");
break;
case 0x9B:
printLine("RES 3,E","");
break;
case 0x9C:
printLine("RES 3,H","");
break;
case 0x9D:
printLine("RES 3,L","");
break;
case 0x9E:
printLine("RES 3,(HL)","");
break;
case 0x9F:
printLine("RES 3,A","");
break;
case 0xA0:
printLine("RES 4,B","");
break;
case 0xA1:
printLine("RES 4,C","");
break;
case 0xA2:
printLine("RES 4,D","");
break;
case 0xA3:
printLine("RES 4,E","");
break;
case 0xA4:
printLine("RES 4,H","");
break;
case 0xA5:
printLine("RES 4,L","");
break;
case 0xA6:
printLine("RES 4,(HL)","");
break;
case 0xA7:
printLine("RES 4,A","");
break;
case 0xA8:
printLine("RES 5,B","");
break;
case 0xA9:
printLine("RES 5,C","");
break;
case 0xAA:
printLine("RES 5,D","");
break;
case 0xAB:
printLine("RES 5,E","");
break;
case 0xAC:
printLine("RES 5,H","");
break;
case 0xAD:
printLine("RES 5,L","");
break;
case 0xAE:
printLine("RES 5,(HL)","");
break;
case 0xAF:
printLine("RES 5,A","");
break;
case 0xB0:
printLine("RES 6,B","");
break;
case 0xB1:
printLine("RES 6,C","");
break;
case 0xB2:
printLine("RES 6,D","");
break;
case 0xB3:
printLine("RES 6,E","");
break;
case 0xB4:
printLine("RES 6,H","");
break;
case 0xB5:
printLine("RES 6,L","");
break;
case 0xB6:
printLine("RES 6,(HL)","");
break;
case 0xB7:
printLine("RES 6,A","");
break;
case 0xB8:
printLine("RES 7,B","");
break;
case 0xB9:
printLine("RES 7,C","");
break;
case 0xBA:
printLine("RES 7,D","");
break;
case 0xBB:
printLine("RES 7,E","");
break;
case 0xBC:
printLine("RES 7,H","");
break;
case 0xBD:
printLine("RES 7,L","");
break;
case 0xBE:
printLine("RES 7,(HL)","");
break;
case 0xBF:
printLine("RES 7,A","");
break;
case 0xC0:
printLine("SET 0,B","");
break;
case 0xC1:
printLine("SET 0,C","");
break;
case 0xC2:
printLine("SET 0,D","");
break;
case 0xC3:
printLine("SET 0,E","");
break;
case 0xC4:
printLine("SET 0,H","");
break;
case 0xC5:
printLine("SET 0,L","");
break;
case 0xC6:
printLine("SET 0,(HL)","");
break;
case 0xC7:
printLine("SET 0,A","");
break;
case 0xC8:
printLine("SET 1,B","");
break;
case 0xC9:
printLine("SET 1,C","");
break;
case 0xCA:
printLine("SET 1,D","");
break;
case 0xCB:
printLine("SET 1,E","");
break;
case 0xCC:
printLine("SET 1,H","");
break;
case 0xCD:
printLine("SET 1,L","");
break;
case 0xCE:
printLine("SET 1,(HL)","");
break;
case 0xCF:
printLine("SET 1,A","");
break;
case 0xD0:
printLine("SET 2,B","");
break;
case 0xD1:
printLine("SET 2,C","");
break;
case 0xD2:
printLine("SET 2,D","");
break;
case 0xD3:
printLine("SET 2,E","");
break;
case 0xD4:
printLine("SET 2,H","");
break;
case 0xD5:
printLine("SET 2,L","");
break;
case 0xD6:
printLine("SET 2,(HL)","");
break;
case 0xD7:
printLine("SET 2,A","");
break;
case 0xD8:
printLine("SET 3,B","");
break;
case 0xD9:
printLine("SET 3,C","");
break;
case 0xDA:
printLine("SET 3,D","");
break;
case 0xDB:
printLine("SET 3,E","");
break;
case 0xDC:
printLine("SET 3,H","");
break;
case 0xDD:
printLine("SET 3,L","");
break;
case 0xDE:
printLine("SET 3,(HL)","");
break;
case 0xDF:
printLine("SET 3,A","");
break;
case 0xE0:
printLine("SET 4,B","");
break;
case 0xE1:
printLine("SET 4,C","");
break;
case 0xE2:
printLine("SET 4,D","");
break;
case 0xE3:
printLine("SET 4,E","");
break;
case 0xE4:
printLine("SET 4,H","");
break;
case 0xE5:
printLine("SET 4,L","");
break;
case 0xE6:
printLine("SET 4,(HL)","");
break;
case 0xE7:
printLine("SET 4,A","");
break;
case 0xE8:
printLine("SET 5,B","");
break;
case 0xE9:
printLine("SET 5,C","");
break;
case 0xEA:
printLine("SET 5,D","");
break;
case 0xEB:
printLine("SET 5,E","");
break;
case 0xEC:
printLine("SET 5,H","");
break;
case 0xED:
printLine("SET 5,L","");
break;
case 0xEE:
printLine("SET 5,(HL)","");
break;
case 0xEF:
printLine("SET 5,A","");
break;
case 0xF0:
printLine("SET 6,B","");
break;
case 0xF1:
printLine("SET 6,C","");
break;
case 0xF2:
printLine("SET 6,D","");
break;
case 0xF3:
printLine("SET 6,E","");
break;
case 0xF4:
printLine("SET 6,H","");
break;
case 0xF5:
printLine("SET 6,L","");
break;
case 0xF6:
printLine("SET 6,(HL)","");
break;
case 0xF7:
printLine("SET 6,A","");
break;
case 0xF8:
printLine("SET 7,B","");
break;
case 0xF9:
printLine("SET 7,C","");
break;
case 0xFA:
printLine("SET 7,D","");
break;
case 0xFB:
printLine("SET 7,E","");
break;
case 0xFC:
printLine("SET 7,H","");
break;
case 0xFD:
printLine("SET 7,L","");
break;
case 0xFE:
printLine("SET 7,(HL)","");
break;
case 0xFF:
printLine("SET 7,A","");
break;
}
//counter++;//Increase our counter, as we've read another byte from our source file
//This way, our addresses going forward will be correct...
break;
case 0xCC:
printLine("CALL Z,a16","");
break;
case 0xCD: //CALL a16
byte1 = getNext8Bits(inputfile);
byte2 = getNext8Bits(inputfile);
print16BitLine("CALL ", "Call a function at the address specified", "->PC", byte1,byte2);
//printLine("CALL a16","");
break;
case 0xCE:
printLine("ADC A,d8","");
break;
case 0xCF:
printLine("RST 08H", "Push current address onto the stack, and jump to 0x0010");
break;
case 0xD0:
printLine("RET NC", "");
break;
case 0xD1:
printLine("POP DE", "");
break;
case 0xD2:
printLine("JP NC,a16", "");
break;
case 0xD3:
printLine("Unused", "");
break;
case 0xD4:
printLine("CALL NC,16", "");
break;
case 0xD5:
printLine("PUSH DE", "");
break;
case 0xD6:
printLine("SUB d8", "");
break;
case 0xD7:
printLine("RST 10H", "Push current address onto the stack, and jump to 0x0010");
break;
case 0xD8:
printLine("RET C", "");
break;
case 0xD9:
printLine("RETI", "\tPop two bytes from the stack, go to that address, and enable interrupts");
break;
case 0xDA:
byte1 = getNext8Bits(inputfile);
byte2 = getNext8Bits(inputfile);
print16BitLine("JP C,", "If the Carry flag is set, jump to the immediately following 16-bit address", "->PC", byte1,byte2);
// printLine("JP C,a16", "");
break;
case 0xDB:
printLine("Unused", "");
break;
case 0xDC:
printLine("CALL C,a16", "");
break;
case 0xDD:
printLine("Unused", "");
break;
case 0xDE:
printLine("SBC A,d8", "");
break;
case 0xDF:
printLine("RST 18H", "Push current address onto the stack, and jump to 0x0018");
break;
case 0xE0:
printLine("LDH (a8),A", "");
break;
case 0xE1:
printLine("POP HL", "");
break;
case 0xE2:
printLine("LD (C),A", "");
break;
case 0xE3:
printLine("Unused", "");
break;
case 0xE4:
printLine("Unused", "");
break;
case 0xE5:
printLine("PUSH HL\t\t\t\t\tPush the contents of HL onto the stack", "");
break;
case 0xE6: //AND d8
byte1 = getNext8Bits(inputfile);
print8BitLine("AND A", "Do the binary AND operation of this immediate value and A", " && A", byte1);
//printLine("AND d8", "");
break;
case 0xE7:
printLine("RST 20H", "Push current address onto the stack, and jump to 0x0020");
break;
case 0xE8:
printLine("ADD SP,r8", "");
break;
case 0xE9:
printLine("JP (HL)", "");
break;
case 0xEA:
printLine("LD (a16),A", "");
break;
case 0xEB:
printLine("Unused", "");
break;
case 0xEC:
printLine("Unused", "");
break;
case 0xED:
printLine("Unused", "");
break;
case 0xEE:
byte1 = getNext8Bits(inputfile);
print8BitLine("XOR ", "XOR this value against A", " XOR A->A", byte1);
//printLine("XOR d8", "");
break;
case 0xEF:
printLine("RST 28H", "Push current address onto the stack, and jump to 0x0028");
break;
case 0xF0:
byte1 = getNext8Bits(inputfile);
print8BitLine("LDH A,", "Load", "+FF00 as pointer->A", byte1);
//printLine("LDH A,(a8)", "");
break;
case 0xF1:
printLine("POP AF", "");
break;
case 0xF2:
printLine("LD A,(C)", "");
break;
case 0xF3:
printLine("DI", "Disable interrupts");
break;
case 0xF4:
printLine("Unused", "");
break;
case 0xF5:
printLine("PUSH AF\t\t\t\tPush the contents of AF onto the stack", "");
break;
case 0xF6:
printLine("OR d8", "");
break;
case 0xF7:
printLine("RST 30H", "Push current address onto the stack, and jump to 0x0030");
break;
case 0xF8:
printLine("LD HL,SP+r8", "");
break;
case 0xF9:
printLine("LD SP,HL", "");
break;
case 0xFA:
printLine("LD A,(a16)", "");
break;
case 0xFB:
printLine("EI", "Enable Interrupts, but only after this instruction finishes executing");
break;
case 0xFC:
printLine("Unused", "");
break;
case 0xFD:
printLine("Unused", "");
break;
case 0xFE://CP d8
byte1 = getNext8Bits(inputfile);
print8BitLine("CP ", "Subtract this value from A", "] A-this value->A", byte1);
// printLine("CP d8", "");
break;
case 0xFF:
printLine("RST 38H", "Push current address onto the stack, and jump to 0x0038");
break;
}
cout << endl;
// counter = counter+1;
}
}
else //Because we're starting assembly somewhere else, we don't care about this data. So let's burn it...
{
getNext8Bits(inputfile);
counter++;
}
}
}
}
| [
"[email protected]"
] | |
0f1a7572262a2659008cc091b8d8b9bf5dee1af3 | 99b795dd0d5b85f4efdcd79e0577a9c8b829e06a | /library-cmake/src/add.cpp | cd259cf7f4f11d1457ea53f3d8df54e4eb5dd405 | [] | no_license | poseidon-code/cpp-codes | 354f61859d3f0240ff9f7cfddb6e1243390e605d | 02abef087a2d4f69cfd13856fbbd6482d2363004 | refs/heads/master | 2023-08-18T18:31:41.728015 | 2023-05-08T04:30:00 | 2023-05-08T04:30:00 | 243,549,224 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 72 | cpp | #include "simplemath.h"
int sm::add(int a, int b) {
return a + b;
} | [
"[email protected]"
] | |
5bf050a15c4278af53cb042713fa267af5166162 | 7f9375cdd3ef7c97fe3cbc2699d16a740a6f3e06 | /src/common/cmdline_parse.hpp | 9d3eee1965e898e58b40b25f6be740e491389792 | [
"MIT"
] | permissive | davistardif/cuda-dbscan | 98c9b35843197397e72819a9c5d2c0b62f2f329a | bb52b78689a41b64b5b4afb8a2ef243664db9cad | refs/heads/master | 2023-05-12T13:00:04.306164 | 2021-06-04T00:06:22 | 2021-06-04T00:06:22 | 365,377,179 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 118 | hpp | #pragma once
void parse(int argc, char **argv, int *n_pts, int *min_points, float *epsilon,
bool *print);
| [
"[email protected]"
] | |
cf9d9bf1b6097f236267ba41b1052ef753e62c3b | 0f3122ce2aa1a5c4c5e0d38c3d8c590ce485ca03 | /netds/winsock/atmevent/Receiver.Cpp | 9131dd624a6269e8ae0ccf8450503b77bbe7ce69 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | WindowsKernel/sdk71examples | 15cfee86bcb6621d13b91ca59bba425391b1b7a8 | 677997402e3bd3e51558464e50e4c33ebe1dd491 | refs/heads/master | 2022-04-27T21:10:51.846940 | 2015-01-19T18:35:09 | 2015-01-19T18:35:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,367 | cpp | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (C) Microsoft Corporation. All Rights Reserved.
//
// Module:
// receiver.cpp
//
// Abstract:
// Implement receive-side functionality. The reciever can accept up to
// MAXCLIENT connections from senders. The receiver uses WSAEventSelect
// to handle the potential multiple connections as well as to allow the
// receiver handle a request for a QoS connection during the accept.
//
//
#include "atmevent.h"
#define MAXCLIENTS 4
// encapsulate socket, events, buffers, and various flags and counters that
// control how/when data is received into a structure
typedef struct _RECV_INFO
{
SOCKET sd[MAXCLIENTS+1];
WSAEVENT hEvents[MAXCLIENTS+1];
CHAR * recvbuf;
int nTotalClients;
} RECV_INFO;
static BOOL CreateReceivingSocket(RECV_INFO *, OPTIONS *);
static BOOL fd_accept_func(DWORD, WSANETWORKEVENTS *, RECV_INFO *, OPTIONS *);
static BOOL fd_read_func(DWORD, WSANETWORKEVENTS *, RECV_INFO *, OPTIONS *);
static BOOL fd_close_func(DWORD, WSANETWORKEVENTS *, RECV_INFO *, OPTIONS *);
int CALLBACK AcceptCondFunc(
LPWSABUF, LPWSABUF, LPQOS, LPQOS, LPWSABUF, LPWSABUF, GROUP FAR *, DWORD_PTR);
// Abstract:
// Main function to create a socket that allows clients to connect and
// send it data. Upto MAXCLIENTS can connect and send data. The data
// is read in and then tossed (the data is not used).
//
VOID Receiver(
OPTIONS *pOptions
)
{
WSANETWORKEVENTS NetworkEvents = {0};
long lNetworkEvents = 0;
BOOL bProcessEventsDone = FALSE;
RECV_INFO RecvInfo = {0};
int i = 0;
printf("Receiver\n");
//init RecvInfo sockets/event handles
for (i = 0; i < MAXCLIENTS+1; i++)
{
RecvInfo.sd[i] = INVALID_SOCKET;
RecvInfo.hEvents[i] = WSA_INVALID_EVENT;
}
for (i=0; i<MAXCLIENTS+1; i++)
{
if (WSA_INVALID_EVENT == (RecvInfo.hEvents[i] = WSACreateEvent()))
{
printf("WSACreateEvent(%d): %d\n", i, WSAGetLastError());
goto CLEANUP;
}
}
// create the receiving/listening socket
if (!CreateReceivingSocket(&RecvInfo, pOptions))
goto CLEANUP;
lNetworkEvents = (FD_ACCEPT|FD_READ|FD_CLOSE);
if (SOCKET_ERROR == WSAEventSelect(RecvInfo.sd[0], RecvInfo.hEvents[0], lNetworkEvents))
{
printf("WSAEventSelect: %d\n", WSAGetLastError());
goto CLEANUP;
}
bProcessEventsDone = FALSE;
while (!bProcessEventsDone)
{
DWORD dwEvent;
dwEvent = WSAWaitForMultipleEvents((MAXCLIENTS+1), RecvInfo.hEvents, FALSE, WSA_INFINITE, FALSE);
switch (dwEvent)
{
case WSA_WAIT_FAILED:
printf("WSAEventSelect: %d\n", WSAGetLastError());
bProcessEventsDone = TRUE;
break;
case WAIT_IO_COMPLETION:
case WSA_WAIT_TIMEOUT:
break;
default:
// lets see what network activity trigged this event
NetworkEvents.lNetworkEvents = 0;
if (SOCKET_ERROR == WSAEnumNetworkEvents(RecvInfo.sd[dwEvent], RecvInfo.hEvents[dwEvent], &NetworkEvents))
{
printf("WSAEnumNetworkEvent: %d dwEvent %d lNetworkEvent %X\n",
WSAGetLastError(), dwEvent, NetworkEvents.lNetworkEvents);
NetworkEvents.lNetworkEvents = 0;
bProcessEventsDone = TRUE;
} else
{
// it is possible that more than one notification triggered the event
//printf("WSAEnumNetworkEvents %X\n", NetworkEvents.lNetworkEvents);
if (FD_ACCEPT & NetworkEvents.lNetworkEvents)
bProcessEventsDone |=
fd_accept_func(dwEvent, &NetworkEvents, &RecvInfo, pOptions);
if (FD_READ & NetworkEvents.lNetworkEvents)
bProcessEventsDone |=
fd_read_func(dwEvent, &NetworkEvents, &RecvInfo, pOptions);
if (FD_CLOSE & NetworkEvents.lNetworkEvents)
bProcessEventsDone |=
fd_close_func(dwEvent, &NetworkEvents, &RecvInfo, pOptions);
}
break;
}
} // while (!bProcessEventsDone)
CLEANUP:
for (i = 0; i < MAXCLIENTS+1; i++)
{
if (INVALID_SOCKET != RecvInfo.sd[i])
{
closesocket(RecvInfo.sd[i]);
RecvInfo.sd[i] = INVALID_SOCKET;
}
if (WSA_INVALID_EVENT != RecvInfo.hEvents[i])
{
WSACloseEvent(RecvInfo.hEvents[i]);
RecvInfo.hEvents[i] = WSA_INVALID_EVENT;
}
}
return;
}
// Abstract:
// Create a socket on which to receive data. Please note that WSA_FLAG_OVERLAPPED
// *MUST* be specified. Also, note that the parameters for WSASocket and the
// data to fill in the SOCKADDR structure come from the supplied protocol
// info structure instead of being hardcoded.
//
static BOOL CreateReceivingSocket(
RECV_INFO *pRecvInfo,
OPTIONS *pOptions
)
{
DWORD dwSocketFlags = 0;
SOCKADDR_ATM sockaddr = {0};
int nAddrLen = 0;
int nRet = 0;
dwSocketFlags = WSA_FLAG_OVERLAPPED;
pRecvInfo->sd[0] = WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO,
&pOptions->protocolInfo, 0, dwSocketFlags);
if (INVALID_SOCKET == pRecvInfo->sd[0])
{
printf("WSASocket failed w/%d", WSAGetLastError());
return FALSE;
}
ZeroMemory(&sockaddr, sizeof(sockaddr));
nAddrLen = sizeof(sockaddr);
nRet = WSAStringToAddress(pOptions->szLocalInterface, AF_ATM, &pOptions->protocolInfo,
(LPSOCKADDR)&sockaddr, &nAddrLen);
if (SOCKET_ERROR == nRet)
{
printf("WSAAddressToString: %d\n", WSAGetLastError());
return FALSE;
}
// fill in remainder of ATM address structure
sockaddr.satm_family = AF_ATM;
sockaddr.satm_number.AddressType = ATM_NSAP;
sockaddr.satm_number.NumofDigits = ATM_ADDR_SIZE;
sockaddr.satm_blli.Layer2Protocol = SAP_FIELD_ANY;
sockaddr.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT;
sockaddr.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT;
nRet = bind(pRecvInfo->sd[0], (LPSOCKADDR)&sockaddr, sizeof(sockaddr));
if (SOCKET_ERROR == nRet)
{
printf("bind failed w/%d", WSAGetLastError());
return FALSE;
}
nRet = listen(pRecvInfo->sd[0], SOMAXCONN);
if (SOCKET_ERROR == nRet)
{
printf("listen failed w/%d", WSAGetLastError());
return FALSE;
}
return TRUE;
}
// Abstract:
// FD_ACCEPT handler. Invoked when a client is trying to connect.
// WSAAccept is called and an Accept Condition function is supplied to allow
// a connection to be rejected if too many client have already connected.
//
//
static BOOL fd_accept_func(
DWORD dwEvent,
WSANETWORKEVENTS *NetworkEvents,
RECV_INFO *pRecvInfo,
OPTIONS *pOptions
)
{
BOOL bProcessEventsDone = FALSE;
SOCKET temp_socket = INVALID_SOCKET;
int nRet = 0,
i;
printf(" FD_ACCEPT: dwEvent=%d error code =%d\n",
dwEvent, NetworkEvents->iErrorCode[FD_ACCEPT_BIT]);
if (NetworkEvents->iErrorCode[FD_ACCEPT_BIT])
return TRUE;
temp_socket = WSAAccept(pRecvInfo->sd[0], NULL, NULL, (LPCONDITIONPROC)AcceptCondFunc, (DWORD_PTR)pOptions);
if (INVALID_SOCKET == temp_socket)
{
printf(" WSAAccept failed w/%d\n", WSAGetLastError());
bProcessEventsDone = FALSE;
} else
{
// keep list of connected sockets
printf(" socket connection accepted\n");
for (i=1; i<=MAXCLIENTS; i++)
{
if (INVALID_SOCKET == pRecvInfo->sd[i])
{
pRecvInfo->sd[i] = temp_socket;
break;
}
}
nRet = WSAEventSelect(temp_socket, pRecvInfo->hEvents[i], (FD_READ|FD_CLOSE));
if (SOCKET_ERROR == nRet)
{
printf(" WSAEventSelect: failed w/%d\n", WSAGetLastError());
bProcessEventsDone = TRUE;
}
}
return bProcessEventsDone;
}
// Abstract:
// FD_READ handler. Handling FD_READ notifications is pretty straight-forward.
// Just read the amount of data you are interested in reading at this moment.
// If there is more data left, you will get another FD_READ.
//
//
//
static BOOL fd_read_func(
DWORD dwEvent,
WSANETWORKEVENTS *NetworkEvents,
RECV_INFO *pRecvInfo,
OPTIONS *pOptions
)
{
BOOL bProcessEventsDone = FALSE;
int nRecv = 0;
static CHAR *bufptr = NULL;
static int nBytesToRecv = pOptions->nBufSize;
__try
{
if (NULL == (pRecvInfo->recvbuf = (CHAR*)Malloc(pOptions->nBufSize)))
{
printf(" HeapAlloc() failed: %d [%s:%ld]\n",GetLastError(),__FILE__,__LINE__);
__leave;
}
bufptr = pRecvInfo->recvbuf;
printf(" FD_READ: dwEvent=%d error code =%d bytestorecv=%d\n",
dwEvent, NetworkEvents->iErrorCode[FD_READ_BIT], nBytesToRecv);
if (NetworkEvents->iErrorCode[FD_READ_BIT])
{
bProcessEventsDone = TRUE;
__leave;
}
nRecv = recv(pRecvInfo->sd[dwEvent], bufptr, nBytesToRecv, 0);
if (SOCKET_ERROR == nRecv)
{
DWORD dwErr= WSAGetLastError();
if (WSAEWOULDBLOCK != dwErr)
{
printf(" recv[from]: failed w/%d\n", WSAGetLastError());
bProcessEventsDone = TRUE;
} else
{
printf(" recv[from]: WSAEWOULDBLOCK, wait for next FD_READ\n");
bProcessEventsDone = FALSE;
}
} else
{
// we got data
if (nRecv)
printf(" recv'ed bytes=%d char=<%c>\n", nRecv, *bufptr);
else
printf(" recv'ed 0 bytes\n");
bufptr += nRecv;
nBytesToRecv -= nRecv;
if (0 == nBytesToRecv)
{
bufptr = pRecvInfo->recvbuf;
nBytesToRecv = pOptions->nBufSize;
}
}
}
__finally
{
if(NULL != pRecvInfo->recvbuf) Free(pRecvInfo->recvbuf);
}
return bProcessEventsDone;
}
// Abstract:
// FD_CLOSE handler. When receiving FD_CLOSE, it is still possible for data
// to be queued up and therefore the socket should be drained of that data so
// as not to lose that data. Winsock2 events are manual reset events and FD_CLOSE
// has no re-enabling function, therefore must reset the event here, otherwise
// we would get additional FD_CLOSE notifications.
//
static BOOL fd_close_func(
DWORD dwEvent,
WSANETWORKEVENTS *NetworkEvents,
RECV_INFO *pRecvInfo,
OPTIONS *pOptions
)
{
BOOL bProcessEventsDone = FALSE;
printf(" FD_CLOSE: dwEvent=%d error code =%d\n",
dwEvent, NetworkEvents->iErrorCode[FD_CLOSE_BIT]);
if (NetworkEvents->iErrorCode[FD_CLOSE_BIT])
bProcessEventsDone = TRUE;
else
{
// no need to drain the socket if running of over native ATM
WSAResetEvent(pRecvInfo->hEvents[dwEvent]);
if (INVALID_SOCKET != pRecvInfo->sd[dwEvent])
{
closesocket(pRecvInfo->sd[dwEvent]);
pRecvInfo->sd[dwEvent] = INVALID_SOCKET;
}
pOptions->dwTotalClients--;
bProcessEventsDone = FALSE;
}
return bProcessEventsDone;
}
// Abstract:
// Function called by Winsock to accept or reject a connection. If more
// than MAXCLIENTS attempt to connect the connection will be rejected
// (CF_REJECT).
//
//
int CALLBACK AcceptCondFunc(
LPWSABUF lpCallerId,
LPWSABUF lpCallerData,
LPQOS lpSQos,
LPQOS lpGQos,
LPWSABUF lpCalleeId,
LPWSABUF lpCalleeData,
GROUP FAR *Group,
DWORD_PTR CallbackData
)
{
int nRet = CF_ACCEPT;
OPTIONS *pOptions = (OPTIONS *)CallbackData;
lpCallerId;
lpCallerData;
lpCalleeId;
lpCalleeData;
lpSQos;
lpGQos;
Group;
printf(" AcceptCondFunc\n");
if (MAXCLIENTS == pOptions->dwTotalClients)
{
printf(" Rejecting connection, limit of %d clients reached\n",
pOptions->dwTotalClients);
nRet = CF_REJECT;
// At this point a connection will already have been established,
// this will just cause the connection to be reset.
} else
pOptions->dwTotalClients++;
return nRet;
}
| [
"[email protected]"
] | |
3f6a6a83b76121999c54ce0b0b1bfb2892e7a65b | 0bfbcf27570b92d2928c73d63b1a02700dfffdef | /DirectXTK/Src/BinaryReader.cpp | 060bbf528f1f0cfbacb169f5f52952ee2a92f1fb | [
"MIT"
] | permissive | maildrop/GravityDesktop | a204b7124e58da35e70e6bb727f7295c58ff67ac | a893b49805c65ddc2aff8d2ee8c0a32ca2a87094 | refs/heads/master | 2020-03-28T04:25:11.645754 | 2018-09-08T02:35:54 | 2018-09-08T02:35:54 | 147,713,532 | 0 | 0 | MIT | 2018-09-06T18:04:56 | 2018-09-06T18:04:55 | null | UTF-8 | C++ | false | false | 2,715 | cpp | //--------------------------------------------------------------------------------------
// File: BinaryReader.cpp
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#include "pch.h"
#include "BinaryReader.h"
using namespace DirectX;
// Constructor reads from the filesystem.
BinaryReader::BinaryReader(_In_z_ wchar_t const* fileName) :
mPos(nullptr),
mEnd(nullptr)
{
size_t dataSize;
HRESULT hr = ReadEntireFile(fileName, mOwnedData, &dataSize);
if ( FAILED(hr) )
{
DebugTrace( "BinaryReader failed (%08X) to load '%ls'\n", hr, fileName );
throw std::exception( "BinaryReader" );
}
mPos = mOwnedData.get();
mEnd = mOwnedData.get() + dataSize;
}
// Constructor reads from an existing memory buffer.
BinaryReader::BinaryReader(_In_reads_bytes_(dataSize) uint8_t const* dataBlob, size_t dataSize) :
mPos(dataBlob),
mEnd(dataBlob + dataSize)
{
}
// Reads from the filesystem into memory.
HRESULT BinaryReader::ReadEntireFile(_In_z_ wchar_t const* fileName, _Inout_ std::unique_ptr<uint8_t[]>& data, _Out_ size_t* dataSize)
{
// Open the file.
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
ScopedHandle hFile(safe_handle(CreateFile2(fileName, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
#else
ScopedHandle hFile(safe_handle(CreateFileW(fileName, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr)));
#endif
if (!hFile)
return HRESULT_FROM_WIN32(GetLastError());
// Get the file size.
FILE_STANDARD_INFO fileInfo;
if (!GetFileInformationByHandleEx(hFile.get(), FileStandardInfo, &fileInfo, sizeof(fileInfo)))
{
return HRESULT_FROM_WIN32(GetLastError());
}
// File is too big for 32-bit allocation, so reject read.
if (fileInfo.EndOfFile.HighPart > 0)
return E_FAIL;
// Create enough space for the file data.
data.reset(new uint8_t[fileInfo.EndOfFile.LowPart]);
if (!data)
return E_OUTOFMEMORY;
// Read the data in.
DWORD bytesRead = 0;
if (!ReadFile(hFile.get(), data.get(), fileInfo.EndOfFile.LowPart, &bytesRead, nullptr))
{
return HRESULT_FROM_WIN32(GetLastError());
}
if (bytesRead < fileInfo.EndOfFile.LowPart)
return E_FAIL;
*dataSize = bytesRead;
return S_OK;
}
| [
"[email protected]"
] | |
63929fd15fdb19d836dd6e2b4e4c0d70fd5e3dbf | 073f9a3b6e9defde09bdb453d7c79a2169c4a31b | /2015-04-18 NTUACM Session 8/c.cpp | 63d925c802fb68df763d4ccd81d8457ad0665724 | [] | no_license | kenrick95/code-archive | 9dc1c802f6d733ad10324ed217bacd3d4b2c455f | 72c420353e3aa7b18af6970b6a81f710c4f5d1b0 | refs/heads/master | 2021-03-24T12:47:52.016103 | 2018-07-08T13:22:46 | 2018-07-08T13:22:46 | 69,313,404 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,917 | cpp | #include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
//#include <bits/stdc++.h>
#define INF 1000000007
#define INFLL 9223372036854775807LL
typedef long long int64;
typedef unsigned long long qword;
using namespace std;
/**
* @problem
* @url
* @status
*/
int V;
struct edge {
int t;
int c;
};
struct node {
int n;
vector<edge> e;
};
node ma[10010];
struct da{
int cur, dist;
bool operator < (da A) const{ return dist>A.dist; }
da (int a,int c) {
cur=a;
dist=c;
}
};
int main(){
// freopen("test.in","r",stdin);
// freopen("test.out","w",stdout);
int a, b;
scanf("%d %d %d", &V, &a, &b);
int x, y, z;
for (int i = 0; i < V; i++) {
y = 0;
scanf("%d", &x);
node a;
a.n = x;
for (int j = 0; j < x; j++) {
scanf("%d", &z);
edge e;
e.t = z;
e.c = min(1, y++);
a.e.push_back(e);
}
ma[i+1] = a;
}
int dist[10010];
priority_queue<da> q;
for (int i = 0; i <= V; i++) {
dist[i] = INF;
// printf("[%d]: ", i);
// for (int j = 0; j < ma[i].n; j++) {
// printf("%d<%d> ", ma[i].e[j].t, ma[i].e[j].c);
// }
// printf("\n");
}
dist[a] = 0;
q.push(da(a, 0));
while (!q.empty()) {
da h = q.top();
for (int i = 0; i < ma[h.cur].n; i++) {
if (dist[h.cur] + ma[h.cur].e[i].c < dist[ma[h.cur].e[i].t]) {
dist[ma[h.cur].e[i].t] = dist[h.cur] + ma[h.cur].e[i].c;
q.push(da(ma[h.cur].e[i].t, dist[ma[h.cur].e[i].t]));
}
}
q.pop();
}
if (dist[b] == INF) {
printf("-1\n");
} else {
printf("%d\n", dist[b]);
}
return 0;
}
| [
"[email protected]"
] | |
6ba96c3b9fab9f2ab3b56c0f8ac131388ec21a15 | a680a0279a76388febb22360723d022dd0345914 | /models/HSSUSY/HSSUSY_model.hpp | e843b072ff0a7921c9002e4174de25c636538c16 | [] | no_license | FlexibleSUSY/FlexibleSUSY-generated | c012a522f521fe60353ab57123d8820181bb9823 | 52878dc218c50bab9bf0d71ae64433ea8c411984 | refs/heads/master | 2022-06-13T00:55:32.447439 | 2022-06-07T09:39:07 | 2022-06-07T09:39:07 | 31,202,496 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 941 | hpp | // ====================================================================
// This file is part of FlexibleSUSY.
//
// FlexibleSUSY 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.
//
// FlexibleSUSY 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 FlexibleSUSY. If not, see
// <http://www.gnu.org/licenses/>.
// ====================================================================
#ifndef HSSUSY_H
#define HSSUSY_H
namespace flexiblesusy {
template <class T>
class HSSUSY;
}
#endif
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.