diff --git a/PlottWareControl/ChangeLog.txt b/PlottWareControl/ChangeLog.txt new file mode 100644 index 0000000..5456d04 --- /dev/null +++ b/PlottWareControl/ChangeLog.txt @@ -0,0 +1,7 @@ +06 December 2017 + released version 0.1.5 of PlottWareControl + + Change log: + -Added: UI now completely ready and working (I hope so) + -Typo: Todo: saving in JSON and class serializations + diff --git a/PlottWareControl/GcodeEditorDialog.cpp b/PlottWareControl/GcodeEditorDialog.cpp new file mode 100644 index 0000000..73dec55 --- /dev/null +++ b/PlottWareControl/GcodeEditorDialog.cpp @@ -0,0 +1,60 @@ +#include "GcodeEditorDialog.h" + +//(*InternalHeaders(GcodeEditorDialog) +#include +#include +#include +#include +//*) + +//(*IdInit(GcodeEditorDialog) +const long GcodeEditorDialog::ID_TEXTCTRL1 = wxNewId(); +const long GcodeEditorDialog::ID_STATICTEXT1 = wxNewId(); +const long GcodeEditorDialog::ID_BUTTON1 = wxNewId(); +const long GcodeEditorDialog::ID_BUTTON2 = wxNewId(); +//*) + +BEGIN_EVENT_TABLE(GcodeEditorDialog,wxDialog) + //(*EventTable(GcodeEditorDialog) + //*) +END_EVENT_TABLE() + +GcodeEditorDialog::GcodeEditorDialog(wxWindow* parent,wxWindowID id,std::string* _gcode,const wxPoint& pos,const wxSize& size) +{ + gcode=_gcode; + //(*Initialize(GcodeEditorDialog) + Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id")); + SetClientSize(wxSize(902,565)); + Move(wxDefaultPosition); + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + GcodeText = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxPoint(16,48), wxSize(872,500), wxTE_MULTILINE, wxDefaultValidator, _T("ID_TEXTCTRL1")); + wxFont GcodeTextFont(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Courier New"),wxFONTENCODING_DEFAULT); + GcodeText->SetFont(GcodeTextFont); + StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("G code editor"), wxPoint(24,16), wxDefaultSize, 0, _T("ID_STATICTEXT1")); + wxFont StaticText1Font(16,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT); + StaticText1->SetFont(StaticText1Font); + SaveButton = new wxButton(this, ID_BUTTON1, _("Save"), wxPoint(704,16), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); + CancelButton = new wxButton(this, ID_BUTTON2, _("Cancel"), wxPoint(792,16), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); + + Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&GcodeEditorDialog::OnSaveButtonClick); + Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&GcodeEditorDialog::OnCancelButtonClick); + //*) + GcodeText->SetValue(*gcode); +} + +GcodeEditorDialog::~GcodeEditorDialog() +{ + //(*Destroy(GcodeEditorDialog) + //*) +} + + +void GcodeEditorDialog::OnSaveButtonClick(wxCommandEvent& event) +{ + *gcode=GcodeText->GetValue(); +} + +void GcodeEditorDialog::OnCancelButtonClick(wxCommandEvent& event) +{ + GcodeText->SetValue(*gcode); +} diff --git a/PlottWareControl/GcodeEditorDialog.h b/PlottWareControl/GcodeEditorDialog.h new file mode 100644 index 0000000..18e9b60 --- /dev/null +++ b/PlottWareControl/GcodeEditorDialog.h @@ -0,0 +1,47 @@ +#ifndef GCODEEDITORDIALOG_H +#define GCODEEDITORDIALOG_H + +#include + +//(*Headers(GcodeEditorDialog) +#include +#include +#include +#include +//*) + +class GcodeEditorDialog: public wxDialog +{ + public: + + GcodeEditorDialog(wxWindow* parent,wxWindowID id=wxID_ANY,std::string* _gcode=NULL,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize); + virtual ~GcodeEditorDialog(); + + //(*Declarations(GcodeEditorDialog) + wxTextCtrl* GcodeText; + wxStaticText* StaticText1; + wxButton* CancelButton; + wxButton* SaveButton; + //*) + + protected: + + //(*Identifiers(GcodeEditorDialog) + static const long ID_TEXTCTRL1; + static const long ID_STATICTEXT1; + static const long ID_BUTTON1; + static const long ID_BUTTON2; + //*) + + private: + + //(*Handlers(GcodeEditorDialog) + void OnSaveButtonClick(wxCommandEvent& event); + void OnCancelButtonClick(wxCommandEvent& event); + //*) + + DECLARE_EVENT_TABLE() + std::string* gcode; +}; + +#endif diff --git a/PlottWareControl/LICENSE.txt b/PlottWareControl/LICENSE.txt new file mode 100644 index 0000000..aae2f33 --- /dev/null +++ b/PlottWareControl/LICENSE.txt @@ -0,0 +1,619 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. \ No newline at end of file diff --git a/PlottWareControl/PlottWareControl.cbp b/PlottWareControl/PlottWareControl.cbp new file mode 100644 index 0000000..263ae2f --- /dev/null +++ b/PlottWareControl/PlottWareControl.cbp @@ -0,0 +1,146 @@ + + + + + + diff --git a/PlottWareControl/PlottWareControl.depend b/PlottWareControl/PlottWareControl.depend new file mode 100644 index 0000000..02fd2da --- /dev/null +++ b/PlottWareControl/PlottWareControl.depend @@ -0,0 +1,4078 @@ +# depslib dependency file v1.0 +1511706946 source:h:\munkák\plotter\plottwarecontrol\plottwarecontrolapp.cpp + "PlottWareControlApp.h" + "PlottWareControlMain.h" + + +1511638772 h:\munkák\plotter\plottwarecontrol\plottwarecontrolapp.h + + +1493467238 d:\wxwidgets-3.0.3\include\wx\app.h + "wx/event.h" + "wx/eventfilter.h" + "wx/build.h" + "wx/cmdargs.h" + "wx/init.h" + "wx/intl.h" + "wx/log.h" + "wx/unix/app.h" + "wx/msw/app.h" + "wx/motif/app.h" + "wx/dfb/app.h" + "wx/gtk/app.h" + "wx/gtk1/app.h" + "wx/x11/app.h" + "wx/osx/app.h" + "wx/cocoa/app.h" + "wx/os2/app.h" + "wx/univ/theme.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\event.h + "wx/defs.h" + "wx/cpp.h" + "wx/object.h" + "wx/clntdata.h" + "wx/gdicmn.h" + "wx/cursor.h" + "wx/mousestate.h" + "wx/dynarray.h" + "wx/thread.h" + "wx/tracker.h" + "wx/typeinfo.h" + "wx/any.h" + "wx/meta/convertible.h" + "wx/meta/removeref.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\defs.h + "wx/platform.h" + "wx/version.h" + "wx/dlimpexp.h" + + "wx/debug.h" + + + "wx/windowid.h" + + "wx/msw/winundef.h" + "wx/features.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\platform.h + + + + "wx/osx/config_xcode.h" + "wx/android/config_android.h" + "wx/compiler.h" + "wx/setup.h" + "wx/msw/wince/libraries.h" + "wx/msw/libraries.h" + "wx/msw/gccpriv.h" + + + "wx/chkconf.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\config_xcode.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\android\config_android.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\compiler.h + +1493148921 d:\wxwidgets-3.0.3\include\wx\setup.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wince\libraries.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\libraries.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\gccpriv.h + <_mingw.h> + + +1493467238 d:\wxwidgets-3.0.3\include\wx\chkconf.h + "wx/msw/wince/chkconf.h" + "wx/msw/chkconf.h" + "wx/gtk/chkconf.h" + "wx/gtk/chkconf.h" + "wx/cocoa/chkconf.h" + "wx/osx/chkconf.h" + "wx/os2/chkconf.h" + "wx/dfb/chkconf.h" + "wx/motif/chkconf.h" + "wx/x11/chkconf.h" + "wx/android/chkconf.h" + "wx/unix/chkconf.h" + "wx/univ/chkconf.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wince\chkconf.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\chkconf.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\chkconf.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\chkconf.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\chkconf.h + "wx/osx/iphone/chkconf.h" + "wx/osx/carbon/chkconf.h" + "wx/osx/cocoa/chkconf.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\iphone\chkconf.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\carbon\chkconf.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\cocoa\chkconf.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\chkconf.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\dfb\chkconf.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\chkconf.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\chkconf.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\android\chkconf.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\unix\chkconf.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\chkconf.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\version.h + "wx/cpp.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cpp.h + "wx/compiler.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dlimpexp.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\debug.h + + + "wx/chartype.h" + "wx/cpp.h" + "wx/dlimpexp.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\chartype.h + "wx/platform.h" + + + + + + + + + + + + +1493467238 d:\wxwidgets-3.0.3\include\wx\windowid.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\winundef.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\features.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\object.h + "wx/memory.h" + "wx/xti.h" + "wx/rtti.h" + "wx/xti2.h" + "wx/msw/msvcrt.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\memory.h + "wx/defs.h" + "wx/string.h" + "wx/msgout.h" + + +1493467238 d:\wxwidgets-3.0.3\include\wx\string.h + "wx/defs.h" + + + + + + + + + + + "wx/wxcrtbase.h" + "wx/strvararg.h" + "wx/buffer.h" + "wx/strconv.h" + "wx/stringimpl.h" + "wx/stringops.h" + "wx/unichar.h" + "wx/tls.h" + "wx/iosfwrap.h" + "wx/crt.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\wxcrtbase.h + "wx/chartype.h" + + + + + + + +1493467238 d:\wxwidgets-3.0.3\include\wx\strvararg.h + "wx/platform.h" + "wx/cpp.h" + "wx/chartype.h" + "wx/strconv.h" + "wx/buffer.h" + "wx/unichar.h" + + + + "wx/stringimpl.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\strconv.h + "wx/defs.h" + "wx/chartype.h" + "wx/buffer.h" + "typeinfo.h" + + "wx/fontenc.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\buffer.h + "wx/chartype.h" + "wx/wxcrtbase.h" + + +1493467238 d:\wxwidgets-3.0.3\include\wx\typeinfo.h + "wx/defs.h" + + + +1493467238 d:\wxwidgets-3.0.3\include\wx\fontenc.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\unichar.h + "wx/defs.h" + "wx/chartype.h" + "wx/stringimpl.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\stringimpl.h + "wx/defs.h" + "wx/chartype.h" + "wx/wxcrtbase.h" + + "wx/beforestd.h" + + "wx/afterstd.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\beforestd.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\afterstd.h + "wx/msw/winundef.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\stringops.h + "wx/chartype.h" + "wx/stringimpl.h" + "wx/unichar.h" + "wx/buffer.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\tls.h + "wx/defs.h" + "wx/msw/tls.h" + "wx/os2/tls.h" + "wx/unix/tls.h" + + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\tls.h + "wx/msw/wrapwin.h" + "wx/thread.h" + "wx/vector.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wrapwin.h + "wx/platform.h" + + + "wx/msw/winundef.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\thread.h + "wx/defs.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\vector.h + "wx/defs.h" + + + "wx/scopeguard.h" + "wx/meta/movable.h" + "wx/meta/if.h" + "wx/beforestd.h" + + "wx/afterstd.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\scopeguard.h + "wx/defs.h" + "wx/except.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\except.h + "wx/defs.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\meta\movable.h + "wx/meta/pod.h" + "wx/string.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\meta\pod.h + "wx/defs.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\meta\if.h + "wx/defs.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\tls.h + "wx/os2/private.h" + "wx/thread.h" + "wx/vector.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\private.h + + + + + + + + "wx/dlimpexp.h" + "wx/fontenc.h" + "wx/thread.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\unix\tls.h + + +1493467238 d:\wxwidgets-3.0.3\include\wx\iosfwrap.h + + + "wx/msw/winundef.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\crt.h + "wx/defs.h" + "wx/chartype.h" + "wx/wxcrt.h" + "wx/wxcrtvararg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\wxcrt.h + "wx/wxcrtbase.h" + "wx/string.h" + + +1493467238 d:\wxwidgets-3.0.3\include\wx\wxcrtvararg.h + "wx/wxcrt.h" + "wx/strvararg.h" + "wx/string.h" + + +1493467238 d:\wxwidgets-3.0.3\include\wx\msgout.h + "wx/defs.h" + "wx/chartype.h" + "wx/strvararg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\xti.h + "wx/defs.h" + "wx/xtitypes.h" + "wx/xtihandler.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\xtitypes.h + "wx/defs.h" + "wx/string.h" + "wx/hashmap.h" + "wx/arrstr.h" + "wx/flags.h" + "wx/intl.h" + "wx/log.h" + + +1493467238 d:\wxwidgets-3.0.3\include\wx\hashmap.h + "wx/string.h" + "wx/wxcrt.h" + + + + + + +1493467238 d:\wxwidgets-3.0.3\include\wx\arrstr.h + "wx/defs.h" + "wx/string.h" + "wx/dynarray.h" + "wx/beforestd.h" + + "wx/afterstd.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dynarray.h + "wx/defs.h" + "wx/beforestd.h" + + + "wx/afterstd.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\flags.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\intl.h + "wx/defs.h" + "wx/string.h" + "wx/translation.h" + "wx/fontenc.h" + "wx/language.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\translation.h + "wx/defs.h" + "wx/string.h" + "wx/buffer.h" + "wx/language.h" + "wx/hashmap.h" + "wx/strconv.h" + "wx/scopedptr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\language.h + "wx/defs.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\scopedptr.h + "wx/defs.h" + "wx/checkeddelete.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\checkeddelete.h + "wx/cpp.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\log.h + "wx/defs.h" + "wx/cpp.h" + "wx/string.h" + "wx/strvararg.h" + "wx/arrstr.h" + + "wx/dynarray.h" + "wx/hashmap.h" + "wx/thread.h" + "wx/iosfwrap.h" + "wx/generic/logg.h" + "wx/cocoa/log.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\logg.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\log.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\xtihandler.h + "wx/defs.h" + "wx/xti.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\rtti.h + "wx/memory.h" + "wx/flags.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\xti2.h + "wx/xtiprop.h" + "wx/xtictor.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\xtiprop.h + "wx/defs.h" + "wx/xti.h" + "wx/any.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\any.h + "wx/defs.h" + + "wx/string.h" + "wx/meta/if.h" + "wx/typeinfo.h" + "wx/list.h" + "wx/datetime.h" + "wx/variant.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\list.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/vector.h" + "wx/beforestd.h" + + + + "wx/afterstd.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\datetime.h + "wx/defs.h" + "wx/msw/wince/time.h" + + + "wx/longlong.h" + "wx/anystr.h" + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wince\time.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\longlong.h + "wx/defs.h" + "wx/string.h" + + "wx/iosfwrap.h" + + "wx/strvararg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\anystr.h + "wx/string.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\variant.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/arrstr.h" + "wx/list.h" + "wx/cpp.h" + "wx/longlong.h" + "wx/datetime.h" + "wx/iosfwrap.h" + "wx/any.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\xtictor.h + "wx/defs.h" + "wx/xti.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\msvcrt.h + + + +1493467238 d:\wxwidgets-3.0.3\include\wx\clntdata.h + "wx/defs.h" + "wx/string.h" + "wx/hashmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gdicmn.h + "wx/defs.h" + "wx/list.h" + "wx/string.h" + "wx/fontenc.h" + "wx/hashmap.h" + "wx/math.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\math.h + "wx/defs.h" + + + + + +1493467238 d:\wxwidgets-3.0.3\include\wx\cursor.h + "wx/defs.h" + "wx/msw/cursor.h" + "wx/motif/cursor.h" + "wx/gtk/cursor.h" + "wx/gtk1/cursor.h" + "wx/x11/cursor.h" + "wx/dfb/cursor.h" + "wx/osx/cursor.h" + "wx/cocoa/cursor.h" + "wx/os2/cursor.h" + "wx/utils.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\cursor.h + "wx/msw/gdiimage.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\gdiimage.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/list.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gdiobj.h + "wx/object.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\cursor.h + "wx/gdiobj.h" + "wx/gdicmn.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\cursor.h + "wx/gdiobj.h" + "wx/gdicmn.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\cursor.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/image.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\image.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/gdicmn.h" + "wx/hashmap.h" + "wx/arrstr.h" + "wx/stream.h" + "wx/variant.h" + "wx/imagbmp.h" + "wx/imagpng.h" + "wx/imaggif.h" + "wx/imagpcx.h" + "wx/imagjpeg.h" + "wx/imagtga.h" + "wx/imagtiff.h" + "wx/imagpnm.h" + "wx/imagxpm.h" + "wx/imagiff.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\stream.h + "wx/defs.h" + + "wx/object.h" + "wx/string.h" + "wx/filefn.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\filefn.h + "wx/list.h" + "wx/arrstr.h" + "wx/msw/wince/time.h" + "wx/msw/private.h" + + + + + "wx/os2/private.h" + + + + + + + + + + + + + + + + + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\private.h + "wx/msw/wrapwin.h" + "wx/msw/microwin.h" + "wx/log.h" + "wx/window.h" + "wx/gdicmn.h" + "wx/colour.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\microwin.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\window.h + "wx/event.h" + "wx/list.h" + "wx/cursor.h" + "wx/font.h" + "wx/colour.h" + "wx/region.h" + "wx/utils.h" + "wx/intl.h" + "wx/validate.h" + "wx/palette.h" + "wx/accel.h" + "wx/access.h" + "wx/msw/window.h" + "wx/motif/window.h" + "wx/gtk/window.h" + "wx/gtk1/window.h" + "wx/x11/window.h" + "wx/dfb/window.h" + "wx/osx/window.h" + "wx/cocoa/window.h" + "wx/os2/window.h" + "wx/univ/window.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\font.h + "wx/defs.h" + "wx/fontenc.h" + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/msw/font.h" + "wx/motif/font.h" + "wx/gtk/font.h" + "wx/gtk1/font.h" + "wx/x11/font.h" + "wx/dfb/font.h" + "wx/osx/font.h" + "wx/cocoa/font.h" + "wx/os2/font.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\font.h + "wx/gdicmn.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\font.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\font.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\font.h + "wx/hash.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\hash.h + "wx/defs.h" + "wx/string.h" + "wx/object.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\font.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\dfb\font.h + "wx/dfb/dfbptr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dfb\dfbptr.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\font.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\font.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\font.h + "wx/gdiobj.h" + "wx/os2/private.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\colour.h + "wx/defs.h" + "wx/gdiobj.h" + "wx/variant.h" + "wx/msw/colour.h" + "wx/motif/colour.h" + "wx/gtk/colour.h" + "wx/gtk1/colour.h" + "wx/generic/colour.h" + "wx/x11/colour.h" + "wx/osx/colour.h" + "wx/cocoa/colour.h" + "wx/os2/colour.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\colour.h + "wx/object.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\colour.h + "wx/object.h" + "wx/string.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\colour.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\colour.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/gdiobj.h" + "wx/palette.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\palette.h + "wx/defs.h" + "wx/object.h" + "wx/gdiobj.h" + "wx/msw/palette.h" + "wx/x11/palette.h" + "wx/generic/paletteg.h" + "wx/osx/palette.h" + "wx/os2/palette.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\palette.h + "wx/gdiobj.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\palette.h + "wx/list.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\paletteg.h + "wx/defs.h" + "wx/object.h" + "wx/gdiobj.h" + "wx/gdicmn.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\palette.h + "wx/gdiobj.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\palette.h + "wx/gdiobj.h" + "wx/os2/private.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\colour.h + "wx/object.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\colour.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/gdiobj.h" + "wx/palette.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\colour.h + "wx/osx/core/colour.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\core\colour.h + "wx/object.h" + "wx/string.h" + "wx/osx/core/cfref.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\core\cfref.h + + + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\colour.h + "wx/object.h" + "wx/string.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\colour.h + "wx/object.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\region.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/msw/region.h" + "wx/gtk/region.h" + "wx/gtk1/region.h" + "wx/x11/region.h" + "wx/dfb/region.h" + "wx/osx/region.h" + "wx/cocoa/region.h" + "wx/os2/region.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\region.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\region.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\region.h + "wx/list.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\region.h + "wx/list.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dfb\region.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\region.h + "wx/osx/carbon/region.h" + "wx/generic/region.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\carbon\region.h + "wx/list.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\region.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\region.h + "wx/generic/region.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\region.h + "wx/list.h" + "wx/os2/private.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\utils.h + "wx/object.h" + "wx/list.h" + "wx/filefn.h" + "wx/hashmap.h" + "wx/versioninfo.h" + "wx/meta/implicitconversion.h" + "wx/gdicmn.h" + "wx/mousestate.h" + "wx/longlong.h" + "wx/platinfo.h" + + + + + +1493467238 d:\wxwidgets-3.0.3\include\wx\versioninfo.h + "wx/string.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\meta\implicitconversion.h + "wx/defs.h" + "wx/meta/if.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\mousestate.h + "wx/gdicmn.h" + "wx/kbdstate.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\kbdstate.h + "wx/defs.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\platinfo.h + "wx/string.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\validate.h + "wx/defs.h" + "wx/event.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\accel.h + "wx/defs.h" + "wx/object.h" + "wx/generic/accel.h" + "wx/msw/accel.h" + "wx/motif/accel.h" + "wx/gtk/accel.h" + "wx/gtk1/accel.h" + "wx/osx/accel.h" + "wx/generic/accel.h" + "wx/os2/accel.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\accel.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\accel.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\accel.h + "wx/object.h" + "wx/string.h" + "wx/event.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\accel.h + "wx/generic/accel.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\accel.h + "wx/generic/accel.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\accel.h + "wx/string.h" + "wx/event.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\accel.h + "wx/object.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\access.h + "wx/defs.h" + "wx/variant.h" + "wx/msw/ole/access.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\ole\access.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\window.h + "wx/settings.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\settings.h + "wx/colour.h" + "wx/font.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\window.h + "wx/region.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\window.h + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\window.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\window.h + "wx/region.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dfb\window.h + "wx/dfb/dfbptr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\window.h + "wx/brush.h" + "wx/dc.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\brush.h + "wx/defs.h" + "wx/object.h" + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/msw/brush.h" + "wx/x11/brush.h" + "wx/gtk/brush.h" + "wx/gtk1/brush.h" + "wx/dfb/brush.h" + "wx/osx/brush.h" + "wx/cocoa/brush.h" + "wx/os2/brush.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\brush.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\brush.h + "wx/gdiobj.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\brush.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\brush.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/gdiobj.h" + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\bitmap.h + "wx/string.h" + "wx/gdicmn.h" + "wx/colour.h" + "wx/image.h" + "wx/variant.h" + "wx/msw/bitmap.h" + "wx/x11/bitmap.h" + "wx/gtk/bitmap.h" + "wx/gtk1/bitmap.h" + "wx/x11/bitmap.h" + "wx/dfb/bitmap.h" + "wx/osx/bitmap.h" + "wx/cocoa/bitmap.h" + "wx/os2/bitmap.h" + "wx/generic/mask.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\bitmap.h + "wx/msw/gdiimage.h" + "wx/math.h" + "wx/palette.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\bitmap.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/palette.h" + "wx/gdiobj.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\bitmap.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\bitmap.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/palette.h" + "wx/gdiobj.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dfb\bitmap.h + "wx/dfb/dfbptr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\bitmap.h + "wx/palette.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\bitmap.h + "wx/palette.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\bitmap.h + "wx/os2/private.h" + "wx/os2/gdiimage.h" + "wx/gdicmn.h" + "wx/palette.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\gdiimage.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/list.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\mask.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\dfb\brush.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/gdiobj.h" + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\brush.h + "wx/gdicmn.h" + "wx/gdiobj.h" + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\brush.h + "wx/gdicmn.h" + "wx/gdiobj.h" + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\brush.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dc.h + "wx/object.h" + "wx/intl.h" + "wx/cursor.h" + "wx/font.h" + "wx/colour.h" + "wx/bitmap.h" + "wx/brush.h" + "wx/pen.h" + "wx/palette.h" + "wx/dynarray.h" + "wx/math.h" + "wx/image.h" + "wx/region.h" + "wx/affinematrix2d.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\pen.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/msw/pen.h" + "wx/x11/pen.h" + "wx/gtk/pen.h" + "wx/gtk1/pen.h" + "wx/dfb/pen.h" + "wx/osx/pen.h" + "wx/cocoa/pen.h" + "wx/os2/pen.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\pen.h + "wx/gdiobj.h" + "wx/gdicmn.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\pen.h + "wx/gdicmn.h" + "wx/gdiobj.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\pen.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\pen.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/gdiobj.h" + "wx/gdicmn.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dfb\pen.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/gdiobj.h" + "wx/gdicmn.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\pen.h + "wx/gdiobj.h" + "wx/colour.h" + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\pen.h + "wx/gdiobj.h" + "wx/gdicmn.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\pen.h + "wx/gdiobj.h" + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\affinematrix2d.h + "wx/defs.h" + "wx/affinematrix2dbase.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\affinematrix2dbase.h + "wx/defs.h" + "wx/geometry.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\geometry.h + "wx/defs.h" + "wx/utils.h" + "wx/gdicmn.h" + "wx/math.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\window.h + "wx/cocoa/NSView.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\nsview.h + "wx/hashmap.h" + "wx/cocoa/ObjcAssociate.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\objcassociate.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\window.h + + "wx/hash.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\window.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\imagbmp.h + "wx/image.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\imagpng.h + "wx/defs.h" + "wx/image.h" + "wx/versioninfo.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\imaggif.h + "wx/image.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\imagpcx.h + "wx/image.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\imagjpeg.h + "wx/defs.h" + "wx/image.h" + "wx/versioninfo.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\imagtga.h + "wx/image.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\imagtiff.h + "wx/defs.h" + "wx/image.h" + "wx/versioninfo.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\imagpnm.h + "wx/image.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\imagxpm.h + "wx/image.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\imagiff.h + "wx/image.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\cursor.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/colour.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dfb\cursor.h + "wx/gdiobj.h" + "wx/gdicmn.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\cursor.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\cursor.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\cursor.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\tracker.h + "wx/defs.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\meta\convertible.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\meta\removeref.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\eventfilter.h + "wx/defs.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\build.h + "wx/version.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cmdargs.h + "wx/arrstr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\init.h + "wx/defs.h" + "wx/chartype.h" + "wx/msw/init.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\init.h + "wx/msw/wrapwin.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\unix\app.h + + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\app.h + "wx/event.h" + "wx/icon.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\icon.h + "wx/iconloc.h" + "wx/msw/icon.h" + "wx/motif/icon.h" + "wx/generic/icon.h" + "wx/generic/icon.h" + "wx/generic/icon.h" + "wx/generic/icon.h" + "wx/osx/icon.h" + "wx/generic/icon.h" + "wx/cocoa/icon.h" + "wx/os2/icon.h" + "wx/variant.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\iconloc.h + "wx/string.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\icon.h + "wx/msw/gdiimage.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\icon.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\icon.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\icon.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\icon.h + "wx/gdicmn.h" + "wx/gdiobj.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\icon.h + "wx/bitmap.h" + "wx/os2/gdiimage.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\app.h + "wx/event.h" + "wx/hashmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dfb\app.h + "wx/dfb/dfbptr.h" + "wx/vidmode.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\vidmode.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\app.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\app.h + "wx/frame.h" + "wx/icon.h" + "wx/strconv.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\frame.h + "wx/toplevel.h" + "wx/statusbr.h" + "wx/univ/frame.h" + "wx/msw/frame.h" + "wx/gtk/frame.h" + "wx/gtk1/frame.h" + "wx/motif/frame.h" + "wx/osx/frame.h" + "wx/cocoa/frame.h" + "wx/os2/frame.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\toplevel.h + "wx/nonownedwnd.h" + "wx/iconbndl.h" + "wx/weakref.h" + "wx/msw/toplevel.h" + "wx/gtk/toplevel.h" + "wx/gtk1/toplevel.h" + "wx/x11/toplevel.h" + "wx/dfb/toplevel.h" + "wx/osx/toplevel.h" + "wx/cocoa/toplevel.h" + "wx/os2/toplevel.h" + "wx/motif/toplevel.h" + "wx/univ/toplevel.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\nonownedwnd.h + "wx/window.h" + "wx/dfb/nonownedwnd.h" + "wx/gtk/nonownedwnd.h" + "wx/osx/nonownedwnd.h" + "wx/msw/nonownedwnd.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dfb\nonownedwnd.h + "wx/window.h" + "wx/dfb/dfbptr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\nonownedwnd.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\nonownedwnd.h + "wx/window.h" + "wx/graphics.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\graphics.h + "wx/defs.h" + "wx/geometry.h" + "wx/dynarray.h" + "wx/dc.h" + "wx/image.h" + "wx/vector.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\nonownedwnd.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\iconbndl.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/icon.h" + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\weakref.h + "wx/tracker.h" + "wx/meta/convertible.h" + "wx/meta/int2type.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\meta\int2type.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\toplevel.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\toplevel.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\toplevel.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\toplevel.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\dfb\toplevel.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\toplevel.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\toplevel.h + "wx/hashmap.h" + "wx/cocoa/NSWindow.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\nswindow.h + "wx/hashmap.h" + "wx/cocoa/ObjcAssociate.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\toplevel.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\toplevel.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\toplevel.h + "wx/univ/inpcons.h" + "wx/univ/inphand.h" + "wx/icon.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\inpcons.h + "wx/object.h" + "wx/event.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\inphand.h + "wx/univ/inpcons.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\statusbr.h + "wx/defs.h" + "wx/control.h" + "wx/list.h" + "wx/dynarray.h" + "wx/univ/statusbr.h" + "wx/msw/statusbar.h" + "wx/generic/statusbr.h" + "wx/osx/statusbr.h" + "wx/generic/statusbr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\control.h + "wx/defs.h" + "wx/window.h" + "wx/univ/control.h" + "wx/msw/control.h" + "wx/motif/control.h" + "wx/gtk/control.h" + "wx/gtk1/control.h" + "wx/osx/control.h" + "wx/cocoa/control.h" + "wx/os2/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\control.h + "wx/univ/inphand.h" + "wx/univ/inpcons.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\control.h + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\control.h + "wx/window.h" + "wx/list.h" + "wx/validate.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\control.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\control.h + "wx/defs.h" + "wx/object.h" + "wx/list.h" + "wx/window.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\control.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\control.h + "wx/cocoa/NSControl.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\nscontrol.h + "wx/hashmap.h" + "wx/cocoa/ObjcAssociate.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\control.h + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\statusbr.h + "wx/univ/inpcons.h" + "wx/arrstr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\statusbar.h + "wx/vector.h" + "wx/tooltip.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\tooltip.h + "wx/defs.h" + "wx/msw/tooltip.h" + "wx/gtk/tooltip.h" + "wx/gtk1/tooltip.h" + "wx/osx/tooltip.h" + "wx/cocoa/tooltip.h" + "wx/os2/tooltip.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\tooltip.h + "wx/object.h" + "wx/gdicmn.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\tooltip.h + "wx/string.h" + "wx/object.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\tooltip.h + "wx/defs.h" + "wx/string.h" + "wx/object.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\tooltip.h + "wx/string.h" + "wx/event.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\tooltip.h + "wx/object.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\tooltip.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\statusbr.h + "wx/defs.h" + "wx/pen.h" + "wx/arrstr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\statusbr.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\frame.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\frame.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\frame.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\frame.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\frame.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\frame.h + "wx/toolbar.h" + "wx/accel.h" + "wx/icon.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\toolbar.h + "wx/defs.h" + "wx/tbarbase.h" + "wx/univ/toolbar.h" + "wx/msw/toolbar.h" + "wx/msw/wince/tbarwce.h" + "wx/motif/toolbar.h" + "wx/gtk/toolbar.h" + "wx/gtk1/toolbar.h" + "wx/osx/toolbar.h" + "wx/cocoa/toolbar.h" + "wx/os2/toolbar.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\tbarbase.h + "wx/defs.h" + "wx/bitmap.h" + "wx/list.h" + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\toolbar.h + "wx/button.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\button.h + "wx/defs.h" + "wx/anybutton.h" + "wx/univ/button.h" + "wx/msw/button.h" + "wx/motif/button.h" + "wx/gtk/button.h" + "wx/gtk1/button.h" + "wx/osx/button.h" + "wx/cocoa/button.h" + "wx/os2/button.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\anybutton.h + "wx/defs.h" + "wx/bitmap.h" + "wx/control.h" + "wx/univ/anybutton.h" + "wx/msw/anybutton.h" + "wx/gtk/anybutton.h" + "wx/osx/anybutton.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\anybutton.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\anybutton.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\anybutton.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\anybutton.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\button.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\button.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\button.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\button.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\button.h + "wx/defs.h" + "wx/object.h" + "wx/list.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\button.h + "wx/control.h" + "wx/gdicmn.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\button.h + "wx/cocoa/NSButton.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\nsbutton.h + "wx/hashmap.h" + "wx/cocoa/ObjcAssociate.h" + "wx/cocoa/ObjcRef.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\objcref.h + "wx/osx/core/cfref.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\button.h + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\toolbar.h + "wx/dynarray.h" + "wx/imaglist.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\imaglist.h + "wx/defs.h" + "wx/generic/imaglist.h" + "wx/msw/imaglist.h" + "wx/osx/imaglist.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\imaglist.h + "wx/list.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\imaglist.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\imaglist.h + "wx/defs.h" + "wx/list.h" + "wx/icon.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wince\tbarwce.h + "wx/dynarray.h" + "wx/msw/toolbar.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\toolbar.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\toolbar.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\toolbar.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\toolbar.h + "wx/tbarbase.h" + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\toolbar.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\toolbar.h + "wx/timer.h" + "wx/tbarbase.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\timer.h + "wx/defs.h" + "wx/object.h" + "wx/longlong.h" + "wx/event.h" + "wx/stopwatch.h" + "wx/utils.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\stopwatch.h + "wx/defs.h" + "wx/longlong.h" + "wx/time.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\time.h + "wx/longlong.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\frame.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\frame.h + "wx/os2/wxrsc.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\wxrsc.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\app.h + "wx/gdicmn.h" + "wx/event.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\app.h + "wx/defs.h" + "wx/object.h" + "wx/gdicmn.h" + "wx/event.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\app.h + "wx/osx/core/cfref.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\app.h + + + + + + + + + "wx/event.h" + "wx/icon.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\theme.h + "wx/string.h" + +1512587882 h:\munkák\plotter\plottwarecontrol\plottwarecontrolmain.h + + + + "settings.h" + "project.h" + + + + + + + + + + + + + + + + + + + +1493467238 d:\wxwidgets-3.0.3\include\wx\menu.h + "wx/defs.h" + "wx/list.h" + "wx/window.h" + "wx/menuitem.h" + "wx/univ/menu.h" + "wx/msw/menu.h" + "wx/motif/menu.h" + "wx/gtk/menu.h" + "wx/gtk1/menu.h" + "wx/osx/menu.h" + "wx/cocoa/menu.h" + "wx/os2/menu.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\menuitem.h + "wx/defs.h" + "wx/object.h" + "wx/univ/menuitem.h" + "wx/msw/menuitem.h" + "wx/motif/menuitem.h" + "wx/gtk/menuitem.h" + "wx/gtk1/menuitem.h" + "wx/osx/menuitem.h" + "wx/cocoa/menuitem.h" + "wx/os2/menuitem.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\menuitem.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\menuitem.h + "wx/ownerdrw.h" + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\ownerdrw.h + "wx/defs.h" + "wx/font.h" + "wx/colour.h" + "wx/msw/ownerdrw.h" + "wx/os2/ownerdrw.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\ownerdrw.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\ownerdrw.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\menuitem.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\menuitem.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\menuitem.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\menuitem.h + "wx/defs.h" + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\menuitem.h + "wx/hashmap.h" + "wx/bitmap.h" + "wx/cocoa/ObjcRef.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\menuitem.h + "wx/defs.h" + "wx/os2/private.h" + "wx/ownerdrw.h" + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\menu.h + "wx/accel.h" + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\menu.h + "wx/accel.h" + "wx/dynarray.h" + "wx/arrstr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\menu.h + "wx/colour.h" + "wx/font.h" + "wx/arrstr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\menu.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\menu.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\menu.h + "wx/arrstr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\menu.h + "wx/cocoa/NSMenu.h" + "wx/accel.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\nsmenu.h + "wx/hashmap.h" + "wx/cocoa/ObjcAssociate.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\menu.h + "wx/accel.h" + "wx/list.h" + "wx/dynarray.h" + +1512588768 source:h:\munkák\plotter\plottwarecontrol\plottwarecontrolmain.cpp + "PlottWareControlMain.h" + + + "version.h" + "SettingDialog.h" + "imageViewer.h" + "GcodeEditorDialog.h" + + + + + + + + +1493467238 d:\wxwidgets-3.0.3\include\wx\msgdlg.h + "wx/defs.h" + "wx/dialog.h" + "wx/stockitem.h" + "wx/generic/msgdlgg.h" + "wx/cocoa/msgdlg.h" + "wx/msw/msgdlg.h" + "wx/motif/msgdlg.h" + "wx/gtk/msgdlg.h" + "wx/osx/msgdlg.h" + "wx/os2/msgdlg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dialog.h + "wx/toplevel.h" + "wx/containr.h" + "wx/sharedptr.h" + "wx/univ/dialog.h" + "wx/msw/dialog.h" + "wx/motif/dialog.h" + "wx/gtk/dialog.h" + "wx/gtk1/dialog.h" + "wx/osx/dialog.h" + "wx/cocoa/dialog.h" + "wx/os2/dialog.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\containr.h + "wx/defs.h" + "wx/event.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\sharedptr.h + "wx/defs.h" + "wx/atomic.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\atomic.h + "wx/defs.h" + "wx/msw/wrapwin.h" + "libkern/OSAtomic.h" + + "wx/thread.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\dialog.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\dialog.h + "wx/panel.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\panel.h + "wx/window.h" + "wx/containr.h" + "wx/univ/panel.h" + "wx/msw/panel.h" + "wx/generic/panelg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\panel.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\panel.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\panelg.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\dialog.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\dialog.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\dialog.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\dialog.h + "wx/panel.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\dialog.h + "wx/defs.h" + "wx/panel.h" + "wx/cocoa/NSPanel.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\nspanel.h + "wx/hashmap.h" + "wx/cocoa/ObjcAssociate.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\dialog.h + "wx/panel.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\stockitem.h + "wx/defs.h" + "wx/chartype.h" + "wx/string.h" + "wx/accel.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\msgdlgg.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\msgdlg.h + "wx/msgdlg.h" + "wx/generic/msgdlgg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\msgdlg.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\msgdlg.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\msgdlg.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\msgdlg.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\msgdlg.h + +1446667740 source:h:\munkák\plotter\plottwarecontrol\resource.rc + "wx/msw/wx.rc" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wx.rc + + "wx/msw/wince/wince.rc" + "wx/msw/rcdefs.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wince\wince.rc + + "wx/msw/wince/resources.h" + "wx/msw/wince/smartphone.rc" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wince\resources.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wince\smartphone.rc + + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\rcdefs.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\splitter.h + "wx/event.h" + "wx/generic/splitter.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\splitter.h + "wx/window.h" + "wx/containr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\stattext.h + "wx/defs.h" + "wx/control.h" + "wx/univ/stattext.h" + "wx/msw/stattext.h" + "wx/motif/stattext.h" + "wx/gtk/stattext.h" + "wx/gtk1/stattext.h" + "wx/osx/stattext.h" + "wx/cocoa/stattext.h" + "wx/os2/stattext.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\stattext.h + "wx/generic/stattextg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\stattextg.h + "wx/stattext.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\stattext.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\stattext.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\stattext.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\stattext.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\stattext.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\stattext.h + "wx/cocoa/NSTextField.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\nstextfield.h + "wx/hashmap.h" + "wx/cocoa/ObjcAssociate.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\stattext.h + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\statline.h + "wx/defs.h" + "wx/control.h" + "wx/univ/statline.h" + "wx/msw/statline.h" + "wx/gtk/statline.h" + "wx/gtk1/statline.h" + "wx/os2/statline.h" + "wx/osx/statline.h" + "wx/cocoa/statline.h" + "wx/generic/statline.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\statline.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\statline.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\statline.h + "wx/defs.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\statline.h + "wx/defs.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\statline.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\statline.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\statline.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\statline.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\checklst.h + "wx/defs.h" + "wx/listbox.h" + "wx/univ/checklst.h" + "wx/msw/wince/checklst.h" + "wx/msw/checklst.h" + "wx/motif/checklst.h" + "wx/gtk/checklst.h" + "wx/gtk1/checklst.h" + "wx/osx/checklst.h" + "wx/cocoa/checklst.h" + "wx/os2/checklst.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\listbox.h + "wx/defs.h" + "wx/ctrlsub.h" + "wx/univ/listbox.h" + "wx/msw/listbox.h" + "wx/motif/listbox.h" + "wx/gtk/listbox.h" + "wx/gtk1/listbox.h" + "wx/osx/listbox.h" + "wx/os2/listbox.h" + "wx/cocoa/listbox.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\ctrlsub.h + "wx/defs.h" + "wx/arrstr.h" + "wx/control.h" + "wx/msw/ctrlsub.h" + "wx/motif/ctrlsub.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\ctrlsub.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\ctrlsub.h + "wx/dynarray.h" + "wx/generic/ctrlsub.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\ctrlsub.h + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\listbox.h + "wx/scrolwin.h" + "wx/dynarray.h" + "wx/arrstr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\scrolwin.h + "wx/panel.h" + "wx/gtk/scrolwin.h" + "wx/gtk1/scrolwin.h" + "wx/generic/scrolwin.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\scrolwin.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\scrolwin.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\scrolwin.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\listbox.h + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\listbox.h + "wx/ctrlsub.h" + "wx/clntdata.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\listbox.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\listbox.h + "wx/list.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\listbox.h + "wx/dynarray.h" + "wx/arrstr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\listbox.h + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\listbox.h + "wx/cocoa/NSTableView.h" + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\nstableview.h + "wx/hashmap.h" + "wx/cocoa/ObjcAssociate.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\checklst.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wince\checklst.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\checklst.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\checklst.h + "wx/listbox.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\checklst.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\checklst.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\checklst.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\checklst.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\checklst.h + + "wx/defs.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\spinctrl.h + "wx/defs.h" + "wx/spinbutt.h" + "wx/msw/spinctrl.h" + "wx/os2/spinctrl.h" + "wx/gtk/spinctrl.h" + "wx/gtk1/spinctrl.h" + "wx/generic/spinctlg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\spinbutt.h + "wx/defs.h" + "wx/control.h" + "wx/event.h" + "wx/range.h" + "wx/univ/spinbutt.h" + "wx/msw/spinbutt.h" + "wx/motif/spinbutt.h" + "wx/gtk/spinbutt.h" + "wx/gtk1/spinbutt.h" + "wx/osx/spinbutt.h" + "wx/cocoa/spinbutt.h" + "wx/os2/spinbutt.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\range.h + "wx/defs.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\spinbutt.h + "wx/univ/scrarrow.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\scrarrow.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\spinbutt.h + "wx/control.h" + "wx/event.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\spinbutt.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\spinbutt.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\spinbutt.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\spinbutt.h + "wx/control.h" + "wx/event.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\spinbutt.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\spinbutt.h + "wx/control.h" + "wx/event.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\spinctrl.h + "wx/spinbutt.h" + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\spinctrl.h + "wx/spinbutt.h" + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\spinctrl.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\spinctrl.h + "wx/defs.h" + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\spinctlg.h + "wx/compositewin.h" + "wx/textctrl.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\compositewin.h + "wx/window.h" + "wx/containr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\textctrl.h + "wx/defs.h" + "wx/control.h" + "wx/textentry.h" + "wx/dynarray.h" + "wx/gdicmn.h" + "wx/ioswrap.h" + "wx/x11/textctrl.h" + "wx/univ/textctrl.h" + "wx/msw/wince/textctrlce.h" + "wx/msw/textctrl.h" + "wx/motif/textctrl.h" + "wx/gtk/textctrl.h" + "wx/gtk1/textctrl.h" + "wx/osx/textctrl.h" + "wx/cocoa/textctrl.h" + "wx/os2/textctrl.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\textentry.h + "wx/filefn.h" + "wx/gdicmn.h" + "wx/gtk/textentry.h" + "wx/osx/textentry.h" + "wx/msw/textentry.h" + "wx/motif/textentry.h" + "wx/os2/textentry.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\textentry.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\textentry.h + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\textentry.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\textentry.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\textentry.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\ioswrap.h + "wx/beforestd.h" + + + "wx/afterstd.h" + "wx/msw/winundef.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\textctrl.h + "wx/univ/textctrl.h" + "wx/scrolwin.h" + "wx/arrstr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\textctrl.h + "wx/scrolwin.h" + "wx/univ/inphand.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wince\textctrlce.h + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\textctrl.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\textctrl.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\textctrl.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\textctrl.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\textctrl.h + "wx/control.h" + "wx/textctrl.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\textctrl.h + "wx/cocoa/NSTextField.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\textctrl.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\radiobut.h + "wx/defs.h" + "wx/control.h" + "wx/univ/radiobut.h" + "wx/msw/radiobut.h" + "wx/motif/radiobut.h" + "wx/gtk/radiobut.h" + "wx/gtk1/radiobut.h" + "wx/osx/radiobut.h" + "wx/cocoa/radiobut.h" + "wx/os2/radiobut.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\radiobut.h + "wx/checkbox.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\checkbox.h + "wx/defs.h" + "wx/control.h" + "wx/univ/checkbox.h" + "wx/msw/checkbox.h" + "wx/motif/checkbox.h" + "wx/gtk/checkbox.h" + "wx/gtk1/checkbox.h" + "wx/osx/checkbox.h" + "wx/cocoa/checkbox.h" + "wx/os2/checkbox.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\checkbox.h + "wx/button.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\checkbox.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\checkbox.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\checkbox.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\checkbox.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\checkbox.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\checkbox.h + "wx/cocoa/NSButton.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\checkbox.h + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\radiobut.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\radiobut.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\radiobut.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\radiobut.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\radiobut.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\radiobut.h + "wx/cocoa/NSButton.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\radiobut.h + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\slider.h + "wx/defs.h" + "wx/control.h" + "wx/univ/slider.h" + "wx/msw/slider.h" + "wx/motif/slider.h" + "wx/gtk/slider.h" + "wx/gtk1/slider.h" + "wx/osx/slider.h" + "wx/cocoa/slider.h" + "wx/os2/slider.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\slider.h + "wx/univ/scrthumb.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\scrthumb.h + "wx/timer.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\slider.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\slider.h + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\slider.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\slider.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\slider.h + "wx/control.h" + "wx/slider.h" + "wx/stattext.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\slider.h + "wx/cocoa/NSSlider.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\nsslider.h + "wx/hashmap.h" + "wx/cocoa/ObjcAssociate.h" + "wx/cocoa/ObjcRef.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\slider.h + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\combobox.h + "wx/defs.h" + "wx/textctrl.h" + "wx/ctrlsub.h" + "wx/textentry.h" + "wx/univ/combobox.h" + "wx/msw/combobox.h" + "wx/motif/combobox.h" + "wx/gtk/combobox.h" + "wx/gtk1/combobox.h" + "wx/osx/combobox.h" + "wx/cocoa/combobox.h" + "wx/os2/combobox.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\combobox.h + "wx/combo.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\combo.h + "wx/defs.h" + "wx/control.h" + "wx/renderer.h" + "wx/bitmap.h" + "wx/textentry.h" + "wx/msw/combo.h" + "wx/generic/combo.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\renderer.h + "wx/gdicmn.h" + "wx/colour.h" + "wx/font.h" + "wx/bitmap.h" + "wx/string.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\combo.h + "wx/timer.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\combo.h + "wx/dcbuffer.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dcbuffer.h + "wx/dcmemory.h" + "wx/dcclient.h" + "wx/window.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dcmemory.h + "wx/dc.h" + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dcclient.h + "wx/dc.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\combobox.h + "wx/choice.h" + "wx/textentry.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\choice.h + "wx/defs.h" + "wx/ctrlsub.h" + "wx/univ/choice.h" + "wx/msw/wince/choicece.h" + "wx/msw/choice.h" + "wx/motif/choice.h" + "wx/gtk/choice.h" + "wx/gtk1/choice.h" + "wx/osx/choice.h" + "wx/cocoa/choice.h" + "wx/os2/choice.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\choice.h + "wx/combobox.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wince\choicece.h + "wx/defs.h" + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\choice.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\choice.h + "wx/clntdata.h" + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\choice.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\choice.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\choice.h + "wx/control.h" + "wx/dynarray.h" + "wx/arrstr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\choice.h + "wx/cocoa/NSMenu.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\choice.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\combobox.h + "wx/choice.h" + "wx/textentry.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\combobox.h + "wx/choice.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\combobox.h + "wx/defs.h" + "wx/object.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\combobox.h + "wx/containr.h" + "wx/choice.h" + "wx/textctrl.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\combobox.h + "wx/hashmap.h" + "wx/cocoa/ObjcAssociate.h" + "wx/textctrl.h" + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\combobox.h + "wx/choice.h" + "wx/textentry.h" + +1512588948 h:\munkák\plotter\plottwarecontrol\version.h + +1512588544 source:h:\munkák\plotter\plottwarecontrol\printer.cpp + "printer.h" + +1512587611 h:\munkák\plotter\plottwarecontrol\printer.h + + + "serial.h" + "json.hpp" + "point.h" + +1512587577 source:h:\munkák\plotter\plottwarecontrol\serial.cpp + "serial.h" + +1512214902 h:\munkák\plotter\plottwarecontrol\serial.h + + + + +1512580539 source:h:\munkák\plotter\plottwarecontrol\settingdialog.cpp + "SettingDialog.h" + + "printer.h" + +1512577897 h:\munkák\plotter\plottwarecontrol\settingdialog.h + + + "settings.h" + "PlottWareControlMain.h" + + + + + + + + + + + + +1493467238 d:\wxwidgets-3.0.3\include\wx\statbox.h + "wx/defs.h" + "wx/control.h" + "wx/containr.h" + "wx/univ/statbox.h" + "wx/msw/statbox.h" + "wx/motif/statbox.h" + "wx/gtk/statbox.h" + "wx/gtk1/statbox.h" + "wx/osx/statbox.h" + "wx/cocoa/statbox.h" + "wx/os2/statbox.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\statbox.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\statbox.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\statbox.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\statbox.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\statbox.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\statbox.h + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\statbox.h + "wx/cocoa/NSBox.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\nsbox.h + "wx/hashmap.h" + "wx/cocoa/ObjcAssociate.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\statbox.h + "wx/control.h" + +1511980135 source:h:\munkák\plotter\plottwarecontrol\settings.cpp + "settings.h" + +1511979879 h:\munkák\plotter\plottwarecontrol\settings.h + + "printer.h" + +1511986981 source:h:\munkák\plotter\plottwarecontrol\image.cpp + "image.h" + +1511963875 h:\munkák\plotter\plottwarecontrol\image.h + + + "point.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\opencv.hpp + "opencv2/opencv_modules.hpp" + "opencv2/core.hpp" + "opencv2/calib3d.hpp" + "opencv2/features2d.hpp" + "opencv2/flann.hpp" + "opencv2/highgui.hpp" + "opencv2/imgcodecs.hpp" + "opencv2/imgproc.hpp" + "opencv2/ml.hpp" + "opencv2/objdetect.hpp" + "opencv2/photo.hpp" + "opencv2/shape.hpp" + "opencv2/stitching.hpp" + "opencv2/superres.hpp" + "opencv2/video.hpp" + "opencv2/videoio.hpp" + "opencv2/videostab.hpp" + "opencv2/viz.hpp" + "opencv2/cudaarithm.hpp" + "opencv2/cudabgsegm.hpp" + "opencv2/cudacodec.hpp" + "opencv2/cudafeatures2d.hpp" + "opencv2/cudafilters.hpp" + "opencv2/cudaimgproc.hpp" + "opencv2/cudaobjdetect.hpp" + "opencv2/cudaoptflow.hpp" + "opencv2/cudastereo.hpp" + "opencv2/cudawarping.hpp" + +1508852498 d:\opencv-3.3.1\build\include\opencv2\opencv_modules.hpp + +1507248161 d:\opencv-3.3.1\build\include\opencv2\core.hpp + "opencv2/core/cvdef.h" + "opencv2/core/version.hpp" + "opencv2/core/base.hpp" + "opencv2/core/cvstd.hpp" + "opencv2/core/traits.hpp" + "opencv2/core/matx.hpp" + "opencv2/core/types.hpp" + "opencv2/core/mat.hpp" + "opencv2/core/persistence.hpp" + "opencv2/opencv.hpp" + "opencv2/xfeatures2d.hpp" + "opencv2/core/operations.hpp" + "opencv2/core/cvstd.inl.hpp" + "opencv2/core/utility.hpp" + "opencv2/core/optim.hpp" + "opencv2/core/ovx.hpp" + +1507766554 d:\opencv-3.3.1\build\include\opencv2\core\cvdef.h + "cvconfig.h" + + "opencv2/core/hal/interface.h" + "cv_cpu_dispatch.h" + + + +1485936064 d:\opencv-3.3.1\build\include\opencv2\core\hal\interface.h + + + + + + +1507766554 d:\opencv-3.3.1\build\include\opencv2\core\cv_cpu_dispatch.h + "cv_cpu_config.h" + "cv_cpu_helper.h" + + + + + + + + + + + + + + + + + + + + + + +1507766554 d:\opencv-3.3.1\build\include\opencv2\core\cv_cpu_helper.h + +1508852467 d:\opencv-3.3.1\build\include\opencv2\core\version.hpp + +1507766554 d:\opencv-3.3.1\build\include\opencv2\core\base.hpp + "opencv2/opencv_modules.hpp" + + + "opencv2/core/cvdef.h" + "opencv2/core/cvstd.hpp" + "opencv2/core/neon_utils.hpp" + "opencv2/core/vsx_utils.hpp" + +1503103303 d:\opencv-3.3.1\build\include\opencv2\core\cvstd.hpp + "opencv2/core/cvdef.h" + + + + + + + + + "opencv2/core/ptr.inl.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\core\ptr.inl.hpp + + +1485936064 d:\opencv-3.3.1\build\include\opencv2\core\neon_utils.hpp + "opencv2/core/cvdef.h" + +1507766554 d:\opencv-3.3.1\build\include\opencv2\core\vsx_utils.hpp + "opencv2/core/cvdef.h" + +1504828918 d:\opencv-3.3.1\build\include\opencv2\core\traits.hpp + "opencv2/core/cvdef.h" + +1504828918 d:\opencv-3.3.1\build\include\opencv2\core\matx.hpp + "opencv2/core/cvdef.h" + "opencv2/core/base.hpp" + "opencv2/core/traits.hpp" + "opencv2/core/saturate.hpp" + + +1485936064 d:\opencv-3.3.1\build\include\opencv2\core\saturate.hpp + "opencv2/core/cvdef.h" + "opencv2/core/fast_math.hpp" + +1498377995 d:\opencv-3.3.1\build\include\opencv2\core\fast_math.hpp + "opencv2/core/cvdef.h" + + + + + "tegra_round.hpp" + +1504828918 d:\opencv-3.3.1\build\include\opencv2\core\types.hpp + + + + + "opencv2/core/cvdef.h" + "opencv2/core/cvstd.hpp" + "opencv2/core/matx.hpp" + +1508371369 d:\opencv-3.3.1\build\include\opencv2\core\mat.hpp + "opencv2/core/matx.hpp" + "opencv2/core/types.hpp" + "opencv2/core/bufferpool.hpp" + + "opencv2/core/mat.inl.hpp" + +1500192485 d:\opencv-3.3.1\build\include\opencv2\core\bufferpool.hpp + +1507766554 d:\opencv-3.3.1\build\include\opencv2\core\mat.inl.hpp + +1504828918 d:\opencv-3.3.1\build\include\opencv2\core\persistence.hpp + "opencv2/core/types.hpp" + "opencv2/core/mat.hpp" + "opencv2/opencv.hpp" + + +1488528035 d:\opencv-3.3.1\build\include\opencv2\core\operations.hpp + + +1504828918 d:\opencv-3.3.1\build\include\opencv2\core\cvstd.inl.hpp + + + +1503535065 d:\opencv-3.3.1\build\include\opencv2\core\utility.hpp + "opencv2/core.hpp" + + + "opencv2/core/core_c.h" + +1487750452 d:\opencv-3.3.1\build\include\opencv2\core\core_c.h + "opencv2/core/types_c.h" + "cxcore.h" + "cxcore.h" + "opencv2/core/utility.hpp" + +1501230010 d:\opencv-3.3.1\build\include\opencv2\core\types_c.h + + + "opencv2/core/cvdef.h" + + + + + "opencv2/core.hpp" + +1491292860 d:\opencv-3.3.1\build\include\opencv2\core\optim.hpp + "opencv2/core.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\core\ovx.hpp + "cvdef.h" + +1507248161 d:\opencv-3.3.1\build\include\opencv2\calib3d.hpp + "opencv2/core.hpp" + "opencv2/features2d.hpp" + "opencv2/core/affine.hpp" + "opencv2/calib3d/calib3d_c.h" + +1508371369 d:\opencv-3.3.1\build\include\opencv2\features2d.hpp + "opencv2/opencv_modules.hpp" + "opencv2/core.hpp" + "opencv2/flann/miniflann.hpp" + +1505088171 d:\opencv-3.3.1\build\include\opencv2\flann\miniflann.hpp + "opencv2/core.hpp" + "opencv2/flann/defines.h" + +1501230010 d:\opencv-3.3.1\build\include\opencv2\flann\defines.h + "config.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\config.h + +1504828918 d:\opencv-3.3.1\build\include\opencv2\core\affine.hpp + + +1504051339 d:\opencv-3.3.1\build\include\opencv2\calib3d\calib3d_c.h + "opencv2/core/core_c.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann.hpp + "opencv2/core.hpp" + "opencv2/flann/miniflann.hpp" + "opencv2/flann/flann_base.hpp" + +1505088171 d:\opencv-3.3.1\build\include\opencv2\flann\flann_base.hpp + + + + "general.h" + "matrix.h" + "params.h" + "saving.h" + "all_indices.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\general.h + "opencv2/core.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\matrix.h + + "general.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\params.h + "any.h" + "general.h" + + + +1497772952 d:\opencv-3.3.1\build\include\opencv2\flann\any.h + "defines.h" + + + + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\saving.h + + + "general.h" + "nn_index.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\nn_index.h + "general.h" + "matrix.h" + "result_set.h" + "params.h" + +1498637243 d:\opencv-3.3.1\build\include\opencv2\flann\result_set.h + + + + + + + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\all_indices.h + "general.h" + "nn_index.h" + "kdtree_index.h" + "kdtree_single_index.h" + "kmeans_index.h" + "composite_index.h" + "linear_index.h" + "hierarchical_clustering_index.h" + "lsh_index.h" + "autotuned_index.h" + +1488873689 d:\opencv-3.3.1\build\include\opencv2\flann\kdtree_index.h + + + + + "general.h" + "nn_index.h" + "dynamic_bitset.h" + "matrix.h" + "result_set.h" + "heap.h" + "allocator.h" + "random.h" + "saving.h" + +1498637243 d:\opencv-3.3.1\build\include\opencv2\flann\dynamic_bitset.h + + + "dist.h" + +1501230010 d:\opencv-3.3.1\build\include\opencv2\flann\dist.h + + + + + "defines.h" + + "arm_neon.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\heap.h + + + +1505088171 d:\opencv-3.3.1\build\include\opencv2\flann\allocator.h + + + +1488873689 d:\opencv-3.3.1\build\include\opencv2\flann\random.h + + + + "general.h" + +1498637243 d:\opencv-3.3.1\build\include\opencv2\flann\kdtree_single_index.h + + + + + "general.h" + "nn_index.h" + "matrix.h" + "result_set.h" + "heap.h" + "allocator.h" + "random.h" + "saving.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\kmeans_index.h + + + + + + "general.h" + "nn_index.h" + "dist.h" + "matrix.h" + "result_set.h" + "heap.h" + "allocator.h" + "random.h" + "saving.h" + "logger.h" + +1498637243 d:\opencv-3.3.1\build\include\opencv2\flann\logger.h + + + "defines.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\composite_index.h + "general.h" + "nn_index.h" + "kdtree_index.h" + "kmeans_index.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\linear_index.h + "general.h" + "nn_index.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\hierarchical_clustering_index.h + + + + + + "general.h" + "nn_index.h" + "dist.h" + "matrix.h" + "result_set.h" + "heap.h" + "allocator.h" + "random.h" + "saving.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\lsh_index.h + + + + + + "general.h" + "nn_index.h" + "matrix.h" + "result_set.h" + "heap.h" + "lsh_table.h" + "allocator.h" + "random.h" + "saving.h" + +1504224386 d:\opencv-3.3.1\build\include\opencv2\flann\lsh_table.h + + + + + + + + + "dynamic_bitset.h" + "matrix.h" + +1498637243 d:\opencv-3.3.1\build\include\opencv2\flann\autotuned_index.h + + "general.h" + "nn_index.h" + "ground_truth.h" + "index_testing.h" + "sampling.h" + "kdtree_index.h" + "kdtree_single_index.h" + "kmeans_index.h" + "composite_index.h" + "linear_index.h" + "logger.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\ground_truth.h + "dist.h" + "matrix.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\index_testing.h + + + + "matrix.h" + "nn_index.h" + "result_set.h" + "logger.h" + "timer.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\timer.h + + "opencv2/core.hpp" + "opencv2/core/utility.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\flann\sampling.h + "matrix.h" + "random.h" + +1504051339 d:\opencv-3.3.1\build\include\opencv2\highgui.hpp + "opencv2/core.hpp" + "opencv2/imgcodecs.hpp" + "opencv2/videoio.hpp" + "opencv2/highgui/highgui_c.h" + +1504915316 d:\opencv-3.3.1\build\include\opencv2\imgcodecs.hpp + "opencv2/core.hpp" + + +1501834877 d:\opencv-3.3.1\build\include\opencv2\videoio.hpp + "opencv2/core.hpp" + +1501230010 d:\opencv-3.3.1\build\include\opencv2\highgui\highgui_c.h + "opencv2/core/core_c.h" + "opencv2/imgproc/imgproc_c.h" + "opencv2/imgcodecs/imgcodecs_c.h" + "opencv2/videoio/videoio_c.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\imgproc\imgproc_c.h + "opencv2/imgproc/types_c.h" + +1490428879 d:\opencv-3.3.1\build\include\opencv2\imgproc\types_c.h + "opencv2/core/core_c.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\imgcodecs\imgcodecs_c.h + "opencv2/core/core_c.h" + +1498550533 d:\opencv-3.3.1\build\include\opencv2\videoio\videoio_c.h + "opencv2/core/core_c.h" + +1507766554 d:\opencv-3.3.1\build\include\opencv2\imgproc.hpp + "opencv2/core.hpp" + + + + + + + + + + + + + "opencv2/imgproc.hpp" + "opencv2/highgui.hpp" + "opencv2/imgproc/imgproc_c.h" + +1490428879 d:\opencv-3.3.1\build\include\opencv2\ml.hpp + "opencv2/core.hpp" + + + + +1507248162 d:\opencv-3.3.1\build\include\opencv2\objdetect.hpp + "opencv2/core.hpp" + "opencv2/objdetect/detection_based_tracker.hpp" + "opencv2/objdetect/objdetect_c.h" + +1504828918 d:\opencv-3.3.1\build\include\opencv2\objdetect\detection_based_tracker.hpp + + + +1498982957 d:\opencv-3.3.1\build\include\opencv2\objdetect\objdetect_c.h + "opencv2/core/core_c.h" + + + +1501834877 d:\opencv-3.3.1\build\include\opencv2\photo.hpp + "opencv2/core.hpp" + "opencv2/imgproc.hpp" + "opencv2/photo/photo_c.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\photo\photo_c.h + "opencv2/core/core_c.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\shape.hpp + "opencv2/shape/emdL1.hpp" + "opencv2/shape/shape_transformer.hpp" + "opencv2/shape/hist_cost.hpp" + "opencv2/shape/shape_distance.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\shape\emdl1.hpp + "opencv2/core.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\shape\shape_transformer.hpp + + "opencv2/core.hpp" + "opencv2/imgproc.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\shape\hist_cost.hpp + "opencv2/imgproc.hpp" + +1501834877 d:\opencv-3.3.1\build\include\opencv2\shape\shape_distance.hpp + "opencv2/core.hpp" + "opencv2/shape/hist_cost.hpp" + "opencv2/shape/shape_transformer.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\stitching.hpp + "opencv2/core.hpp" + "opencv2/features2d.hpp" + "opencv2/stitching/warpers.hpp" + "opencv2/stitching/detail/matchers.hpp" + "opencv2/stitching/detail/motion_estimators.hpp" + "opencv2/stitching/detail/exposure_compensate.hpp" + "opencv2/stitching/detail/seam_finders.hpp" + "opencv2/stitching/detail/blenders.hpp" + "opencv2/stitching/detail/camera.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\stitching\warpers.hpp + "opencv2/stitching/detail/warpers.hpp" + +1499242074 d:\opencv-3.3.1\build\include\opencv2\stitching\detail\warpers.hpp + "opencv2/core.hpp" + "opencv2/core/cuda.hpp" + "opencv2/imgproc.hpp" + "opencv2/opencv_modules.hpp" + "warpers_inl.hpp" + +1495699319 d:\opencv-3.3.1\build\include\opencv2\core\cuda.hpp + "opencv2/core.hpp" + "opencv2/core/cuda_types.hpp" + "opencv2/core/cuda.inl.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\core\cuda_types.hpp + +1485936064 d:\opencv-3.3.1\build\include\opencv2\core\cuda.inl.hpp + "opencv2/core/cuda.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\stitching\detail\warpers_inl.hpp + "opencv2/core.hpp" + "warpers.hpp" + + +1505088171 d:\opencv-3.3.1\build\include\opencv2\stitching\detail\matchers.hpp + "opencv2/core.hpp" + "opencv2/features2d.hpp" + "opencv2/opencv_modules.hpp" + "opencv2/xfeatures2d/cuda.hpp" + +1499242074 d:\opencv-3.3.1\build\include\opencv2\stitching\detail\motion_estimators.hpp + "opencv2/core.hpp" + "matchers.hpp" + "util.hpp" + "camera.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\stitching\detail\util.hpp + + "opencv2/core.hpp" + "util_inl.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\stitching\detail\util_inl.hpp + + "opencv2/core.hpp" + "util.hpp" + +1505088171 d:\opencv-3.3.1\build\include\opencv2\stitching\detail\camera.hpp + "opencv2/core.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\stitching\detail\exposure_compensate.hpp + "opencv2/core.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\stitching\detail\seam_finders.hpp + + "opencv2/core.hpp" + "opencv2/opencv_modules.hpp" + +1487404857 d:\opencv-3.3.1\build\include\opencv2\stitching\detail\blenders.hpp + "opencv2/core.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\superres.hpp + "opencv2/core.hpp" + "opencv2/superres/optical_flow.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\superres\optical_flow.hpp + "opencv2/core.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\video.hpp + "opencv2/video/tracking.hpp" + "opencv2/video/background_segm.hpp" + "opencv2/video/tracking_c.h" + +1501834877 d:\opencv-3.3.1\build\include\opencv2\video\tracking.hpp + "opencv2/core.hpp" + "opencv2/imgproc.hpp" + +1495699319 d:\opencv-3.3.1\build\include\opencv2\video\background_segm.hpp + "opencv2/core.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\video\tracking_c.h + "opencv2/imgproc/types_c.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\videostab.hpp + "opencv2/videostab/stabilizer.hpp" + "opencv2/videostab/ring_buffer.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\videostab\stabilizer.hpp + + + "opencv2/core.hpp" + "opencv2/imgproc.hpp" + "opencv2/videostab/global_motion.hpp" + "opencv2/videostab/motion_stabilizing.hpp" + "opencv2/videostab/frame_source.hpp" + "opencv2/videostab/log.hpp" + "opencv2/videostab/inpainting.hpp" + "opencv2/videostab/deblurring.hpp" + "opencv2/videostab/wobble_suppression.hpp" + +1492243299 d:\opencv-3.3.1\build\include\opencv2\videostab\global_motion.hpp + + + "opencv2/core.hpp" + "opencv2/features2d.hpp" + "opencv2/opencv_modules.hpp" + "opencv2/videostab/optical_flow.hpp" + "opencv2/videostab/motion_core.hpp" + "opencv2/videostab/outlier_rejection.hpp" + "opencv2/cudaimgproc.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\videostab\optical_flow.hpp + "opencv2/core.hpp" + "opencv2/opencv_modules.hpp" + "opencv2/cudaoptflow.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\videostab\motion_core.hpp + + "opencv2/core.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\videostab\outlier_rejection.hpp + + "opencv2/core.hpp" + "opencv2/videostab/motion_core.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\videostab\motion_stabilizing.hpp + + + "opencv2/core.hpp" + "opencv2/videostab/global_motion.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\videostab\frame_source.hpp + + "opencv2/core.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\videostab\log.hpp + "opencv2/core.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\videostab\inpainting.hpp + + "opencv2/core.hpp" + "opencv2/videostab/optical_flow.hpp" + "opencv2/videostab/fast_marching.hpp" + "opencv2/videostab/global_motion.hpp" + "opencv2/photo.hpp" + +1498637243 d:\opencv-3.3.1\build\include\opencv2\videostab\fast_marching.hpp + + + + "opencv2/core.hpp" + "fast_marching_inl.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\videostab\fast_marching_inl.hpp + "opencv2/videostab/fast_marching.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\videostab\deblurring.hpp + + "opencv2/core.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\videostab\wobble_suppression.hpp + + "opencv2/core.hpp" + "opencv2/core/cuda.hpp" + "opencv2/videostab/global_motion.hpp" + "opencv2/videostab/log.hpp" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\videostab\ring_buffer.hpp + + "opencv2/imgproc.hpp" + +1511700978 h:\munkák\plotter\plottwarecontrol\point.h + +1512587823 h:\munkák\plotter\plottwarecontrol\project.h + + + + + + + + "image.h" + "settings.h" + "imageViewer.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\core\core.hpp + "opencv2/core.hpp" + +1493467238 d:\wxwidgets-3.0.3\include\wx\filedlg.h + "wx/defs.h" + "wx/dialog.h" + "wx/arrstr.h" + "wx/generic/filedlgg.h" + "wx/msw/filedlg.h" + "wx/motif/filedlg.h" + "wx/gtk/filedlg.h" + "wx/gtk1/filedlg.h" + "wx/osx/filedlg.h" + "wx/cocoa/filedlg.h" + "wx/os2/filedlg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\filedlgg.h + "wx/listctrl.h" + "wx/datetime.h" + "wx/filefn.h" + "wx/artprov.h" + "wx/filedlg.h" + "wx/generic/filectrlg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\listctrl.h + "wx/defs.h" + "wx/listbase.h" + "wx/msw/listctrl.h" + "wx/osx/listctrl.h" + "wx/generic/listctrl.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\listbase.h + "wx/colour.h" + "wx/font.h" + "wx/gdicmn.h" + "wx/event.h" + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\listctrl.h + "wx/textctrl.h" + "wx/dynarray.h" + "wx/vector.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\listctrl.h + "wx/defs.h" + "wx/generic/listctrl.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\listctrl.h + "wx/containr.h" + "wx/scrolwin.h" + "wx/textctrl.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\artprov.h + "wx/string.h" + "wx/bitmap.h" + "wx/icon.h" + "wx/iconbndl.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\filectrlg.h + "wx/containr.h" + "wx/listctrl.h" + "wx/filectrl.h" + "wx/filename.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\filectrl.h + "wx/defs.h" + "wx/string.h" + "wx/event.h" + "wx/gtk/filectrl.h" + "wx/generic/filectrlg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\filectrl.h + "wx/control.h" + "wx/filectrl.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\filename.h + "wx/arrstr.h" + "wx/filefn.h" + "wx/datetime.h" + "wx/intl.h" + "wx/longlong.h" + "wx/file.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\file.h + "wx/defs.h" + "wx/string.h" + "wx/filefn.h" + "wx/convauto.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\convauto.h + "wx/strconv.h" + "wx/fontenc.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\filedlg.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\filedlg.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\filedlg.h + "wx/gtk/filectrl.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\filedlg.h + "wx/generic/filedlgg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\filedlg.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\filedlg.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\filedlg.h + +1511701372 source:h:\munkák\plotter\plottwarecontrol\point.cpp + "point.h" + +1485936064 d:\opencv-3.3.1\build\include\opencv2\imgproc\imgproc.hpp + "opencv2/imgproc.hpp" + +1511989067 source:h:\munkák\plotter\plottwarecontrol\project.cpp + "project.h" + +1511805653 source:h:\munkák\plotter\plottwarecontrol\imageviewer.cpp + "imageViewer.h" + +1511805672 h:\munkák\plotter\plottwarecontrol\imageviewer.h + + + + + +1511986160 source:h:\munkák\plotter\plottwarecontrol\gcodeeditordialog.cpp + "GcodeEditorDialog.h" + + + + + +1511985955 h:\munkák\plotter\plottwarecontrol\gcodeeditordialog.h + + + + + + +1493467238 d:\wxwidgets-3.0.3\include\wx\notebook.h + "wx/defs.h" + "wx/bookctrl.h" + "wx/univ/notebook.h" + "wx/msw/notebook.h" + "wx/generic/notebook.h" + "wx/gtk/notebook.h" + "wx/gtk1/notebook.h" + "wx/osx/notebook.h" + "wx/cocoa/notebook.h" + "wx/os2/notebook.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\bookctrl.h + "wx/defs.h" + "wx/control.h" + "wx/dynarray.h" + "wx/withimages.h" + "wx/notebook.h" + "wx/choicebk.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\withimages.h + "wx/defs.h" + "wx/icon.h" + "wx/imaglist.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\choicebk.h + "wx/defs.h" + "wx/bookctrl.h" + "wx/choice.h" + "wx/containr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\notebook.h + "wx/arrstr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\notebook.h + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\notebook.h + "wx/event.h" + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\notebook.h + "wx/list.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\notebook.h + "wx/list.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\notebook.h + "wx/event.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\notebook.h + "wx/cocoa/NSTabView.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\nstabview.h + "wx/hashmap.h" + "wx/cocoa/ObjcAssociate.h" + "wx/cocoa/ObjcRef.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\notebook.h + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\wxprec.h + "wx/defs.h" + "wx/chartype.h" + "wx/msw/wrapwin.h" + "wx/msw/private.h" + "wx/msw/wrapcctl.h" + "wx/msw/wrapcdlg.h" + "wx/msw/missing.h" + "wx/os2/private.h" + "wx/wx.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wrapcctl.h + "wx/msw/wrapwin.h" + + "wx/msw/missing.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\missing.h + + "wx/msw/winundef.h" + "wx/msw/wince/missing.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wince\missing.h + "wx/msw/private.h" + "shellapi.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\wrapcdlg.h + "wx/defs.h" + "wx/msw/wrapwin.h" + "wx/msw/private.h" + "wx/msw/missing.h" + + "wx/msw/winundef.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\wx.h + "wx/defs.h" + "wx/object.h" + "wx/dynarray.h" + "wx/list.h" + "wx/hash.h" + "wx/string.h" + "wx/hashmap.h" + "wx/arrstr.h" + "wx/intl.h" + "wx/log.h" + "wx/event.h" + "wx/app.h" + "wx/utils.h" + "wx/stream.h" + "wx/memory.h" + "wx/math.h" + "wx/stopwatch.h" + "wx/timer.h" + "wx/module.h" + "wx/wxcrt.h" + "wx/wxcrtvararg.h" + "wx/window.h" + "wx/containr.h" + "wx/panel.h" + "wx/toplevel.h" + "wx/frame.h" + "wx/gdicmn.h" + "wx/gdiobj.h" + "wx/region.h" + "wx/bitmap.h" + "wx/image.h" + "wx/colour.h" + "wx/font.h" + "wx/dc.h" + "wx/dcclient.h" + "wx/dcmemory.h" + "wx/dcprint.h" + "wx/dcscreen.h" + "wx/button.h" + "wx/menuitem.h" + "wx/menu.h" + "wx/pen.h" + "wx/brush.h" + "wx/palette.h" + "wx/icon.h" + "wx/cursor.h" + "wx/dialog.h" + "wx/settings.h" + "wx/msgdlg.h" + "wx/dataobj.h" + "wx/control.h" + "wx/ctrlsub.h" + "wx/bmpbuttn.h" + "wx/checkbox.h" + "wx/checklst.h" + "wx/choice.h" + "wx/scrolbar.h" + "wx/stattext.h" + "wx/statbmp.h" + "wx/statbox.h" + "wx/listbox.h" + "wx/radiobox.h" + "wx/radiobut.h" + "wx/textctrl.h" + "wx/slider.h" + "wx/gauge.h" + "wx/scrolwin.h" + "wx/dirdlg.h" + "wx/toolbar.h" + "wx/combobox.h" + "wx/layout.h" + "wx/sizer.h" + "wx/statusbr.h" + "wx/choicdlg.h" + "wx/textdlg.h" + "wx/filedlg.h" + "wx/mdi.h" + "wx/validate.h" + "wx/valtext.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\module.h + "wx/object.h" + "wx/list.h" + "wx/arrstr.h" + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dcprint.h + "wx/defs.h" + "wx/dc.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dcscreen.h + "wx/defs.h" + "wx/dc.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\dataobj.h + "wx/defs.h" + "wx/string.h" + "wx/bitmap.h" + "wx/list.h" + "wx/arrstr.h" + "wx/msw/ole/dataform.h" + "wx/motif/dataform.h" + "wx/gtk/dataform.h" + "wx/gtk1/dataform.h" + "wx/x11/dataform.h" + "wx/osx/dataform.h" + "wx/cocoa/dataform.h" + "wx/os2/dataform.h" + "wx/msw/ole/dataobj.h" + "wx/motif/dataobj.h" + "wx/x11/dataobj.h" + "wx/gtk/dataobj.h" + "wx/gtk1/dataobj.h" + "wx/osx/dataobj.h" + "wx/cocoa/dataobj.h" + "wx/os2/dataobj.h" + "wx/msw/ole/dataobj2.h" + "wx/gtk/dataobj2.h" + "wx/gtk1/dataobj2.h" + "wx/x11/dataobj2.h" + "wx/motif/dataobj2.h" + "wx/osx/dataobj2.h" + "wx/cocoa/dataobj2.h" + "wx/os2/dataobj2.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\ole\dataform.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\dataform.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\dataform.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\dataform.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\dataform.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\dataform.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\dataform.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\dataform.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\ole\dataobj.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\dataobj.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\dataobj.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\dataobj.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\dataobj.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\dataobj.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\dataobj.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\dataobj.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\ole\dataobj2.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\dataobj2.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\dataobj2.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\x11\dataobj2.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\dataobj2.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\dataobj2.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\dataobj2.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\dataobj2.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\bmpbuttn.h + "wx/defs.h" + "wx/button.h" + "wx/univ/bmpbuttn.h" + "wx/msw/bmpbuttn.h" + "wx/motif/bmpbuttn.h" + "wx/gtk/bmpbuttn.h" + "wx/gtk1/bmpbuttn.h" + "wx/osx/bmpbuttn.h" + "wx/cocoa/bmpbuttn.h" + "wx/os2/bmpbuttn.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\bmpbuttn.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\bmpbuttn.h + "wx/button.h" + "wx/bitmap.h" + "wx/brush.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\bmpbuttn.h + "wx/motif/bmpmotif.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\bmpmotif.h + "wx/defs.h" + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\bmpbuttn.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\bmpbuttn.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\bmpbuttn.h + "wx/button.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\bmpbuttn.h + "wx/cocoa/NSButton.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\bmpbuttn.h + "wx/button.h" + "wx/dcclient.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\scrolbar.h + "wx/defs.h" + "wx/control.h" + "wx/univ/scrolbar.h" + "wx/msw/scrolbar.h" + "wx/motif/scrolbar.h" + "wx/gtk/scrolbar.h" + "wx/gtk1/scrolbar.h" + "wx/osx/scrolbar.h" + "wx/cocoa/scrolbar.h" + "wx/os2/scrolbar.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\scrolbar.h + "wx/univ/scrarrow.h" + "wx/renderer.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\scrolbar.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\scrolbar.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\scrolbar.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\scrolbar.h + "wx/defs.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\scrolbar.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\scrolbar.h + "wx/cocoa/NSScroller.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\nsscroller.h + "wx/hashmap.h" + "wx/cocoa/ObjcAssociate.h" + "wx/cocoa/ObjcRef.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\scrolbar.h + "wx/scrolbar.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\statbmp.h + "wx/defs.h" + "wx/control.h" + "wx/bitmap.h" + "wx/icon.h" + "wx/univ/statbmp.h" + "wx/msw/statbmp.h" + "wx/motif/statbmp.h" + "wx/gtk/statbmp.h" + "wx/gtk1/statbmp.h" + "wx/osx/statbmp.h" + "wx/cocoa/statbmp.h" + "wx/os2/statbmp.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\statbmp.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\statbmp.h + "wx/control.h" + "wx/icon.h" + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\statbmp.h + "wx/motif/bmpmotif.h" + "wx/icon.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\statbmp.h + "wx/icon.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\statbmp.h + "wx/icon.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\statbmp.h + "wx/osx/carbon/statbmp.h" + "wx/generic/statbmpg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\carbon\statbmp.h + "wx/icon.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\statbmpg.h + "wx/statbmp.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\statbmp.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\statbmp.h + "wx/control.h" + "wx/icon.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\radiobox.h + "wx/defs.h" + "wx/ctrlsub.h" + "wx/dynarray.h" + "wx/univ/radiobox.h" + "wx/msw/radiobox.h" + "wx/motif/radiobox.h" + "wx/gtk/radiobox.h" + "wx/gtk1/radiobox.h" + "wx/osx/radiobox.h" + "wx/cocoa/radiobox.h" + "wx/os2/radiobox.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\radiobox.h + "wx/statbox.h" + "wx/dynarray.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\radiobox.h + "wx/statbox.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\radiobox.h + "wx/dynarray.h" + "wx/arrstr.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\radiobox.h + "wx/bitmap.h" + "wx/list.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\radiobox.h + "wx/bitmap.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\radiobox.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\radiobox.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\radiobox.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gauge.h + "wx/defs.h" + "wx/control.h" + "wx/univ/gauge.h" + "wx/msw/gauge.h" + "wx/motif/gauge.h" + "wx/gtk/gauge.h" + "wx/gtk1/gauge.h" + "wx/osx/gauge.h" + "wx/cocoa/gauge.h" + "wx/os2/gauge.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\univ\gauge.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\gauge.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\motif\gauge.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\gauge.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\gauge.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\gauge.h + "wx/control.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\gauge.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\os2\gauge.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\dirdlg.h + "wx/defs.h" + "wx/dialog.h" + "wx/generic/dirdlgg.h" + "wx/generic/dirdlgg.h" + "wx/generic/dirdlgg.h" + "wx/msw/dirdlg.h" + "wx/gtk/dirdlg.h" + "wx/generic/dirdlgg.h" + "wx/osx/dirdlg.h" + "wx/cocoa/dirdlg.h" + "wx/generic/dirdlgg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\dirdlgg.h + "wx/dialog.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\dirdlg.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\dirdlg.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\dirdlg.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\dirdlg.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\layout.h + "wx/object.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\sizer.h + "wx/defs.h" + "wx/window.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\choicdlg.h + "wx/defs.h" + "wx/generic/choicdgg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\choicdgg.h + "wx/dynarray.h" + "wx/dialog.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\textdlg.h + "wx/generic/textdlgg.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\textdlgg.h + "wx/defs.h" + "wx/dialog.h" + "wx/valtext.h" + "wx/textctrl.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\valtext.h + "wx/defs.h" + "wx/validate.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\mdi.h + "wx/defs.h" + "wx/frame.h" + "wx/menu.h" + "wx/generic/mdig.h" + "wx/msw/mdi.h" + "wx/gtk/mdi.h" + "wx/gtk1/mdi.h" + "wx/osx/mdi.h" + "wx/cocoa/mdi.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\generic\mdig.h + "wx/panel.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\msw\mdi.h + "wx/frame.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk\mdi.h + "wx/frame.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\gtk1\mdi.h + "wx/frame.h" + +1493467238 d:\wxwidgets-3.0.3\include\wx\osx\mdi.h + +1493467238 d:\wxwidgets-3.0.3\include\wx\cocoa\mdi.h + "wx/frame.h" + +1512580455 h:\munkák\plotter\plottwarecontrol\json.hpp + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PlottWareControl/PlottWareControl.layout b/PlottWareControl/PlottWareControl.layout new file mode 100644 index 0000000..e634aaf --- /dev/null +++ b/PlottWareControl/PlottWareControl.layout @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PlottWareControl/PlottWareControlApp.cpp b/PlottWareControl/PlottWareControlApp.cpp new file mode 100644 index 0000000..2d4110f --- /dev/null +++ b/PlottWareControl/PlottWareControlApp.cpp @@ -0,0 +1,33 @@ +/*************************************************************** + * Name: PlottWareControlApp.cpp + * Purpose: Code for Application Class + * Author: Fandly Gergo (fandlygergo@gmail.hu) + * Created: 2017-11-25 + * Copyright: Fandly Gergo (systemtest.tk) + * License: + **************************************************************/ + +#include "PlottWareControlApp.h" + +//(*AppHeaders +#include "PlottWareControlMain.h" +#include +//*) + +IMPLEMENT_APP(PlottWareControlApp); + +bool PlottWareControlApp::OnInit() +{ + //(*AppInitialize + bool wxsOK = true; + wxInitAllImageHandlers(); + if ( wxsOK ) + { + PlottWareControlFrame* Frame = new PlottWareControlFrame(0); + Frame->Show(); + SetTopWindow(Frame); + } + //*) + return wxsOK; + +} diff --git a/PlottWareControl/PlottWareControlApp.h b/PlottWareControl/PlottWareControlApp.h new file mode 100644 index 0000000..2ba14eb --- /dev/null +++ b/PlottWareControl/PlottWareControlApp.h @@ -0,0 +1,21 @@ +/*************************************************************** + * Name: PlottWareControlApp.h + * Purpose: Defines Application Class + * Author: Fandly Gergo (fandlygergo@gmail.hu) + * Created: 2017-11-25 + * Copyright: Fandly Gergo (systemtest.tk) + * License: + **************************************************************/ + +#ifndef PLOTTWARECONTROLAPP_H +#define PLOTTWARECONTROLAPP_H + +#include + +class PlottWareControlApp : public wxApp +{ + public: + virtual bool OnInit(); +}; + +#endif // PLOTTWARECONTROLAPP_H diff --git a/PlottWareControl/PlottWareControlMain.cpp b/PlottWareControl/PlottWareControlMain.cpp new file mode 100644 index 0000000..3e53b38 --- /dev/null +++ b/PlottWareControl/PlottWareControlMain.cpp @@ -0,0 +1,1029 @@ +/*************************************************************************** + * Name: PlottWareControlMain.cpp + * Purpose: Code for Application Frame + * Author: Fandly Gergo (fandlygergo@gmail.hu) + * Created: 2017-11-25 + * Copyright: Copyright (C) 2017 Fandly Gergo (systemtest.tk) + * License: + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + **************************************************************************/ + +#include "PlottWareControlMain.h" +#include +#include +#include "version.h" +#include "SettingDialog.h" +#include "imageViewer.h" +#include "GcodeEditorDialog.h" + +//(*InternalHeaders(PlottWareControlFrame) +#include +#include +#include +#include +#include +#include +#include +//*) + +//helper functions +enum wxbuildinfoformat { + short_f, long_f }; + +wxString wxbuildinfo(wxbuildinfoformat format) +{ + wxString wxbuild(wxVERSION_STRING); + + if (format == long_f ) + { +#if defined(__WXMSW__) + wxbuild << _T("-Windows"); +#elif defined(__UNIX__) + wxbuild << _T("-Linux"); +#endif + +#if wxUSE_UNICODE + wxbuild << _T("-Unicode build"); +#else + wxbuild << _T("-ANSI build"); +#endif // wxUSE_UNICODE + } + + return wxbuild; +} + +//(*IdInit(PlottWareControlFrame) +const long PlottWareControlFrame::ID_BUTTON1 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT1 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON2 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON3 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON4 = wxNewId(); +const long PlottWareControlFrame::ID_PANEL2 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT2 = wxNewId(); +const long PlottWareControlFrame::ID_LISTBOX1 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON5 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON6 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON9 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON23 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON24 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT25 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT26 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT27 = wxNewId(); +const long PlottWareControlFrame::ID_TEXTCTRL2 = wxNewId(); +const long PlottWareControlFrame::ID_SPINCTRL1 = wxNewId(); +const long PlottWareControlFrame::ID_SPINCTRL2 = wxNewId(); +const long PlottWareControlFrame::ID_SPINCTRL3 = wxNewId(); +const long PlottWareControlFrame::ID_SPINCTRL4 = wxNewId(); +const long PlottWareControlFrame::ID_SPINCTRL5 = wxNewId(); +const long PlottWareControlFrame::ID_SPINCTRL6 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT4 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT5 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT3 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT7 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT9 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT8 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT10 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT6 = wxNewId(); +const long PlottWareControlFrame::ID_PANEL3 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT12 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT11 = wxNewId(); +const long PlottWareControlFrame::ID_RADIOBUTTON1 = wxNewId(); +const long PlottWareControlFrame::ID_RADIOBUTTON2 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT13 = wxNewId(); +const long PlottWareControlFrame::ID_SLIDER1 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT14 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT15 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT16 = wxNewId(); +const long PlottWareControlFrame::ID_CHOICE1 = wxNewId(); +const long PlottWareControlFrame::ID_CHOICE2 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON25 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON8 = wxNewId(); +const long PlottWareControlFrame::ID_PANEL4 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT17 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON10 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON12 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON13 = wxNewId(); +const long PlottWareControlFrame::ID_PANEL5 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT18 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT19 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT20 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT21 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON7 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON16 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON17 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON18 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON19 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON20 = wxNewId(); +const long PlottWareControlFrame::ID_CHOICE3 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT22 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON21 = wxNewId(); +const long PlottWareControlFrame::ID_SPINCTRL7 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT24 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT23 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT28 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT29 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT30 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT32 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT33 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT31 = wxNewId(); +const long PlottWareControlFrame::ID_TEXTCTRL1 = wxNewId(); +const long PlottWareControlFrame::ID_LISTBOX2 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT34 = wxNewId(); +const long PlottWareControlFrame::ID_PANEL1 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON11 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON14 = wxNewId(); +const long PlottWareControlFrame::ID_BUTTON15 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT35 = wxNewId(); +const long PlottWareControlFrame::ID_GAUGE1 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT36 = wxNewId(); +const long PlottWareControlFrame::ID_STATICTEXT37 = wxNewId(); +const long PlottWareControlFrame::ID_PANEL6 = wxNewId(); +const long PlottWareControlFrame::ID_NOTEBOOK2 = wxNewId(); +const long PlottWareControlFrame::MenuSettingItem = wxNewId(); +const long PlottWareControlFrame::MenuQuitItem = wxNewId(); +const long PlottWareControlFrame::idMenuAbout = wxNewId(); +const long PlottWareControlFrame::ID_STATUSBAR1 = wxNewId(); +const long PlottWareControlFrame::ID_MESSAGEDIALOG1 = wxNewId(); +const long PlottWareControlFrame::ID_TIMER1 = wxNewId(); +//*) + +BEGIN_EVENT_TABLE(PlottWareControlFrame,wxFrame) + //(*EventTable(PlottWareControlFrame) + //*) +END_EVENT_TABLE() + +PlottWareControlFrame::PlottWareControlFrame(wxWindow* parent,wxWindowID id) +{ + settings=new Settings(); + project=NULL; + + //(*Initialize(PlottWareControlFrame) + wxMenuItem* MenuItem2; + wxMenuItem* MenuItem1; + wxMenu* Menu1; + wxMenuBar* MenuBar1; + wxMenu* Menu2; + + Create(parent, wxID_ANY, _("PlottWareControl"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY")); + SetClientSize(wxSize(473,543)); + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + { + wxIcon FrameIcon; + FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T(".\\res\\icon.bmp")))); + SetIcon(FrameIcon); + } + MenuChanger = new wxNotebook(this, ID_NOTEBOOK2, wxPoint(680,72), wxSize(475,536), 0, _T("ID_NOTEBOOK2")); + MenuChangerProjectPage = new wxPanel(MenuChanger, ID_PANEL2, wxDefaultPosition, wxSize(467,421), wxTAB_TRAVERSAL, _T("ID_PANEL2")); + MenuChangerProjectPage->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + ProjNewButton = new wxButton(MenuChangerProjectPage, ID_BUTTON1, _("New"), wxPoint(16,56), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); + ProjNewButton->SetToolTip(_("Create new project")); + StaticText1 = new wxStaticText(MenuChangerProjectPage, ID_STATICTEXT1, _("Project"), wxPoint(16,16), wxDefaultSize, 0, _T("ID_STATICTEXT1")); + wxFont StaticText1Font(14,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT); + StaticText1->SetFont(StaticText1Font); + ProjOpenButton = new wxButton(MenuChangerProjectPage, ID_BUTTON2, _("Open"), wxPoint(104,56), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); + ProjOpenButton->SetToolTip(_("Open an existing project")); + ProjSaveButton = new wxButton(MenuChangerProjectPage, ID_BUTTON3, _("Save"), wxPoint(192,56), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3")); + ProjSaveButton->Disable(); + ProjSaveButton->SetToolTip(_("Save current project")); + ProjCloseButton = new wxButton(MenuChangerProjectPage, ID_BUTTON4, _("Close"), wxPoint(280,56), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON4")); + ProjCloseButton->Disable(); + ProjCloseButton->SetToolTip(_("Close current project")); + MenuChangerImagesPage = new wxPanel(MenuChanger, ID_PANEL3, wxDefaultPosition, wxSize(467,479), wxTAB_TRAVERSAL, _T("ID_PANEL3")); + MenuChangerImagesPage->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + StaticText2 = new wxStaticText(MenuChangerImagesPage, ID_STATICTEXT2, _("Images"), wxPoint(16,16), wxDefaultSize, 0, _T("ID_STATICTEXT2")); + wxFont StaticText2Font(14,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT); + StaticText2->SetFont(StaticText2Font); + ImagesImageListBox = new wxListBox(MenuChangerImagesPage, ID_LISTBOX1, wxPoint(24,56), wxSize(120,168), 0, 0, 0, wxDefaultValidator, _T("ID_LISTBOX1")); + ImagesAddButton = new wxButton(MenuChangerImagesPage, ID_BUTTON5, _("Add image"), wxPoint(160,56), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON5")); + ImagesAddButton->Disable(); + ImagesAddButton->SetToolTip(_("Load new image")); + ImagesDeleteButton = new wxButton(MenuChangerImagesPage, ID_BUTTON6, _("Delete"), wxPoint(160,88), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON6")); + ImagesDeleteButton->Disable(); + ImagesDeleteButton->SetToolTip(_("Delete selected image")); + ImagesPreviewButton = new wxButton(MenuChangerImagesPage, ID_BUTTON9, _("Combine"), wxPoint(16,464), wxSize(432,23), 0, wxDefaultValidator, _T("ID_BUTTON9")); + ImagesPreviewButton->Disable(); + ImagesPreviewButton->SetToolTip(_("Preview images on canvas")); + ImagesImageListMoveUpButton = new wxButton(MenuChangerImagesPage, ID_BUTTON23, _("/\\"), wxPoint(160,168), wxSize(24,23), 0, wxDefaultValidator, _T("ID_BUTTON23")); + ImagesImageListMoveUpButton->Disable(); + ImagesImageListMoveDownButton = new wxButton(MenuChangerImagesPage, ID_BUTTON24, _("\\/"), wxPoint(160,200), wxSize(24,23), 0, wxDefaultValidator, _T("ID_BUTTON24")); + ImagesImageListMoveDownButton->Disable(); + StaticText24 = new wxStaticText(MenuChangerImagesPage, ID_STATICTEXT25, _("Size:"), wxPoint(24,248), wxDefaultSize, 0, _T("ID_STATICTEXT25")); + ImagesSizeLabel = new wxStaticText(MenuChangerImagesPage, ID_STATICTEXT26, _("0x0"), wxPoint(88,248), wxSize(120,13), 0, _T("ID_STATICTEXT26")); + StaticText25 = new wxStaticText(MenuChangerImagesPage, ID_STATICTEXT27, _("Scale:"), wxPoint(24,272), wxDefaultSize, 0, _T("ID_STATICTEXT27")); + ImagesScaleText = new wxTextCtrl(MenuChangerImagesPage, ID_TEXTCTRL2, _("0"), wxPoint(88,264), wxSize(120,21), 0, wxDefaultValidator, _T("ID_TEXTCTRL2")); + ImagesScaleText->Disable(); + ImagesPositionXSpinner = new wxSpinCtrl(MenuChangerImagesPage, ID_SPINCTRL1, _T("0"), wxPoint(88,288), wxDefaultSize, 0, 0, 999999999, 0, _T("ID_SPINCTRL1")); + ImagesPositionXSpinner->SetValue(_T("0")); + ImagesPositionXSpinner->Disable(); + ImagesPositionXSpinner->SetToolTip(_("X coordinate of image")); + ImagesPositionYSpinner = new wxSpinCtrl(MenuChangerImagesPage, ID_SPINCTRL2, _T("0"), wxPoint(88,312), wxDefaultSize, 0, 0, 999999999, 0, _T("ID_SPINCTRL2")); + ImagesPositionYSpinner->SetValue(_T("0")); + ImagesPositionYSpinner->Disable(); + ImagesPositionYSpinner->SetToolTip(_("X coordinate of image")); + ImagesCropX1Spinner = new wxSpinCtrl(MenuChangerImagesPage, ID_SPINCTRL3, _T("0"), wxPoint(88,336), wxDefaultSize, 0, 0, 999999999, 0, _T("ID_SPINCTRL3")); + ImagesCropX1Spinner->SetValue(_T("0")); + ImagesCropX1Spinner->Disable(); + ImagesCropX1Spinner->SetToolTip(_("X coordinate of top-left crop point")); + ImagesCropY1Spinner = new wxSpinCtrl(MenuChangerImagesPage, ID_SPINCTRL4, _T("0"), wxPoint(88,360), wxDefaultSize, 0, 0, 999999999, 0, _T("ID_SPINCTRL4")); + ImagesCropY1Spinner->SetValue(_T("0")); + ImagesCropY1Spinner->Disable(); + ImagesCropY1Spinner->SetToolTip(_("Y coordinate of top-left crop point")); + ImagesCropX2Spinner = new wxSpinCtrl(MenuChangerImagesPage, ID_SPINCTRL5, _T("0"), wxPoint(88,384), wxDefaultSize, 0, 0, 999999999, 0, _T("ID_SPINCTRL5")); + ImagesCropX2Spinner->SetValue(_T("0")); + ImagesCropX2Spinner->Disable(); + ImagesCropX2Spinner->SetToolTip(_("X coordinate of bottom-right crop point")); + ImagesCropY2Spinner = new wxSpinCtrl(MenuChangerImagesPage, ID_SPINCTRL6, _T("0"), wxPoint(88,408), wxDefaultSize, 0, 0, 999999999, 0, _T("ID_SPINCTRL6")); + ImagesCropY2Spinner->SetValue(_T("0")); + ImagesCropY2Spinner->Disable(); + ImagesCropY2Spinner->SetToolTip(_("Y coordinate of bottom-right crop point")); + StaticText4 = new wxStaticText(MenuChangerImagesPage, ID_STATICTEXT4, _("X"), wxPoint(72,296), wxSize(8,13), 0, _T("ID_STATICTEXT4")); + StaticText5 = new wxStaticText(MenuChangerImagesPage, ID_STATICTEXT5, _("Y"), wxPoint(72,320), wxDefaultSize, 0, _T("ID_STATICTEXT5")); + StaticText3 = new wxStaticText(MenuChangerImagesPage, ID_STATICTEXT3, _("Position:"), wxPoint(24,296), wxDefaultSize, 0, _T("ID_STATICTEXT3")); + StaticText7 = new wxStaticText(MenuChangerImagesPage, ID_STATICTEXT7, _("X1"), wxPoint(72,344), wxDefaultSize, 0, _T("ID_STATICTEXT7")); + StaticText9 = new wxStaticText(MenuChangerImagesPage, ID_STATICTEXT9, _("Y1"), wxPoint(72,368), wxDefaultSize, 0, _T("ID_STATICTEXT9")); + StaticText8 = new wxStaticText(MenuChangerImagesPage, ID_STATICTEXT8, _("X2"), wxPoint(72,392), wxDefaultSize, 0, _T("ID_STATICTEXT8")); + StaticText10 = new wxStaticText(MenuChangerImagesPage, ID_STATICTEXT10, _("Y2"), wxPoint(72,416), wxDefaultSize, 0, _T("ID_STATICTEXT10")); + StaticText6 = new wxStaticText(MenuChangerImagesPage, ID_STATICTEXT6, _("Crop:"), wxPoint(24,344), wxDefaultSize, 0, _T("ID_STATICTEXT6")); + MenuChangerProcessingPage = new wxPanel(MenuChanger, ID_PANEL4, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL4")); + MenuChangerProcessingPage->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + StaticText12 = new wxStaticText(MenuChangerProcessingPage, ID_STATICTEXT12, _("Retrival mode:"), wxPoint(16,56), wxDefaultSize, 0, _T("ID_STATICTEXT12")); + StaticText11 = new wxStaticText(MenuChangerProcessingPage, ID_STATICTEXT11, _("Processing"), wxPoint(16,16), wxDefaultSize, 0, _T("ID_STATICTEXT11")); + wxFont StaticText11Font(14,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT); + StaticText11->SetFont(StaticText11Font); + ProcessingRetrAllRadio = new wxRadioButton(MenuChangerProcessingPage, ID_RADIOBUTTON1, _("All"), wxPoint(144,56), wxDefaultSize, wxRB_GROUP, wxDefaultValidator, _T("ID_RADIOBUTTON1")); + ProcessingRetrAllRadio->SetValue(true); + ProcessingRetrAllRadio->Disable(); + ProcessingRetrAllRadio->SetToolTip(_("Retrive all borders")); + ProcessingRetrExtRadio = new wxRadioButton(MenuChangerProcessingPage, ID_RADIOBUTTON2, _("External"), wxPoint(192,56), wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON2")); + ProcessingRetrExtRadio->Disable(); + ProcessingRetrExtRadio->SetToolTip(_("Retrive only the external border")); + StaticText13 = new wxStaticText(MenuChangerProcessingPage, ID_STATICTEXT13, _("Canny threshold:"), wxPoint(16,88), wxDefaultSize, 0, _T("ID_STATICTEXT13")); + ProcessingCannyThreshSlider = new wxSlider(MenuChangerProcessingPage, ID_SLIDER1, 100, 0, 255, wxPoint(144,80), wxDefaultSize, 0, wxDefaultValidator, _T("ID_SLIDER1")); + ProcessingCannyThreshSlider->Disable(); + ProcessingCannyThreshSlider->SetToolTip(_("Threshold for canny edge detection")); + StaticText14 = new wxStaticText(MenuChangerProcessingPage, ID_STATICTEXT14, _("Coloring:"), wxPoint(16,136), wxDefaultSize, 0, _T("ID_STATICTEXT14")); + StaticText15 = new wxStaticText(MenuChangerProcessingPage, ID_STATICTEXT15, _("Edge:"), wxPoint(144,136), wxSize(32,13), 0, _T("ID_STATICTEXT15")); + StaticText16 = new wxStaticText(MenuChangerProcessingPage, ID_STATICTEXT16, _("Color:"), wxPoint(144,160), wxDefaultSize, 0, _T("ID_STATICTEXT16")); + ProcessingColorLineSelect = new wxChoice(MenuChangerProcessingPage, ID_CHOICE1, wxPoint(184,128), wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE1")); + ProcessingColorLineSelect->Disable(); + ProcessingColorLineSelect->SetToolTip(_("Edge to be colored")); + ProcessingColorColorSelect = new wxChoice(MenuChangerProcessingPage, ID_CHOICE2, wxPoint(184,152), wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE2")); + ProcessingColorColorSelect->Append(_("Leave out")); + ProcessingColorColorSelect->Disable(); + ProcessingColorColorSelect->SetToolTip(_("Used color")); + ProcessingColorForAllButton = new wxButton(MenuChangerProcessingPage, ID_BUTTON25, _("Set for all"), wxPoint(320,152), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON25")); + ProcessingColorForAllButton->Disable(); + ProcessingPreviewButton = new wxButton(MenuChangerProcessingPage, ID_BUTTON8, _("Process"), wxPoint(16,208), wxSize(440,23), 0, wxDefaultValidator, _T("ID_BUTTON8")); + ProcessingPreviewButton->Disable(); + ProcessingPreviewButton->SetToolTip(_("Preview the processed image")); + MenuChangerGcodePage = new wxPanel(MenuChanger, ID_PANEL5, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL5")); + MenuChangerGcodePage->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + StaticText17 = new wxStaticText(MenuChangerGcodePage, ID_STATICTEXT17, _("G code"), wxPoint(16,16), wxDefaultSize, 0, _T("ID_STATICTEXT17")); + wxFont StaticText17Font(14,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT); + StaticText17->SetFont(StaticText17Font); + GcodeGenerateButton = new wxButton(MenuChangerGcodePage, ID_BUTTON10, _("Generate"), wxPoint(16,56), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON10")); + GcodeGenerateButton->Disable(); + GcodeGenerateButton->SetToolTip(_("Generate G code")); + GcodeEditButton = new wxButton(MenuChangerGcodePage, ID_BUTTON12, _("Edit"), wxPoint(104,56), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON12")); + GcodeEditButton->Disable(); + GcodeEditButton->SetToolTip(_("Edit generate G code")); + GcodeExportButton = new wxButton(MenuChangerGcodePage, ID_BUTTON13, _("Export"), wxPoint(192,56), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON13")); + GcodeExportButton->Disable(); + GcodeExportButton->SetToolTip(_("Export G code to file")); + MenuChangerPrintingPage = new wxPanel(MenuChanger, ID_PANEL6, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL6")); + MenuChangerPrintingPage->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + StaticText18 = new wxStaticText(MenuChangerPrintingPage, ID_STATICTEXT18, _("Printing"), wxPoint(16,16), wxDefaultSize, 0, _T("ID_STATICTEXT18")); + wxFont StaticText18Font(14,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT); + StaticText18->SetFont(StaticText18Font); + Panel1 = new wxPanel(MenuChangerPrintingPage, ID_PANEL1, wxPoint(8,120), wxSize(440,280), wxTAB_TRAVERSAL, _T("ID_PANEL1")); + Panel1->SetBackgroundColour(wxColour(224,224,224)); + StaticText19 = new wxStaticText(Panel1, ID_STATICTEXT19, _("Printer"), wxPoint(8,8), wxDefaultSize, 0, _T("ID_STATICTEXT19")); + wxFont StaticText19Font(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT); + StaticText19->SetFont(StaticText19Font); + StaticText20 = new wxStaticText(Panel1, ID_STATICTEXT20, _("Status:"), wxPoint(88,8), wxDefaultSize, 0, _T("ID_STATICTEXT20")); + PrintingPrinterStatusLabel = new wxStaticText(Panel1, ID_STATICTEXT21, _("Offline"), wxPoint(128,8), wxSize(48,13), 0, _T("ID_STATICTEXT21")); + PrintingPrinterConnectButton = new wxButton(Panel1, ID_BUTTON7, _("Connect"), wxPoint(8,32), wxSize(72,23), 0, wxDefaultValidator, _T("ID_BUTTON7")); + PrintingPrinterConnectButton->SetToolTip(_("Connect/Disconnect to the printer")); + PrintingPrinterUpButton = new wxButton(Panel1, ID_BUTTON16, _("/\\"), wxPoint(208,40), wxSize(20,20), 0, wxDefaultValidator, _T("ID_BUTTON16")); + PrintingPrinterUpButton->Disable(); + PrintingPrinterDownButton = new wxButton(Panel1, ID_BUTTON17, _("\\/"), wxPoint(208,72), wxSize(20,20), 0, wxDefaultValidator, _T("ID_BUTTON17")); + PrintingPrinterDownButton->Disable(); + PrintingPrinterLeftButton = new wxButton(Panel1, ID_BUTTON18, _("<"), wxPoint(184,56), wxSize(20,20), 0, wxDefaultValidator, _T("ID_BUTTON18")); + PrintingPrinterLeftButton->Disable(); + wxFont PrintingPrinterLeftButtonFont(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Arial"),wxFONTENCODING_DEFAULT); + PrintingPrinterLeftButton->SetFont(PrintingPrinterLeftButtonFont); + PrintingPrinterRightButton = new wxButton(Panel1, ID_BUTTON19, _(">"), wxPoint(232,56), wxSize(20,20), 0, wxDefaultValidator, _T("ID_BUTTON19")); + PrintingPrinterRightButton->Disable(); + wxFont PrintingPrinterRightButtonFont(12,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT); + PrintingPrinterRightButton->SetFont(PrintingPrinterRightButtonFont); + PrintingPrinterHomeButton = new wxButton(Panel1, ID_BUTTON20, _("Home"), wxPoint(320,8), wxSize(50,23), 0, wxDefaultValidator, _T("ID_BUTTON20")); + PrintingPrinterHomeButton->Disable(); + PrintingPrinterHomeButton->SetToolTip(_("Home axises")); + PrintingPrinterHeadSelect = new wxChoice(Panel1, ID_CHOICE3, wxPoint(320,32), wxSize(112,21), 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE3")); + PrintingPrinterHeadSelect->SetSelection( PrintingPrinterHeadSelect->Append(_("No tool")) ); + PrintingPrinterHeadSelect->Disable(); + PrintingPrinterHeadSelect->SetToolTip(_("Select used drawing head")); + StaticText21 = new wxStaticText(Panel1, ID_STATICTEXT22, _("Head:"), wxPoint(280,40), wxDefaultSize, 0, _T("ID_STATICTEXT22")); + PrintingPrinterPowerButton = new wxButton(Panel1, ID_BUTTON21, _("Power"), wxPoint(384,8), wxSize(50,23), 0, wxDefaultValidator, _T("ID_BUTTON21")); + PrintingPrinterPowerButton->Disable(); + PrintingPrinterPowerButton->SetToolTip(_("Cycle power supply")); + PrintingPrinterMoveSpinner = new wxSpinCtrl(Panel1, ID_SPINCTRL7, _T("25"), wxPoint(320,64), wxSize(48,21), 0, 0, 100, 25, _T("ID_SPINCTRL7")); + PrintingPrinterMoveSpinner->SetValue(_T("25")); + PrintingPrinterMoveSpinner->Disable(); + PrintingPrinterMoveSpinner->SetToolTip(_("Amount in mm to move when button pressed")); + StaticText23 = new wxStaticText(Panel1, ID_STATICTEXT24, _("Move:"), wxPoint(280,72), wxDefaultSize, 0, _T("ID_STATICTEXT24")); + StaticText22 = new wxStaticText(Panel1, ID_STATICTEXT23, _("Power:"), wxPoint(88,32), wxDefaultSize, 0, _T("ID_STATICTEXT23")); + PrintingPrinterPowerLabel = new wxStaticText(Panel1, ID_STATICTEXT28, wxEmptyString, wxPoint(128,32), wxSize(48,13), 0, _T("ID_STATICTEXT28")); + StaticText26 = new wxStaticText(Panel1, ID_STATICTEXT29, _("X:"), wxPoint(8,64), wxDefaultSize, 0, _T("ID_STATICTEXT29")); + StaticText27 = new wxStaticText(Panel1, ID_STATICTEXT30, _("Y:"), wxPoint(8,80), wxDefaultSize, 0, _T("ID_STATICTEXT30")); + PrintingPrinterXLabel = new wxStaticText(Panel1, ID_STATICTEXT32, wxEmptyString, wxPoint(24,64), wxSize(48,13), 0, _T("ID_STATICTEXT32")); + PrintingPrinterYLabel = new wxStaticText(Panel1, ID_STATICTEXT33, wxEmptyString, wxPoint(24,80), wxSize(48,13), 0, _T("ID_STATICTEXT33")); + StaticText28 = new wxStaticText(Panel1, ID_STATICTEXT31, _("Console:"), wxPoint(8,120), wxDefaultSize, 0, _T("ID_STATICTEXT31")); + PrintingPrinterConsole = new wxTextCtrl(Panel1, ID_TEXTCTRL1, wxEmptyString, wxPoint(64,112), wxSize(360,21), 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); + PrintingPrinterConsole->Disable(); + PrintingPrinterLog = new wxListBox(Panel1, ID_LISTBOX2, wxPoint(8,160), wxSize(424,104), 0, 0, 0, wxDefaultValidator, _T("ID_LISTBOX2")); + StaticText29 = new wxStaticText(Panel1, ID_STATICTEXT34, _("Log:"), wxPoint(8,144), wxDefaultSize, 0, _T("ID_STATICTEXT34")); + PrintingPrintButton = new wxButton(MenuChangerPrintingPage, ID_BUTTON11, _("Print"), wxPoint(16,56), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON11")); + PrintingPrintButton->Disable(); + PrintingPrintButton->SetToolTip(_("Start printing")); + PrintingStopButton = new wxButton(MenuChangerPrintingPage, ID_BUTTON14, _("Stop"), wxPoint(104,56), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON14")); + PrintingStopButton->Disable(); + PrintingStopButton->SetToolTip(_("Stop printing")); + PrintingEmergencyButton = new wxButton(MenuChangerPrintingPage, ID_BUTTON15, _("Emergency stop"), wxPoint(320,16), wxSize(128,56), 0, wxDefaultValidator, _T("ID_BUTTON15")); + PrintingEmergencyButton->Disable(); + PrintingEmergencyButton->SetBackgroundColour(wxColour(248,31,90)); + wxFont PrintingEmergencyButtonFont(10,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD,false,wxEmptyString,wxFONTENCODING_DEFAULT); + PrintingEmergencyButton->SetFont(PrintingEmergencyButtonFont); + PrintingEmergencyButton->SetToolTip(_("Reset printer immediately")); + PrintingStatusLabel = new wxStaticText(MenuChangerPrintingPage, ID_STATICTEXT35, _("Print status:"), wxPoint(24,440), wxDefaultSize, 0, _T("ID_STATICTEXT35")); + PrintingStatusLabel->Hide(); + PrintingStatusGauge = new wxGauge(MenuChangerPrintingPage, ID_GAUGE1, 1, wxPoint(104,432), wxSize(336,36), 0, wxDefaultValidator, _T("ID_GAUGE1")); + PrintingStatusGauge->Hide(); + PrintingElapsedTimeLabelLabel = new wxStaticText(MenuChangerPrintingPage, ID_STATICTEXT36, _("Elapsed time:"), wxPoint(24,488), wxSize(72,13), 0, _T("ID_STATICTEXT36")); + PrintingElapsedTimeLabelLabel->Hide(); + PrintingElapsedTimeLabel = new wxStaticText(MenuChangerPrintingPage, ID_STATICTEXT37, _("00:00:00"), wxPoint(104,488), wxSize(336,13), 0, _T("ID_STATICTEXT37")); + PrintingElapsedTimeLabel->Hide(); + MenuChanger->AddPage(MenuChangerProjectPage, _("Project"), false); + MenuChanger->AddPage(MenuChangerImagesPage, _("Images"), false); + MenuChanger->AddPage(MenuChangerProcessingPage, _("Processing"), false); + MenuChanger->AddPage(MenuChangerGcodePage, _("G code"), false); + MenuChanger->AddPage(MenuChangerPrintingPage, _("Printing"), false); + MenuBar1 = new wxMenuBar(); + Menu1 = new wxMenu(); + MenuItemSettings = new wxMenuItem(Menu1, MenuSettingItem, _("Settings\tCtrl-s"), _("Change settings"), wxITEM_NORMAL); + Menu1->Append(MenuItemSettings); + MenuItem1 = new wxMenuItem(Menu1, MenuQuitItem, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL); + Menu1->Append(MenuItem1); + MenuBar1->Append(Menu1, _("&File")); + Menu2 = new wxMenu(); + MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL); + Menu2->Append(MenuItem2); + MenuBar1->Append(Menu2, _("Help")); + SetMenuBar(MenuBar1); + StatusBar1 = new wxStatusBar(this, ID_STATUSBAR1, 0, _T("ID_STATUSBAR1")); + int __wxStatusBarWidths_1[2] = { 375, 100 }; + int __wxStatusBarStyles_1[2] = { wxSB_NORMAL, wxSB_NORMAL }; + StatusBar1->SetFieldsCount(2,__wxStatusBarWidths_1); + StatusBar1->SetStatusStyles(2,__wxStatusBarStyles_1); + SetStatusBar(StatusBar1); + FileDialog1 = new wxFileDialog(this, _("Select file"), wxEmptyString, wxEmptyString, wxFileSelectorDefaultWildcardStr, wxFD_DEFAULT_STYLE, wxDefaultPosition, wxDefaultSize, _T("wxFileDialog")); + MessageDialog1 = new wxMessageDialog(this, wxEmptyString, _("Message"), wxOK|wxCANCEL, wxDefaultPosition); + PrintingElapsedTimeCheckerTimer.SetOwner(this, ID_TIMER1); + + Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnProjNewButtonClick); + Connect(ID_BUTTON4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnProjCloseButtonClick); + Connect(ID_LISTBOX1,wxEVT_COMMAND_LISTBOX_SELECTED,(wxObjectEventFunction)&PlottWareControlFrame::OnImagesImageListBoxSelect); + Connect(ID_BUTTON5,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnImagesAddButtonClick); + Connect(ID_BUTTON6,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnImagesDeleteButtonClick); + Connect(ID_BUTTON9,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnImagesPreviewButtonClick); + Connect(ID_BUTTON23,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnImagesImageListMoveUpButtonClick); + Connect(ID_BUTTON24,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnImagesImageListMoveDownButtonClick); + Connect(ID_TEXTCTRL2,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&PlottWareControlFrame::OnImagesScaleTextText); + Connect(ID_SPINCTRL1,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)&PlottWareControlFrame::OnImagesPositionXSpinnerChange); + Connect(ID_SPINCTRL2,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)&PlottWareControlFrame::OnImagesPositionYSpinnerChange); + Connect(ID_SPINCTRL3,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)&PlottWareControlFrame::OnImagesCropX1SpinnerChange); + Connect(ID_SPINCTRL4,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)&PlottWareControlFrame::OnImagesCropY1SpinnerChange); + Connect(ID_SPINCTRL5,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)&PlottWareControlFrame::OnImagesCropX2SpinnerChange); + Connect(ID_SPINCTRL6,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)&PlottWareControlFrame::OnImagesCropY2SpinnerChange); + Connect(ID_RADIOBUTTON1,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&PlottWareControlFrame::OnProcessingRetrAllRadioSelect); + Connect(ID_RADIOBUTTON2,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&PlottWareControlFrame::OnProcessingRetrExtRadioSelect); + Connect(ID_SLIDER1,wxEVT_SCROLL_TOP|wxEVT_SCROLL_BOTTOM|wxEVT_SCROLL_LINEUP|wxEVT_SCROLL_LINEDOWN|wxEVT_SCROLL_PAGEUP|wxEVT_SCROLL_PAGEDOWN|wxEVT_SCROLL_THUMBTRACK|wxEVT_SCROLL_THUMBRELEASE|wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&PlottWareControlFrame::OnProcessingCannyThreshSliderCmdScroll); + Connect(ID_CHOICE1,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&PlottWareControlFrame::OnProcessingColorLineSelectSelect); + Connect(ID_CHOICE2,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&PlottWareControlFrame::OnProcessingColorColorSelectSelect); + Connect(ID_BUTTON25,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnProcessingColorForAllButtonClick); + Connect(ID_BUTTON8,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnProcessingPreviewButtonClick); + Connect(ID_BUTTON10,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnGcodeGenerateButtonClick); + Connect(ID_BUTTON12,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnGcodeEditButtonClick); + Connect(ID_BUTTON13,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnGcodeExportButtonClick); + Connect(ID_BUTTON7,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnPrintingPrinterConnectButtonClick); + Connect(ID_BUTTON16,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnPrintingPrinterUpButtonClick); + Connect(ID_BUTTON17,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnPrintingPrinterDownButtonClick); + Connect(ID_BUTTON18,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnPrintingPrinterLeftButtonClick); + Connect(ID_BUTTON19,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnPrintingPrinterRightButtonClick); + Connect(ID_BUTTON20,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnPrintingPrinterHomeButtonClick); + Connect(ID_CHOICE3,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&PlottWareControlFrame::OnPrintingPrinterHeadSelectSelect); + Connect(ID_BUTTON21,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnPrintingPrinterPowerButtonClick); + Connect(ID_TEXTCTRL1,wxEVT_COMMAND_TEXT_ENTER,(wxObjectEventFunction)&PlottWareControlFrame::OnPrintingPrinterConsoleTextEnter); + Connect(ID_BUTTON11,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnPrintingPrintButtonClick); + Connect(ID_BUTTON14,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnPrintingStopButtonClick); + Connect(ID_BUTTON15,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PlottWareControlFrame::OnPrintingEmergencyButtonClick); + Connect(MenuSettingItem,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&PlottWareControlFrame::OnMenuItemSettingsSelected); + Connect(MenuQuitItem,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&PlottWareControlFrame::OnQuit); + Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&PlottWareControlFrame::OnAbout); + Connect(ID_TIMER1,wxEVT_TIMER,(wxObjectEventFunction)&PlottWareControlFrame::OnPrintingElapsedTimeCheckerTimerTrigger); + //*) + + for(int i=0; igetPrinter()->getPens().size(); i++){ + ProcessingColorColorSelect->Append(getSettings()->getPrinter()->getPens().at(i)); + } +} + +Settings* PlottWareControlFrame::getSettings(){ + return settings; +} + +Project* PlottWareControlFrame::getProject(){ + return project; +} + +void PlottWareControlFrame::projectControlEnable(bool to){ + ProjSaveButton->Enable(to); + ProjCloseButton->Enable(to); + ImagesImageListBox->Enable(to); + ImagesAddButton->Enable(to); + ImagesDeleteButton->Enable(to); + ImagesImageListMoveUpButton->Enable(to); + ImagesImageListMoveDownButton->Enable(to); + ImagesScaleText->Enable(to); + ImagesPositionXSpinner->Enable(to); + ImagesPositionYSpinner->Enable(to); + ImagesCropX1Spinner->Enable(to); + ImagesCropY1Spinner->Enable(to); + ImagesCropX2Spinner->Enable(to); + ImagesCropY2Spinner->Enable(to); + ProcessingRetrAllRadio->Enable(to); + ProcessingRetrExtRadio->Enable(to); + ProcessingCannyThreshSlider->Enable(to); + ProcessingColorLineSelect->Enable(to); + ProcessingColorColorSelect->Enable(to); + ProcessingColorForAllButton->Enable(to); + ProcessingPreviewButton->Enable(to); + ImagesPreviewButton->Enable(to); + GcodeGenerateButton->Enable(to); + GcodeEditButton->Enable(to); + GcodeExportButton->Enable(to); +} + +void PlottWareControlFrame::printerControlEnable(bool to){ + PrintingEmergencyButton->Enable(to); + PrintingPrinterHomeButton->Enable(to); + PrintingPrinterPowerButton->Enable(to); + PrintingPrinterHeadSelect->Enable(to); + PrintingPrinterMoveSpinner->Enable(to); + PrintingPrinterUpButton->Enable(to); + PrintingPrinterDownButton->Enable(to); + PrintingPrinterRightButton->Enable(to); + PrintingPrinterLeftButton->Enable(to); + PrintingPrinterConsole->Enable(to); +} + +void PlottWareControlFrame::printingControlShow(bool to){ + PrintingStatusLabel->Show(to); + PrintingStatusGauge->Show(to); + PrintingElapsedTimeLabelLabel->Show(to); + PrintingElapsedTimeLabel->Show(to); +} + +PlottWareControlFrame::~PlottWareControlFrame() +{ + //(*Destroy(PlottWareControlFrame) + //*) +} + +void PlottWareControlFrame::OnQuit(wxCommandEvent& event) +{ + Close(); +} + +void PlottWareControlFrame::OnAbout(wxCommandEvent& event) +{ + std::string msg="PlottWareControl\nVersion: "; + msg+=Version::FULLVERSION_STRING; + msg+="\nBuild: "; + msg+=std::to_string(Version::BUILDS_COUNT); + msg+="\n\nWhen printing 10 pixe/mm (254 dpi)\n\nCopyright: Fandly Gergo Zoltan\n(fandlygergo@gmail.hu, systemtest.tk)\n\nLicense: GNU GPLv3 (www.gnu.org/licenses/gpl-3.0.en.html)"; + wxMessageBox(msg, _("About")); +} + +void PlottWareControlFrame::OnMenuItemSettingsSelected(wxCommandEvent& event) +{ + SettingDialog *dialog=new SettingDialog(this, wxID_ANY, this); + dialog->Show(true); +} + +void PlottWareControlFrame::OnProjNewButtonClick(wxCommandEvent& event) +{ + wxFileDialog newFileDialog(this, _("Select the location of new project"), "", "", "PlottWareControl project files (*.pwc)|*.pwc", wxFD_SAVE|wxFD_OVERWRITE_PROMPT); + if(newFileDialog.ShowModal()==wxID_CANCEL){ + event.Skip(); + return; + } + project=new Project(getSettings(), std::string(newFileDialog.GetPath().mb_str())); + if(!getProject()->newProj()){ + wxMessageDialog(this, _("Error: Could not write file"), _("Error"), wxOK|wxCENTER|wxICON_ERROR).ShowModal(); + event.Skip(); + delete project; + project=NULL; + return; + } + projectControlEnable(true); +} + +void PlottWareControlFrame::OnProjCloseButtonClick(wxCommandEvent& event) +{ + getProject()->close(); + delete project; + project=NULL; + projectControlEnable(false); +} + +void PlottWareControlFrame::OnImagesAddButtonClick(wxCommandEvent& event) +{ + wxFileDialog loadImageDialog(this, _("Open an image file"), "%userprofile%\pictures", "", "Image files (*.jpg;*jpeg;*.bpm;*.png)|*.jpg;*.jpeg;*.bmp;*.png;*.JPG;*.JPEG;*.BPM;*.PNG", wxFD_OPEN|wxFD_FILE_MUST_EXIST); + if(loadImageDialog.ShowModal()==wxID_CANCEL){ + event.Skip(); + return; + } + Image img=Image(std::string(loadImageDialog.GetPath().mb_str())); + if(!img.load()){ + wxMessageDialog(this, _("Could not open or find the image"), _("Error"), wxOK|wxCENTER|wxICON_ERROR).ShowModal(); + event.Skip(); + return; + } + getProject()->getImages()->push_back(img); + ImagesImageListBox->Append(loadImageDialog.GetFilename()); + if(getSettings()->isDebug()){ + ImageViewer* iv=new ImageViewer(getProject()->getImages()->back().getMat(), "DEBUG:OnImagesAddBUttonClick> "+img.getFilename()); + iv->show(); + } + return; +} + +void PlottWareControlFrame::OnImagesDeleteButtonClick(wxCommandEvent& event) +{ + if(ImagesImageListBox->GetSelection()==wxNOT_FOUND){ + event.Skip(); + return; + } + int sel=ImagesImageListBox->GetSelection(); + ImagesImageListBox->Delete(sel); + getProject()->getImages()->erase(getProject()->getImages()->begin()+sel); +} + +void PlottWareControlFrame::OnImagesImageListBoxSelect(wxCommandEvent& event) +{ + if(ImagesImageListBox->GetSelection()==wxNOT_FOUND){ + event.Skip(); + return; + } + int sel=ImagesImageListBox->GetSelection(); + ImagesSizeLabel->SetLabel(std::to_string(getProject()->getImages()->at(sel).getMat()->cols)+"x"+std::to_string(getProject()->getImages()->at(sel).getMat()->rows)); + ImagesScaleText->SetValue(std::to_string(getProject()->getImages()->at(sel).getScale())); + ImagesPositionXSpinner->SetValue(getProject()->getImages()->at(sel).getPosition().getX()); + ImagesPositionYSpinner->SetValue(getProject()->getImages()->at(sel).getPosition().getY()); + ImagesCropX1Spinner->SetValue(getProject()->getImages()->at(sel).getCrop1().getX()); + ImagesCropY1Spinner->SetValue(getProject()->getImages()->at(sel).getCrop1().getY()); + ImagesCropX2Spinner->SetValue(getProject()->getImages()->at(sel).getCrop2().getX()); + ImagesCropY2Spinner->SetValue(getProject()->getImages()->at(sel).getCrop2().getY()); +} + +void PlottWareControlFrame::OnImagesPositionXSpinnerChange(wxSpinEvent& event) +{ + if(ImagesImageListBox->GetSelection()==wxNOT_FOUND){ + event.Skip(); + return; + } + int sel=ImagesImageListBox->GetSelection(); + getProject()->getImages()->at(sel).setPosition(Point(ImagesPositionXSpinner->GetValue(), ImagesPositionYSpinner->GetValue())); +} + +void PlottWareControlFrame::OnImagesPositionYSpinnerChange(wxSpinEvent& event) +{ + if(ImagesImageListBox->GetSelection()==wxNOT_FOUND){ + event.Skip(); + return; + } + int sel=ImagesImageListBox->GetSelection(); + getProject()->getImages()->at(sel).setPosition(Point(ImagesPositionXSpinner->GetValue(), ImagesPositionYSpinner->GetValue())); +} + +void PlottWareControlFrame::OnImagesCropX1SpinnerChange(wxSpinEvent& event) +{ + if(ImagesImageListBox->GetSelection()==wxNOT_FOUND){ + event.Skip(); + return; + } + int sel=ImagesImageListBox->GetSelection(); + getProject()->getImages()->at(sel).setCrop(Point(ImagesCropX1Spinner->GetValue(), ImagesCropY1Spinner->GetValue()), Point(ImagesCropX2Spinner->GetValue(), ImagesCropY2Spinner->GetValue())); +} + +void PlottWareControlFrame::OnImagesCropY1SpinnerChange(wxSpinEvent& event) +{ + if(ImagesImageListBox->GetSelection()==wxNOT_FOUND){ + event.Skip(); + return; + } + int sel=ImagesImageListBox->GetSelection(); + getProject()->getImages()->at(sel).setCrop(Point(ImagesCropX1Spinner->GetValue(), ImagesCropY1Spinner->GetValue()), Point(ImagesCropX2Spinner->GetValue(), ImagesCropY2Spinner->GetValue())); +} + +void PlottWareControlFrame::OnImagesCropX2SpinnerChange(wxSpinEvent& event) +{ + if(ImagesImageListBox->GetSelection()==wxNOT_FOUND){ + event.Skip(); + return; + } + int sel=ImagesImageListBox->GetSelection(); + getProject()->getImages()->at(sel).setCrop(Point(ImagesCropX1Spinner->GetValue(), ImagesCropY1Spinner->GetValue()), Point(ImagesCropX2Spinner->GetValue(), ImagesCropY2Spinner->GetValue())); +} + +void PlottWareControlFrame::OnImagesCropY2SpinnerChange(wxSpinEvent& event) +{ + if(ImagesImageListBox->GetSelection()==wxNOT_FOUND){ + event.Skip(); + return; + } + int sel=ImagesImageListBox->GetSelection(); + getProject()->getImages()->at(sel).setCrop(Point(ImagesCropX1Spinner->GetValue(), ImagesCropY1Spinner->GetValue()), Point(ImagesCropX2Spinner->GetValue(), ImagesCropY2Spinner->GetValue())); +} + +void PlottWareControlFrame::OnImagesPreviewButtonClick(wxCommandEvent& event) +{ + getProject()->combine(); +} + +void PlottWareControlFrame::OnImagesImageListMoveUpButtonClick(wxCommandEvent& event) +{ + if(ImagesImageListBox->GetSelection()==wxNOT_FOUND){ + event.Skip(); + return; + } + int sel=ImagesImageListBox->GetSelection(); + if(sel>0){ + std::swap(getProject()->getImages()->at(sel), getProject()->getImages()->at(sel-1)); + wxString cp=ImagesImageListBox->GetString(sel-1); + ImagesImageListBox->SetString(sel-1, ImagesImageListBox->GetString(sel)); + ImagesImageListBox->SetString(sel, cp); + ImagesImageListBox->SetSelection(sel-1); + } +} + +void PlottWareControlFrame::OnImagesImageListMoveDownButtonClick(wxCommandEvent& event) +{ + if(ImagesImageListBox->GetSelection()==wxNOT_FOUND){ + event.Skip(); + return; + } + int sel=ImagesImageListBox->GetSelection(); + if(selgetImages()->size()-1){ + std::swap(getProject()->getImages()->at(sel), getProject()->getImages()->at(sel+1)); + wxString cp=ImagesImageListBox->GetString(sel+1); + ImagesImageListBox->SetString(sel+1, ImagesImageListBox->GetString(sel)); + ImagesImageListBox->SetString(sel, cp); + ImagesImageListBox->SetSelection(sel+1); + } +} + +void PlottWareControlFrame::OnImagesScaleTextText(wxCommandEvent& event) +{ + if(ImagesImageListBox->GetSelection()==wxNOT_FOUND){ + event.Skip(); + return; + } + int sel=ImagesImageListBox->GetSelection(); + + double n=std::stod(std::string(ImagesScaleText->GetValue().mb_str())); + if(n<=0){ + ImagesScaleText->SetBackgroundColour(wxColour("red")); + event.Skip(); + return; + } + else{ + ImagesScaleText->SetBackgroundColour(wxColour("white")); + getProject()->getImages()->at(sel).setScale(n); + } +} + +void PlottWareControlFrame::OnProcessingRetrAllRadioSelect(wxCommandEvent& event) +{ + if(ProcessingRetrAllRadio->GetValue()){ + getProject()->setRetrMode(CV_RETR_LIST); + } + else{ + getProject()->setRetrMode(CV_RETR_EXTERNAL); + } +} + +void PlottWareControlFrame::OnProcessingRetrExtRadioSelect(wxCommandEvent& event) +{ + if(ProcessingRetrAllRadio->GetValue()){ + getProject()->setRetrMode(CV_RETR_LIST); + } + else{ + getProject()->setRetrMode(CV_RETR_EXTERNAL); + } +} + +void PlottWareControlFrame::OnProcessingCannyThreshSliderCmdScroll(wxScrollEvent& event) +{ + getProject()->setCannyThresh(ProcessingCannyThreshSlider->GetValue()); +} + +void PlottWareControlFrame::OnProcessingPreviewButtonClick(wxCommandEvent& event) +{ + if(!getProject()->process()){ + wxMessageDialog(this, _("Please combine the pictures first!"), _("Error"), wxOK|wxCENTER|wxICON_EXCLAMATION).ShowModal(); + } + + //add edges to drop down + ProcessingColorLineSelect->Clear(); + for(int i=0; igetColoring()->size(); i++){ + ProcessingColorLineSelect->Append(std::to_string(i)); + } + + //add colors if this did't happen till now + ProcessingColorColorSelect->Clear(); + ProcessingColorColorSelect->Append("Leave out"); + for(int i=0; igetPrinter()->getPens().size(); i++){ + ProcessingColorColorSelect->Append(getSettings()->getPrinter()->getPens().at(i)); + } + + //remove selection + ProcessingColorColorSelect->SetSelection(wxNOT_FOUND); +} + +void PlottWareControlFrame::OnProcessingColorLineSelectSelect(wxCommandEvent& event) +{ + //select the set + ProcessingColorColorSelect->SetSelection(getProject()->getColoring()->at(ProcessingColorLineSelect->GetSelection())); + + //show the ominous contour + getProject()->printEdge(ProcessingColorLineSelect->GetSelection()); +} + +void PlottWareControlFrame::OnProcessingColorColorSelectSelect(wxCommandEvent& event) +{ + //check if there's selected anything + if(ProcessingColorLineSelect->GetSelection()==wxNOT_FOUND){ + event.Skip(); + return; + } + + getProject()->getColoring()->at(ProcessingColorLineSelect->GetSelection())=ProcessingColorColorSelect->GetSelection(); +} + +void PlottWareControlFrame::OnProcessingColorForAllButtonClick(wxCommandEvent& event) +{ + if(ProcessingColorColorSelect->GetSelection()==wxNOT_FOUND){ + event.Skip(); + return; + } + + for(int i=0; igetColoring()->size(); i++){ + getProject()->getColoring()->at(i)=ProcessingColorColorSelect->GetSelection(); + } +} + +void PlottWareControlFrame::OnGcodeGenerateButtonClick(wxCommandEvent& event) +{ + if(!getProject()->generateGcode()){ + wxMessageDialog(this, _("Plese process the canvas first!"), _("Error"), wxOK|wxCENTER|wxICON_EXCLAMATION).ShowModal(); + } +} + +void PlottWareControlFrame::OnGcodeEditButtonClick(wxCommandEvent& event) +{ + GcodeEditorDialog* dialog=new GcodeEditorDialog(this, wxID_ANY, getProject()->getGcode()); + dialog->Show(); +} + +void PlottWareControlFrame::OnGcodeExportButtonClick(wxCommandEvent& event) +{ + wxFileDialog saveFileDialog(this, _("Export G code"), "", "", "G code files (*.g;*.gcode)|*.g;*.gcode", wxFD_SAVE|wxFD_OVERWRITE_PROMPT); + if(saveFileDialog.ShowModal()==wxID_CANCEL){ + return; + } + if(!getProject()->exportGcode(std::string(saveFileDialog.GetPath().mb_str()))){ + wxMessageDialog(this, _("Can not create or write the selected file"), _("Error"), wxOK|wxCENTER|wxICON_ERROR).ShowModal(); + return; + } + wxMessageDialog(this, _("G code successfully exported"), _("Info"), wxOK|wxCENTER|wxICON_INFORMATION).ShowModal(); +} + +void PlottWareControlFrame::OnPrintingPrinterConnectButtonClick(wxCommandEvent& event) +{ + if(!getSettings()->getPrinter()->isConnected()){ + if(!getSettings()->getPrinter()->connect()){ + wxMessageDialog(this, _("Can not connect to printer. Please check your settings!"), _("Warning"), wxOK|wxCENTER|wxICON_WARNING).ShowModal(); + return; + } + printerControlEnable(true); + PrintingPrinterStatusLabel->SetLabel(_("Online")); + PrintingPrinterPowerLabel->SetLabel(getSettings()->getPrinter()->getPowerState()?"On":"Off"); + PrintingPrinterConnectButton->SetLabel(_("Disconnect")); + if(getSettings()->getPrinter()->getPosition().getX()>-1){ + PrintingPrinterXLabel->SetLabel(std::to_string(getSettings()->getPrinter()->getPosition().getX())); + } + else{ + PrintingPrinterXLabel->SetLabel("?"); + } + if(getSettings()->getPrinter()->getPosition().getY()>-1){ + PrintingPrinterYLabel->SetLabel(std::to_string(getSettings()->getPrinter()->getPosition().getY())); + } + else{ + PrintingPrinterYLabel->SetLabel("?"); + } + } + else{ + getSettings()->getPrinter()->disconnect(); + printerControlEnable(false); + PrintingPrinterStatusLabel->SetLabel(_("Offline")); + PrintingPrinterPowerLabel->SetLabel(""); + PrintingPrinterConnectButton->SetLabel(_("Connect")); + PrintingPrinterXLabel->SetLabel(""); + PrintingPrinterYLabel->SetLabel(""); + } +} + +void PlottWareControlFrame::OnPrintingPrinterHomeButtonClick(wxCommandEvent& event) +{ + getSettings()->getPrinter()->send("G28\n"); + PrintingPrinterXLabel->SetLabel("0"); + PrintingPrinterYLabel->SetLabel("0"); +} + +void PlottWareControlFrame::OnPrintingPrinterPowerButtonClick(wxCommandEvent& event) +{ + if(getSettings()->getPrinter()->getPowerState()){ + getSettings()->getPrinter()->send("M81\n"); //turn off + } + else{ + getSettings()->getPrinter()->send("M80"); //turn on + } +} + +void PlottWareControlFrame::OnPrintingPrinterHeadSelectSelect(wxCommandEvent& event) +{ + getSettings()->getPrinter()->send("T"+std::to_string(PrintingPrinterHeadSelect->GetSelection())); +} + +void PlottWareControlFrame::OnPrintingPrinterUpButtonClick(wxCommandEvent& event) +{ + getSettings()->getPrinter()->send("G91\nG1 Y"+std::to_string(PrintingPrinterMoveSpinner->GetValue())+"G90"); + PrintingPrinterXLabel->SetLabel(std::to_string(getSettings()->getPrinter()->getPosition().getX())); + PrintingPrinterYLabel->SetLabel(std::to_string(getSettings()->getPrinter()->getPosition().getY())); +} + +void PlottWareControlFrame::OnPrintingPrinterDownButtonClick(wxCommandEvent& event) +{ + getSettings()->getPrinter()->send("G91\nG1 Y"+std::to_string(-PrintingPrinterMoveSpinner->GetValue())+"G90"); + PrintingPrinterXLabel->SetLabel(std::to_string(getSettings()->getPrinter()->getPosition().getX())); + PrintingPrinterYLabel->SetLabel(std::to_string(getSettings()->getPrinter()->getPosition().getY())); +} + +void PlottWareControlFrame::OnPrintingPrinterRightButtonClick(wxCommandEvent& event) +{ + getSettings()->getPrinter()->send("G91\nG1 X"+std::to_string(PrintingPrinterMoveSpinner->GetValue())+"G90"); + PrintingPrinterXLabel->SetLabel(std::to_string(getSettings()->getPrinter()->getPosition().getX())); + PrintingPrinterYLabel->SetLabel(std::to_string(getSettings()->getPrinter()->getPosition().getY())); +} + +void PlottWareControlFrame::OnPrintingPrinterLeftButtonClick(wxCommandEvent& event) +{ + getSettings()->getPrinter()->send("G91\nG1 X"+std::to_string(-PrintingPrinterMoveSpinner->GetValue())+"G90"); + PrintingPrinterXLabel->SetLabel(std::to_string(getSettings()->getPrinter()->getPosition().getX())); + PrintingPrinterYLabel->SetLabel(std::to_string(getSettings()->getPrinter()->getPosition().getY())); +} + +void PlottWareControlFrame::OnPrintingPrinterConsoleTextEnter(wxCommandEvent& event) +{ + getSettings()->getPrinter()->send(std::string(PrintingPrinterConsole->GetValue().mb_str())); + std::string r=getSettings()->getPrinter()->recv(); + PrintingPrinterLog->AppendAndEnsureVisible(r); + PrintingPrinterXLabel->SetLabel(std::to_string(getSettings()->getPrinter()->getPosition().getX())); + PrintingPrinterYLabel->SetLabel(std::to_string(getSettings()->getPrinter()->getPosition().getY())); +} + +void PlottWareControlFrame::OnPrintingPrintButtonClick(wxCommandEvent& event) +{ + if(getProject()->getGcode()->empty()){ + wxMessageDialog(this, _("Please generate some G code first!"), _("Error"), wxCENTER|wxOK|wxICON_ERROR).ShowModal(); + return; + } + //get line count (for status) + int lineNumber=std::count(getProject()->getGcode()->begin(), getProject()->getGcode()->end(), '\n'); + + //prepare UI + PrintingStatusGauge->SetRange(lineNumber); + PrintingStatusGauge->SetValue(0); + PrintingElapsedTimeLabel->SetLabel("00:00:00"); + printingControlShow(true); + + //start UI refresher + PrintingStopWatch.Start(); + PrintingElapsedTimeCheckerTimer.Start(1000); + + //set counter + getProject()->printStatus=0; + + //start printing + //print to log + PrintingPrinterLog->AppendAndEnsureVisible("Printing started"); + + //print!!! + getProject()->printStop=false; + std::istringstream print(*getProject()->getGcode()); + for(std::string line; std::getline(print, line);){ + //stop if we need so + if(getProject()->printStop){ + break; + } + + //log + PrintingPrinterLog->AppendAndEnsureVisible("Printing line #"+std::to_string(getProject()->printStatus)+" of "+std::to_string(lineNumber)); + + if(!getSettings()->getPrinter()->send(line+"\n")){ //if can't send there's some problem + break; + } + std::string r=getSettings()->getPrinter()->recv(); + getProject()->printStatus++; + if(r!="OK"){ + if(wxMessageDialog(this, _("Something went wrong. The printer responded with:")+r+_("\nWould you like to continue with the printing?"), _("Error"), wxCENTER|wxYES_NO|wxICON_ERROR).ShowModal()==wxID_YES){ + continue; + } + else{ + break; + } + } + + //update position + PrintingPrinterXLabel->SetLabel(std::to_string(getSettings()->getPrinter()->getPosition().getX())); + PrintingPrinterYLabel->SetLabel(std::to_string(getSettings()->getPrinter()->getPosition().getY())); + } + + //finish printing + wxMessageDialog(this, _("Printing finished!"), _("Info"), wxCENTER|wxOK|wxICON_INFORMATION).ShowModal(); + + //print to log + PrintingPrinterLog->AppendAndEnsureVisible("Printing finished"); + + //stop UI refresher + PrintingStopWatch.Pause(); + PrintingElapsedTimeCheckerTimer.Stop(); +} + +void PlottWareControlFrame::OnPrintingElapsedTimeCheckerTimerTrigger(wxTimerEvent& event) +{ + //update gauge + PrintingStatusGauge->SetValue(getProject()->printStatus); + + //update elapsed time + long sec=PrintingStopWatch.Time()/1000; + char time[15]; + sprintf(time, "%02i:%02i:%02i", sec/3600, sec%3600/60, sec%60); + PrintingElapsedTimeLabel->SetLabel(std::string(time)); +} + +void PlottWareControlFrame::OnPrintingStopButtonClick(wxCommandEvent& event) +{ + getProject()->printStop=true; +} + +void PlottWareControlFrame::OnPrintingEmergencyButtonClick(wxCommandEvent& event) +{ + //stop printing + getProject()->printStop=true; + //send emergency reset code + getSettings()->getPrinter()->send("M112\n"); + //disconnect from printer + getSettings()->getPrinter()->disconnect(); + + //update UI + printerControlEnable(false); + PrintingPrinterStatusLabel->SetLabel(_("Offline")); + PrintingPrinterPowerLabel->SetLabel(""); + PrintingPrinterConnectButton->SetLabel(_("Connect")); + PrintingPrinterXLabel->SetLabel(""); + PrintingPrinterYLabel->SetLabel(""); +} diff --git a/PlottWareControl/PlottWareControlMain.h b/PlottWareControl/PlottWareControlMain.h new file mode 100644 index 0000000..c1bbaed --- /dev/null +++ b/PlottWareControl/PlottWareControlMain.h @@ -0,0 +1,303 @@ +/*************************************************************** + * Name: PlottWareControlMain.h + * Purpose: Defines Application Frame + * Author: Fandly Gergo (fandlygergo@gmail.hu) + * Created: 2017-11-25 + * Copyright: Fandly Gergo (systemtest.tk) + * License: + **************************************************************/ + +#ifndef PLOTTWARECONTROLMAIN_H +#define PLOTTWARECONTROLMAIN_H + +#include +#include +#include + +#include "settings.h" +#include "project.h" + +//(*Headers(PlottWareControlFrame) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//*) + +class PlottWareControlFrame: public wxFrame +{ + public: + + PlottWareControlFrame(wxWindow* parent,wxWindowID id = -1); + virtual ~PlottWareControlFrame(); + Settings* getSettings(); + Project* getProject(); + + private: + + //(*Handlers(PlottWareControlFrame) + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + void OnListBox1Select(wxCommandEvent& event); + void OnScrollBar1Scroll(wxScrollEvent& event); + void OnMenuItemSettingsSelected(wxCommandEvent& event); + void OnProjNewButtonClick(wxCommandEvent& event); + void OnProjOpenButtonClick(wxCommandEvent& event); + void OnProjCloseButtonClick(wxCommandEvent& event); + void OnImagesAddButtonClick(wxCommandEvent& event); + void OnImagesDeleteButtonClick(wxCommandEvent& event); + void OnImagesImageListBoxSelect(wxCommandEvent& event); + void OnImagesPositionXSpinnerChange(wxSpinEvent& event); + void OnImagesPositionYSpinnerChange(wxSpinEvent& event); + void OnImagesCropX1SpinnerChange(wxSpinEvent& event); + void OnImagesCropY1SpinnerChange(wxSpinEvent& event); + void OnImagesCropX2SpinnerChange(wxSpinEvent& event); + void OnImagesCropY2SpinnerChange(wxSpinEvent& event); + void OnImagesPreviewButtonClick(wxCommandEvent& event); + void OnImagesImageListMoveUpButtonClick(wxCommandEvent& event); + void OnImagesImageListMoveDownButtonClick(wxCommandEvent& event); + void OnImagesScaleTextText(wxCommandEvent& event); + void OnProcessingRetrAllRadioSelect(wxCommandEvent& event); + void OnProcessingRetrExtRadioSelect(wxCommandEvent& event); + void OnProcessingCannyThreshSliderCmdScroll(wxScrollEvent& event); + void OnProcessingPreviewButtonClick(wxCommandEvent& event); + void OnProcessingColorLineSelectSelect(wxCommandEvent& event); + void OnProcessingColorColorSelectSelect(wxCommandEvent& event); + void OnProcessingColorForAllButtonClick(wxCommandEvent& event); + void OnGcodeGenerateButtonClick(wxCommandEvent& event); + void OnGcodeEditButtonClick(wxCommandEvent& event); + void OnGcodeExportButtonClick(wxCommandEvent& event); + void OnNotebook1PageChanged(wxNotebookEvent& event); + void OnPrintingPrinterConnectButtonClick(wxCommandEvent& event); + void OnPrintingPrinterHomeButtonClick(wxCommandEvent& event); + void OnPrintingPrinterPowerButtonClick(wxCommandEvent& event); + void OnPrintingPrinterHeadSelectSelect(wxCommandEvent& event); + void OnPrintingPrinterUpButtonClick(wxCommandEvent& event); + void OnPrintingPrinterDownButtonClick(wxCommandEvent& event); + void OnPrintingPrinterRightButtonClick(wxCommandEvent& event); + void OnPrintingPrinterLeftButtonClick(wxCommandEvent& event); + void OnPrintingPrinterConsoleText(wxCommandEvent& event); + void OnPrintingPrinterConsoleTextEnter(wxCommandEvent& event); + void OnPrintingPrintButtonClick(wxCommandEvent& event); + void OnPrintingElapsedTimeCheckerTimerTrigger(wxTimerEvent& event); + void OnButton1Click(wxCommandEvent& event); + void OnPrintingStopButtonClick(wxCommandEvent& event); + void OnPrintingEmergencyButtonClick(wxCommandEvent& event); + //*) + + //(*Identifiers(PlottWareControlFrame) + static const long ID_BUTTON1; + static const long ID_STATICTEXT1; + static const long ID_BUTTON2; + static const long ID_BUTTON3; + static const long ID_BUTTON4; + static const long ID_PANEL2; + static const long ID_STATICTEXT2; + static const long ID_LISTBOX1; + static const long ID_BUTTON5; + static const long ID_BUTTON6; + static const long ID_BUTTON9; + static const long ID_BUTTON23; + static const long ID_BUTTON24; + static const long ID_STATICTEXT25; + static const long ID_STATICTEXT26; + static const long ID_STATICTEXT27; + static const long ID_TEXTCTRL2; + static const long ID_SPINCTRL1; + static const long ID_SPINCTRL2; + static const long ID_SPINCTRL3; + static const long ID_SPINCTRL4; + static const long ID_SPINCTRL5; + static const long ID_SPINCTRL6; + static const long ID_STATICTEXT4; + static const long ID_STATICTEXT5; + static const long ID_STATICTEXT3; + static const long ID_STATICTEXT7; + static const long ID_STATICTEXT9; + static const long ID_STATICTEXT8; + static const long ID_STATICTEXT10; + static const long ID_STATICTEXT6; + static const long ID_PANEL3; + static const long ID_STATICTEXT12; + static const long ID_STATICTEXT11; + static const long ID_RADIOBUTTON1; + static const long ID_RADIOBUTTON2; + static const long ID_STATICTEXT13; + static const long ID_SLIDER1; + static const long ID_STATICTEXT14; + static const long ID_STATICTEXT15; + static const long ID_STATICTEXT16; + static const long ID_CHOICE1; + static const long ID_CHOICE2; + static const long ID_BUTTON25; + static const long ID_BUTTON8; + static const long ID_PANEL4; + static const long ID_STATICTEXT17; + static const long ID_BUTTON10; + static const long ID_BUTTON12; + static const long ID_BUTTON13; + static const long ID_PANEL5; + static const long ID_STATICTEXT18; + static const long ID_STATICTEXT19; + static const long ID_STATICTEXT20; + static const long ID_STATICTEXT21; + static const long ID_BUTTON7; + static const long ID_BUTTON16; + static const long ID_BUTTON17; + static const long ID_BUTTON18; + static const long ID_BUTTON19; + static const long ID_BUTTON20; + static const long ID_CHOICE3; + static const long ID_STATICTEXT22; + static const long ID_BUTTON21; + static const long ID_SPINCTRL7; + static const long ID_STATICTEXT24; + static const long ID_STATICTEXT23; + static const long ID_STATICTEXT28; + static const long ID_STATICTEXT29; + static const long ID_STATICTEXT30; + static const long ID_STATICTEXT32; + static const long ID_STATICTEXT33; + static const long ID_STATICTEXT31; + static const long ID_TEXTCTRL1; + static const long ID_LISTBOX2; + static const long ID_STATICTEXT34; + static const long ID_PANEL1; + static const long ID_BUTTON11; + static const long ID_BUTTON14; + static const long ID_BUTTON15; + static const long ID_STATICTEXT35; + static const long ID_GAUGE1; + static const long ID_STATICTEXT36; + static const long ID_STATICTEXT37; + static const long ID_PANEL6; + static const long ID_NOTEBOOK2; + static const long MenuSettingItem; + static const long MenuQuitItem; + static const long idMenuAbout; + static const long ID_STATUSBAR1; + static const long ID_MESSAGEDIALOG1; + static const long ID_TIMER1; + //*) + + //(*Declarations(PlottWareControlFrame) + wxStaticText* StaticText10; + wxStaticText* StaticText22; + wxSpinCtrl* ImagesCropX1Spinner; + wxStaticText* StaticText9; + wxStaticText* StaticText20; + wxChoice* ProcessingColorLineSelect; + wxButton* ProjCloseButton; + wxListBox* ImagesImageListBox; + wxNotebook* MenuChanger; + wxButton* ProcessingColorForAllButton; + wxButton* ImagesPreviewButton; + wxStaticText* StaticText29; + wxButton* PrintingEmergencyButton; + wxStaticText* StaticText13; + wxStaticText* StaticText2; + wxStaticText* StaticText14; + wxRadioButton* ProcessingRetrAllRadio; + wxStaticText* PrintingStatusLabel; + wxPanel* MenuChangerProjectPage; + wxStaticText* StaticText26; + wxStaticText* StaticText6; + wxSpinCtrl* ImagesPositionXSpinner; + wxPanel* MenuChangerPrintingPage; + wxChoice* ProcessingColorColorSelect; + wxButton* PrintingPrinterPowerButton; + wxButton* PrintingPrinterConnectButton; + wxSpinCtrl* ImagesCropY1Spinner; + wxSpinCtrl* ImagesCropY2Spinner; + wxButton* ImagesImageListMoveDownButton; + wxStaticText* StaticText19; + wxRadioButton* ProcessingRetrExtRadio; + wxButton* ProjOpenButton; + wxStaticText* StaticText8; + wxTextCtrl* ImagesScaleText; + wxStaticText* StaticText11; + wxStaticText* StaticText18; + wxButton* PrintingPrinterRightButton; + wxButton* PrintingPrinterDownButton; + wxStaticText* PrintingPrinterStatusLabel; + wxPanel* Panel1; + wxStaticText* StaticText1; + wxStaticText* StaticText27; + wxFileDialog* FileDialog1; + wxButton* ImagesDeleteButton; + wxPanel* MenuChangerProcessingPage; + wxStaticText* StaticText3; + wxSpinCtrl* ImagesCropX2Spinner; + wxButton* PrintingStopButton; + wxListBox* PrintingPrinterLog; + wxButton* GcodeEditButton; + wxTextCtrl* PrintingPrinterConsole; + wxStaticText* StaticText21; + wxTimer PrintingElapsedTimeCheckerTimer; + wxStaticText* StaticText23; + wxButton* ProcessingPreviewButton; + wxStaticText* StaticText24; + wxButton* ImagesAddButton; + wxButton* PrintingPrinterUpButton; + wxPanel* MenuChangerGcodePage; + wxStaticText* PrintingPrinterPowerLabel; + wxStaticText* StaticText5; + wxStaticText* StaticText7; + wxButton* ProjNewButton; + wxButton* PrintingPrinterLeftButton; + wxStatusBar* StatusBar1; + wxButton* ImagesImageListMoveUpButton; + wxStopWatch PrintingStopWatch; + wxButton* PrintingPrinterHomeButton; + wxSlider* ProcessingCannyThreshSlider; + wxStaticText* StaticText28; + wxGauge* PrintingStatusGauge; + wxChoice* PrintingPrinterHeadSelect; + wxPanel* MenuChangerImagesPage; + wxStaticText* ImagesSizeLabel; + wxStaticText* StaticText15; + wxStaticText* StaticText12; + wxButton* ProjSaveButton; + wxStaticText* PrintingPrinterYLabel; + wxStaticText* PrintingElapsedTimeLabelLabel; + wxMessageDialog* MessageDialog1; + wxMenuItem* MenuItemSettings; + wxStaticText* StaticText25; + wxStaticText* StaticText17; + wxStaticText* StaticText4; + wxButton* GcodeExportButton; + wxStaticText* PrintingElapsedTimeLabel; + wxStaticText* PrintingPrinterXLabel; + wxStaticText* StaticText16; + wxButton* PrintingPrintButton; + wxSpinCtrl* PrintingPrinterMoveSpinner; + wxSpinCtrl* ImagesPositionYSpinner; + wxButton* GcodeGenerateButton; + //*) + + DECLARE_EVENT_TABLE() + + Settings *settings; + Project *project; + + //helper functions + void projectControlEnable(bool to); + void printerControlEnable(bool to); + void printingControlShow(bool to); +}; + +#endif // PLOTTWARECONTROLMAIN_H diff --git a/PlottWareControl/Release/PlottWareControl.exe b/PlottWareControl/Release/PlottWareControl.exe new file mode 100644 index 0000000..790c9f0 Binary files /dev/null and b/PlottWareControl/Release/PlottWareControl.exe differ diff --git a/PlottWareControl/Release/Release.zip b/PlottWareControl/Release/Release.zip new file mode 100644 index 0000000..5f1804f Binary files /dev/null and b/PlottWareControl/Release/Release.zip differ diff --git a/PlottWareControl/Release/libopencv_core331.dll b/PlottWareControl/Release/libopencv_core331.dll new file mode 100644 index 0000000..d6f7cbe Binary files /dev/null and b/PlottWareControl/Release/libopencv_core331.dll differ diff --git a/PlottWareControl/Release/libopencv_highgui331.dll b/PlottWareControl/Release/libopencv_highgui331.dll new file mode 100644 index 0000000..ce60d67 Binary files /dev/null and b/PlottWareControl/Release/libopencv_highgui331.dll differ diff --git a/PlottWareControl/Release/libopencv_imgcodecs331.dll b/PlottWareControl/Release/libopencv_imgcodecs331.dll new file mode 100644 index 0000000..5bf2275 Binary files /dev/null and b/PlottWareControl/Release/libopencv_imgcodecs331.dll differ diff --git a/PlottWareControl/Release/libopencv_imgproc331.dll b/PlottWareControl/Release/libopencv_imgproc331.dll new file mode 100644 index 0000000..78b9c71 Binary files /dev/null and b/PlottWareControl/Release/libopencv_imgproc331.dll differ diff --git a/PlottWareControl/Release/res/gCode.txt b/PlottWareControl/Release/res/gCode.txt new file mode 100644 index 0000000..9c78a03 --- /dev/null +++ b/PlottWareControl/Release/res/gCode.txt @@ -0,0 +1,21 @@ +commands: +G0 Xx Yy - Rapid move to (z,y) coordinates +G1 Xx Yy - Move to (x,y) coordinates +G4 Pn - Wait n ms +M300 S10 - Pen down +M300 S50 - Pen up +Tn - change to nth tool +G28 - Home +G90 - Set to absolute positioning +G91 - Set to relative positioning +M2 - Program end +M17 - Enable steppers +M18 - Disable steppers +M80 - ATX power on +M81 - ATX power off +M112 - Emergency stop +M114 - Get current position +M703 - Get info from printer firmware +M118 OK - Response to host when line done +; - line comment +(...) - block comment \ No newline at end of file diff --git a/PlottWareControl/Release/res/icon.bmp b/PlottWareControl/Release/res/icon.bmp new file mode 100644 index 0000000..e83a7dd Binary files /dev/null and b/PlottWareControl/Release/res/icon.bmp differ diff --git a/PlottWareControl/Release/wxbase30u_gcc510TDM_x64.dll b/PlottWareControl/Release/wxbase30u_gcc510TDM_x64.dll new file mode 100644 index 0000000..b613975 Binary files /dev/null and b/PlottWareControl/Release/wxbase30u_gcc510TDM_x64.dll differ diff --git a/PlottWareControl/Release/wxmsw30u_core_gcc510TDM_x64.dll b/PlottWareControl/Release/wxmsw30u_core_gcc510TDM_x64.dll new file mode 100644 index 0000000..eda5c51 Binary files /dev/null and b/PlottWareControl/Release/wxmsw30u_core_gcc510TDM_x64.dll differ diff --git a/PlottWareControl/SettingDialog.cpp b/PlottWareControl/SettingDialog.cpp new file mode 100644 index 0000000..a85141f --- /dev/null +++ b/PlottWareControl/SettingDialog.cpp @@ -0,0 +1,189 @@ +#include "SettingDialog.h" + +#include +#include "printer.h" + +//(*InternalHeaders(SettingDialog) + #include + #include + #include + #include + //*) + +//(*IdInit(SettingDialog) + const long SettingDialog::ID_STATICTEXT1 = wxNewId(); + const long SettingDialog::ID_STATICBOX1 = wxNewId(); + const long SettingDialog::ID_STATICTEXT2 = wxNewId(); + const long SettingDialog::ID_SPINCTRL1 = wxNewId(); + const long SettingDialog::ID_STATICTEXT3 = wxNewId(); + const long SettingDialog::ID_STATICTEXT4 = wxNewId(); + const long SettingDialog::ID_SPINCTRL2 = wxNewId(); + const long SettingDialog::ID_STATICTEXT5 = wxNewId(); + const long SettingDialog::ID_STATICTEXT6 = wxNewId(); + const long SettingDialog::ID_SPINCTRL3 = wxNewId(); + const long SettingDialog::ID_STATICTEXT7 = wxNewId(); + const long SettingDialog::ID_LISTBOX1 = wxNewId(); + const long SettingDialog::ID_TEXTCTRL1 = wxNewId(); + const long SettingDialog::ID_STATICTEXT8 = wxNewId(); + const long SettingDialog::ID_BUTTON1 = wxNewId(); + const long SettingDialog::ID_STATICLINE1 = wxNewId(); + const long SettingDialog::ID_STATICTEXT9 = wxNewId(); + const long SettingDialog::ID_STATICTEXT10 = wxNewId(); + const long SettingDialog::ID_BUTTON2 = wxNewId(); + const long SettingDialog::ID_STATICTEXT11 = wxNewId(); + const long SettingDialog::ID_CHECKBOX1 = wxNewId(); + const long SettingDialog::ID_BUTTON3 = wxNewId(); + const long SettingDialog::ID_BUTTON4 = wxNewId(); + const long SettingDialog::ID_CHOICE2 = wxNewId(); + const long SettingDialog::ID_SPINCTRL4 = wxNewId(); + const long SettingDialog::ID_STATICTEXT12 = wxNewId(); + const long SettingDialog::ID_MESSAGEDIALOG1 = wxNewId(); + //*) + +BEGIN_EVENT_TABLE(SettingDialog,wxDialog) + //(*EventTable(SettingDialog) + //*) +END_EVENT_TABLE() + +SettingDialog::SettingDialog(wxWindow* parent,wxWindowID id,PlottWareControlFrame *_p) +{ + p=_p; + //(*Initialize(SettingDialog) + Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id")); + SetClientSize(wxSize(389,432)); + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Settings"), wxPoint(0,8), wxDefaultSize, 0, _T("ID_STATICTEXT1")); + wxFont StaticText1Font(14,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT); + StaticText1->SetFont(StaticText1Font); + StaticBox1 = new wxStaticBox(this, ID_STATICBOX1, _("Printer"), wxPoint(8,48), wxSize(376,280), 0, _T("ID_STATICBOX1")); + StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Length:"), wxPoint(32,72), wxDefaultSize, 0, _T("ID_STATICTEXT2")); + LengthSpinner = new wxSpinCtrl(this, ID_SPINCTRL1, _T("0"), wxPoint(104,64), wxDefaultSize, 0, -1, 100000, 0, _T("ID_SPINCTRL1")); + LengthSpinner->SetValue(_T("0")); + LengthSpinner->SetToolTip(_("Length of printing area (-1 for infinite)")); + StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("mm"), wxPoint(248,72), wxDefaultSize, 0, _T("ID_STATICTEXT3")); + StaticText4 = new wxStaticText(this, ID_STATICTEXT4, _("Width:"), wxPoint(32,96), wxDefaultSize, 0, _T("ID_STATICTEXT4")); + WidthSpinner = new wxSpinCtrl(this, ID_SPINCTRL2, _T("0"), wxPoint(104,88), wxDefaultSize, 0, -1, 100000, 0, _T("ID_SPINCTRL2")); + WidthSpinner->SetValue(_T("0")); + WidthSpinner->SetToolTip(_("Width of printing area (-1 for infinite)")); + StaticText5 = new wxStaticText(this, ID_STATICTEXT5, _("mm"), wxPoint(248,96), wxDefaultSize, 0, _T("ID_STATICTEXT5")); + StaticText6 = new wxStaticText(this, ID_STATICTEXT6, _("Pen count:"), wxPoint(32,120), wxDefaultSize, 0, _T("ID_STATICTEXT6")); + PencountSpinner = new wxSpinCtrl(this, ID_SPINCTRL3, _T("0"), wxPoint(104,112), wxDefaultSize, 0, 0, 100, 0, _T("ID_SPINCTRL3")); + PencountSpinner->SetValue(_T("0")); + PencountSpinner->SetToolTip(_("Number of available drawing pens")); + StaticText7 = new wxStaticText(this, ID_STATICTEXT7, _("Pens:"), wxPoint(32,144), wxDefaultSize, 0, _T("ID_STATICTEXT7")); + PensListBox = new wxListBox(this, ID_LISTBOX1, wxPoint(104,136), wxSize(120,80), 0, 0, 0, wxDefaultValidator, _T("ID_LISTBOX1")); + PensListBox->SetToolTip(_("List of pens")); + PenColorText = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxPoint(264,152), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); + PenColorText->SetToolTip(_("Color of pen")); + StaticText8 = new wxStaticText(this, ID_STATICTEXT8, _("Color:"), wxPoint(232,160), wxDefaultSize, 0, _T("ID_STATICTEXT8")); + PenColorSetButton = new wxButton(this, ID_BUTTON1, _("Set"), wxPoint(232,176), wxSize(136,23), 0, wxDefaultValidator, _T("ID_BUTTON1")); + PenColorSetButton->SetToolTip(_("Set color")); + StaticLine1 = new wxStaticLine(this, ID_STATICLINE1, wxPoint(24,232), wxSize(344,3), wxLI_HORIZONTAL, _T("ID_STATICLINE1")); + StaticText9 = new wxStaticText(this, ID_STATICTEXT9, _("Serial port:"), wxPoint(32,248), wxDefaultSize, 0, _T("ID_STATICTEXT9")); + StaticText10 = new wxStaticText(this, ID_STATICTEXT10, _("Baud rate:"), wxPoint(32,272), wxDefaultSize, 0, _T("ID_STATICTEXT10")); + PrinterAutoDetectButton = new wxButton(this, ID_BUTTON2, _("Auto detect"), wxPoint(32,296), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); + PrinterAutoDetectButton->SetToolTip(_("Auto detect printer settings (only works if serial port and baud rate is set)")); + StaticText11 = new wxStaticText(this, ID_STATICTEXT11, _("Debug mode:"), wxPoint(16,352), wxDefaultSize, 0, _T("ID_STATICTEXT11")); + DebugModeCheck = new wxCheckBox(this, ID_CHECKBOX1, _("Enable"), wxPoint(96,352), wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1")); + DebugModeCheck->SetValue(false); + DebugModeCheck->SetToolTip(_("Enable debug mode (show stages of image processing)")); + SaveSettingsButton = new wxButton(this, ID_BUTTON3, _("Save"), wxPoint(176,384), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3")); + SaveSettingsButton->SetToolTip(_("Save settings")); + CancelSettingsButton = new wxButton(this, ID_BUTTON4, _("Cancel"), wxPoint(272,384), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON4")); + CancelSettingsButton->SetToolTip(_("Dismiss changes")); + BaudRateChoice = new wxChoice(this, ID_CHOICE2, wxPoint(104,264), wxSize(120,21), 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE2")); + BaudRateChoice->SetSelection( BaudRateChoice->Append(_("300")) ); + BaudRateChoice->Append(_("600")); + BaudRateChoice->Append(_("1200")); + BaudRateChoice->Append(_("2400")); + BaudRateChoice->Append(_("4800")); + BaudRateChoice->Append(_("9600")); + BaudRateChoice->Append(_("14400")); + BaudRateChoice->Append(_("19200")); + BaudRateChoice->Append(_("28800")); + BaudRateChoice->Append(_("38400")); + BaudRateChoice->Append(_("57600")); + BaudRateChoice->Append(_("115200")); + BaudRateChoice->SetToolTip(_("Baud rate of device")); + SerialPortSpinner = new wxSpinCtrl(this, ID_SPINCTRL4, _T("0"), wxPoint(136,240), wxSize(88,21), 0, 0, 100, 0, _T("ID_SPINCTRL4")); + SerialPortSpinner->SetValue(_T("0")); + SerialPortSpinner->SetToolTip(_("Serial port on which the plotter is connected")); + StaticText12 = new wxStaticText(this, ID_STATICTEXT12, _("COM"), wxPoint(104,248), wxDefaultSize, 0, _T("ID_STATICTEXT12")); + MessageDialog1 = new wxMessageDialog(this, wxEmptyString, _("Message"), wxOK|wxCANCEL, wxDefaultPosition); + + Connect(ID_SPINCTRL3,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)&SettingDialog::OnPencountSpinnerChange); + Connect(ID_LISTBOX1,wxEVT_COMMAND_LISTBOX_SELECTED,(wxObjectEventFunction)&SettingDialog::OnPensListBoxSelect); + Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SettingDialog::OnPenColorSetButtonClick); + Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SettingDialog::OnPrinterAutoDetectButtonClick); + Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SettingDialog::OnSaveSettingsButtonClick); + Connect(ID_BUTTON4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&SettingDialog::OnCancelSettingsButtonClick); + //*) + + //Load default values + LengthSpinner->SetValue(p->getSettings()->getPrinter()->getLength()); + WidthSpinner->SetValue(p->getSettings()->getPrinter()->getWidth()); + PencountSpinner->SetValue(p->getSettings()->getPrinter()->getPenCount()); + s_pens=p->getSettings()->getPrinter()->getPens(); + for(int i=0; iAppend(s_pens[i]); + } + SerialPortSpinner->SetValue(p->getSettings()->getPrinter()->getPortInt()); + BaudRateChoice->SetSelection(BaudRateChoice->FindString(std::to_string(p->getSettings()->getPrinter()->getBaudRate()))!=wxNOT_FOUND?BaudRateChoice->FindString(std::to_string(p->getSettings()->getPrinter()->getBaudRate())):0); + DebugModeCheck->SetValue(p->getSettings()->isDebug()); +} + +SettingDialog::~SettingDialog() +{ + //(*Destroy(SettingDialog) + //*) +} + +void SettingDialog::OnCancelSettingsButtonClick(wxCommandEvent& event) +{ + this->Destroy(); +} + +void SettingDialog::OnPencountSpinnerChange(wxSpinEvent& event) +{ + PensListBox->Clear(); + s_pens.clear(); + for(int i=0; iGetValue(); i++){ + PensListBox->Append("<<"+std::to_string(i)+">>"); + s_pens[i]="<<"+std::to_string(i)+">>"; + } + PensListBox->SetSelection(0); +} + +void SettingDialog::OnPenColorSetButtonClick(wxCommandEvent& event) +{ + int sel=PensListBox->GetSelection(); + std::string val=std::string(PenColorText->GetValue().mb_str()); + PensListBox->SetString(sel, val); + s_pens[sel]=val; +} + +void SettingDialog::OnPensListBoxSelect(wxCommandEvent& event) +{ + PenColorText->SetValue(PensListBox->GetString(PensListBox->GetSelection())); +} + +void SettingDialog::OnSaveSettingsButtonClick(wxCommandEvent& event) +{ + Printer printer=Printer(LengthSpinner->GetValue(), WidthSpinner->GetValue(), PencountSpinner->GetValue(), s_pens, SerialPortSpinner->GetValue(), std::stol(std::string(BaudRateChoice->GetString(BaudRateChoice->GetSelection()).mb_str()))); + p->getSettings()->setSettings(printer, DebugModeCheck->GetValue()); + this->Destroy(); +} + +void SettingDialog::OnPrinterAutoDetectButtonClick(wxCommandEvent& event) +{ + p->getSettings()->getPrinter()->setComParameters(SerialPortSpinner->GetValue(), std::stol(std::string(BaudRateChoice->GetString(BaudRateChoice->GetSelection()).mb_str()))); + if(!p->getSettings()->getPrinter()->connect()){ + wxMessageDialog(this, _("Can not connect to printer. Please recheck the settings!"), _("Error"), wxCENTER|wxOK|wxICON_ERROR).ShowModal(); + return; + } + if(!p->getSettings()->getPrinter()->autoDetect()){ + wxMessageDialog(this, _("Can not parse the output of auto-detect command (M703). Is your software compatible?"), _("Warning"), wxCENTER|wxOK|wxICON_WARNING).ShowModal(); + return; + } + wxMessageDialog(this, _("Settings successfully detected!"), _("Info"), wxCENTER|wxOK|wxICON_INFORMATION).ShowModal(); +} diff --git a/PlottWareControl/SettingDialog.h b/PlottWareControl/SettingDialog.h new file mode 100644 index 0000000..9b225b6 --- /dev/null +++ b/PlottWareControl/SettingDialog.h @@ -0,0 +1,110 @@ +#ifndef SETTINGDIALOG_H +#define SETTINGDIALOG_H + +#include +#include +#include "settings.h" +#include "PlottWareControlMain.h" + +//(*Headers(SettingDialog) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//*) + +class SettingDialog: public wxDialog +{ + public: + + SettingDialog(wxWindow* parent,wxWindowID id=wxID_ANY,PlottWareControlFrame *_p=NULL); + virtual ~SettingDialog(); + + //(*Declarations(SettingDialog) + wxStaticText* StaticText10; + wxCheckBox* DebugModeCheck; + wxTextCtrl* PenColorText; + wxStaticText* StaticText9; + wxButton* CancelSettingsButton; + wxChoice* BaudRateChoice; + wxButton* PrinterAutoDetectButton; + wxStaticText* StaticText2; + wxStaticText* StaticText6; + wxListBox* PensListBox; + wxSpinCtrl* PencountSpinner; + wxStaticText* StaticText8; + wxStaticText* StaticText11; + wxButton* PenColorSetButton; + wxStaticText* StaticText1; + wxStaticText* StaticText3; + wxSpinCtrl* LengthSpinner; + wxStaticBox* StaticBox1; + wxSpinCtrl* WidthSpinner; + wxButton* SaveSettingsButton; + wxSpinCtrl* SerialPortSpinner; + wxStaticText* StaticText5; + wxStaticText* StaticText7; + wxStaticLine* StaticLine1; + wxStaticText* StaticText12; + wxMessageDialog* MessageDialog1; + wxStaticText* StaticText4; + //*) + + protected: + + //(*Identifiers(SettingDialog) + static const long ID_STATICTEXT1; + static const long ID_STATICBOX1; + static const long ID_STATICTEXT2; + static const long ID_SPINCTRL1; + static const long ID_STATICTEXT3; + static const long ID_STATICTEXT4; + static const long ID_SPINCTRL2; + static const long ID_STATICTEXT5; + static const long ID_STATICTEXT6; + static const long ID_SPINCTRL3; + static const long ID_STATICTEXT7; + static const long ID_LISTBOX1; + static const long ID_TEXTCTRL1; + static const long ID_STATICTEXT8; + static const long ID_BUTTON1; + static const long ID_STATICLINE1; + static const long ID_STATICTEXT9; + static const long ID_STATICTEXT10; + static const long ID_BUTTON2; + static const long ID_STATICTEXT11; + static const long ID_CHECKBOX1; + static const long ID_BUTTON3; + static const long ID_BUTTON4; + static const long ID_CHOICE2; + static const long ID_SPINCTRL4; + static const long ID_STATICTEXT12; + static const long ID_MESSAGEDIALOG1; + //*) + + private: + + //(*Handlers(SettingDialog) + void OnSpinCtrl1Change(wxSpinEvent& event); + void OnCancelSettingsButtonClick(wxCommandEvent& event); + void OnPencountSpinnerChange(wxSpinEvent& event); + void OnPenColorSetButtonClick(wxCommandEvent& event); + void OnPensListBoxSelect(wxCommandEvent& event); + void OnSaveSettingsButtonClick(wxCommandEvent& event); + void OnPrinterAutoDetectButtonClick(wxCommandEvent& event); + //*) + + DECLARE_EVENT_TABLE() + + PlottWareControlFrame *p; + std::map s_pens; +}; + +#endif diff --git a/PlottWareControl/bin/Debug/PlottWareControl.exe b/PlottWareControl/bin/Debug/PlottWareControl.exe new file mode 100644 index 0000000..565cbef Binary files /dev/null and b/PlottWareControl/bin/Debug/PlottWareControl.exe differ diff --git a/PlottWareControl/bin/Release/PlottWareControl.exe b/PlottWareControl/bin/Release/PlottWareControl.exe new file mode 100644 index 0000000..790c9f0 Binary files /dev/null and b/PlottWareControl/bin/Release/PlottWareControl.exe differ diff --git a/PlottWareControl/image.cpp b/PlottWareControl/image.cpp new file mode 100644 index 0000000..b8fdccd --- /dev/null +++ b/PlottWareControl/image.cpp @@ -0,0 +1,67 @@ +#include "image.h" + +Image::Image(){ + filename=""; + scale=1; +} + +Image::Image(std::string _filename){ + filename=_filename; + scale=1; + load(); +} + +Image::~Image(){ + img.release(); +} + +std::string Image::getFilename(){ + return filename; +} + +cv::Mat* Image::getMat(){ + return &img; +} + +Point Image::getPosition(){ + return position; +} + +Point Image::getCrop1(){ + return crop1; +} + +Point Image::getCrop2(){ + return crop2; +} + +double Image::getScale(){ + return scale; +} + +void Image::setScale(double _scale){ + scale=_scale; +} + +void Image::setFilename(std::string _filename){ + filename=_filename; +} + +bool Image::load(){ + img=cv::imread(filename, CV_LOAD_IMAGE_COLOR); + if(!img.data){ + fprintf(stderr, "Error> Image can not be found or can not be loaded. At: Image::load() (file: %s, line: %d)\n", __FILE__, __LINE__); + return false; + } + crop2=Point(img.cols, img.rows); + return true; +} + +void Image::setPosition(Point _position){ + position=_position; +} + +void Image::setCrop(Point _crop1, Point _crop2){ + crop1=_crop1; + crop2=_crop2; +} diff --git a/PlottWareControl/image.h b/PlottWareControl/image.h new file mode 100644 index 0000000..7f89422 --- /dev/null +++ b/PlottWareControl/image.h @@ -0,0 +1,32 @@ +#ifndef IMAGE_H_INCLUDED +#define IMAGE_H_INCLUDED + +#include +#include +#include "point.h" + +class Image{ + std::string filename; + cv::Mat img; + Point position; + Point crop1; + Point crop2; + double scale; +public: + Image(); + Image(std::string _filename); + ~Image(); + std::string getFilename(); + cv::Mat* getMat(); + Point getPosition(); + Point getCrop1(); + Point getCrop2(); + double getScale(); + void setScale(double _scale); + void setFilename(std::string _filename); + bool load(); + void setPosition(Point _position); + void setCrop(Point _crop1, Point _crop2); +}; + +#endif // IMAGE_H_INCLUDED diff --git a/PlottWareControl/imageViewer.cpp b/PlottWareControl/imageViewer.cpp new file mode 100644 index 0000000..afdb862 --- /dev/null +++ b/PlottWareControl/imageViewer.cpp @@ -0,0 +1,40 @@ +#include "imageViewer.h" + +ImageViewer::ImageViewer(){ + name=""; +} + +ImageViewer::ImageViewer(cv::Mat* _img, std::string _name){ + img=_img; + name=_name; +} + +ImageViewer::ImageViewer(cv::Mat _cimg, std::string _name){ + cimg=_cimg; + name=_name; + img=&cimg; +} + +ImageViewer::~ImageViewer(){ + show(false); + img->release(); +} + +void ImageViewer::assignImage(cv::Mat* _img){ + img=_img; +} + +void ImageViewer::show(bool show){ + if(show){ + cv::namedWindow(name, CV_WINDOW_AUTOSIZE); + cv::imshow(name, *img); + } + else{ + cv::destroyWindow(name); + } +} + +void ImageViewer::refresh(){ + show(false); + show(true); +} diff --git a/PlottWareControl/imageViewer.h b/PlottWareControl/imageViewer.h new file mode 100644 index 0000000..271ce53 --- /dev/null +++ b/PlottWareControl/imageViewer.h @@ -0,0 +1,23 @@ +#ifndef IMAGEVIEWER_H_INCLUDED +#define IMAGEVIEWER_H_INCLUDED + +#include +#include +#include +#include + +class ImageViewer{ + cv::Mat* img; + cv::Mat cimg; + std::string name; +public: + ImageViewer(); + ImageViewer(cv::Mat* _img, std::string _name); + ImageViewer(cv::Mat _cimg, std::string _name); + ~ImageViewer(); + void assignImage(cv::Mat* _img); + void show(bool show=true); + void refresh(); +}; + +#endif // IMAGEVIEWER_H_INCLUDED diff --git a/PlottWareControl/json.hpp b/PlottWareControl/json.hpp new file mode 100644 index 0000000..5ca5c10 --- /dev/null +++ b/PlottWareControl/json.hpp @@ -0,0 +1,14742 @@ +/* + __ _____ _____ _____ + __| | __| | | | JSON for Modern C++ +| | |__ | | | | | | version 2.1.1 +|_____|_____|_____|_|___| https://github.com/nlohmann/json + +Licensed under the MIT License . +Copyright (c) 2013-2017 Niels Lohmann . + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#ifndef NLOHMANN_JSON_HPP +#define NLOHMANN_JSON_HPP + +#include // all_of, copy, fill, find, for_each, generate_n, none_of, remove, reverse, transform +#include // array +#include // assert +#include // and, not, or +#include // lconv, localeconv +#include // isfinite, labs, ldexp, signbit +#include // nullptr_t, ptrdiff_t, size_t +#include // int64_t, uint64_t +#include // abort, strtod, strtof, strtold, strtoul, strtoll, strtoull +#include // memcpy, strlen +#include // forward_list +#include // function, hash, less +#include // initializer_list +#include // hex +#include // istream, ostream +#include // advance, begin, back_inserter, bidirectional_iterator_tag, distance, end, inserter, iterator, iterator_traits, next, random_access_iterator_tag, reverse_iterator +#include // numeric_limits +#include // locale +#include // map +#include // addressof, allocator, allocator_traits, unique_ptr +#include // accumulate +#include // stringstream +#include // getline, stoi, string, to_string +#include // add_pointer, conditional, decay, enable_if, false_type, integral_constant, is_arithmetic, is_base_of, is_const, is_constructible, is_convertible, is_default_constructible, is_enum, is_floating_point, is_integral, is_nothrow_move_assignable, is_nothrow_move_constructible, is_pointer, is_reference, is_same, is_scalar, is_signed, remove_const, remove_cv, remove_pointer, remove_reference, true_type, underlying_type +#include // declval, forward, make_pair, move, pair, swap +#include // valarray +#include // vector + +#undef assert +#define assert(_Expression) \ + (void) \ + ((!!(_Expression)) || \ + (_assert(#_Expression,__FILE__,__LINE__),0)) + +// exclude unsupported compilers +#if defined(__clang__) + #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 + #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" + #endif +#elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) + #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40900 + #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" + #endif +#endif + +// disable float-equal warnings on GCC/clang +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + +// disable documentation warnings on clang +#if defined(__clang__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdocumentation" +#endif + +// allow for portable deprecation warnings +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) + #define JSON_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) + #define JSON_DEPRECATED __declspec(deprecated) +#else + #define JSON_DEPRECATED +#endif + +// allow to disable exceptions +#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && not defined(JSON_NOEXCEPTION) + #define JSON_THROW(exception) throw exception + #define JSON_TRY try + #define JSON_CATCH(exception) catch(exception) +#else + #define JSON_THROW(exception) std::abort() + #define JSON_TRY if(true) + #define JSON_CATCH(exception) if(false) +#endif + +// manual branch prediction +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) + #define JSON_LIKELY(x) __builtin_expect(!!(x), 1) + #define JSON_UNLIKELY(x) __builtin_expect(!!(x), 0) +#else + #define JSON_LIKELY(x) x + #define JSON_UNLIKELY(x) x +#endif + +// cpp language standard detection +#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 +#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) + #define JSON_HAS_CPP_14 +#endif + +/*! +@brief namespace for Niels Lohmann +@see https://github.com/nlohmann +@since version 1.0.0 +*/ +namespace nlohmann +{ +template +struct adl_serializer; + +// forward declaration of basic_json (required to split the class) +template class ObjectType = + std::map, + template class ArrayType = std::vector, + class StringType = std::string, class BooleanType = bool, + class NumberIntegerType = std::int64_t, + class NumberUnsignedType = std::uint64_t, + class NumberFloatType = double, + template class AllocatorType = std::allocator, + template class JSONSerializer = + adl_serializer> +class basic_json; + +// Ugly macros to avoid uglier copy-paste when specializing basic_json +// This is only temporary and will be removed in 3.0 + +#define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ + template class ObjectType, \ + template class ArrayType, \ + class StringType, class BooleanType, class NumberIntegerType, \ + class NumberUnsignedType, class NumberFloatType, \ + template class AllocatorType, \ + template class JSONSerializer> + +#define NLOHMANN_BASIC_JSON_TPL \ + basic_json + + +/*! +@brief unnamed namespace with internal helper functions + +This namespace collects some functions that could not be defined inside the +@ref basic_json class. + +@since version 2.1.0 +*/ +namespace detail +{ +//////////////// +// exceptions // +//////////////// + +/*! +@brief general exception of the @ref basic_json class + +This class is an extension of `std::exception` objects with a member @a id for +exception ids. It is used as the base class for all exceptions thrown by the +@ref basic_json class. This class can hence be used as "wildcard" to catch +exceptions. + +Subclasses: +- @ref parse_error for exceptions indicating a parse error +- @ref invalid_iterator for exceptions indicating errors with iterators +- @ref type_error for exceptions indicating executing a member function with + a wrong type +- @ref out_of_range for exceptions indicating access out of the defined range +- @ref other_error for exceptions indicating other library errors + +@internal +@note To have nothrow-copy-constructible exceptions, we internally use + `std::runtime_error` which can cope with arbitrary-length error messages. + Intermediate strings are built with static functions and then passed to + the actual constructor. +@endinternal + +@liveexample{The following code shows how arbitrary library exceptions can be +caught.,exception} + +@since version 3.0.0 +*/ +class exception : public std::exception +{ + public: + /// returns the explanatory string + const char* what() const noexcept override + { + return m.what(); + } + + /// the id of the exception + const int id; + + protected: + exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} + + static std::string name(const std::string& ename, int id_) + { + return "[json.exception." + ename + "." + std::to_string(id_) + "] "; + } + + private: + /// an exception object as storage for error messages + std::runtime_error m; +}; + +/*! +@brief exception indicating a parse error + +This excpetion is thrown by the library when a parse error occurs. Parse errors +can occur during the deserialization of JSON text, CBOR, MessagePack, as well +as when using JSON Patch. + +Member @a byte holds the byte index of the last read character in the input +file. + +Exceptions have ids 1xx. + +name / id | example message | description +------------------------------ | --------------- | ------------------------- +json.exception.parse_error.101 | parse error at 2: unexpected end of input; expected string literal | This error indicates a syntax error while deserializing a JSON text. The error message describes that an unexpected token (character) was encountered, and the member @a byte indicates the error position. +json.exception.parse_error.102 | parse error at 14: missing or wrong low surrogate | JSON uses the `\uxxxx` format to describe Unicode characters. Code points above above 0xFFFF are split into two `\uxxxx` entries ("surrogate pairs"). This error indicates that the surrogate pair is incomplete or contains an invalid code point. +json.exception.parse_error.103 | parse error: code points above 0x10FFFF are invalid | Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid. +json.exception.parse_error.104 | parse error: JSON patch must be an array of objects | [RFC 6902](https://tools.ietf.org/html/rfc6902) requires a JSON Patch document to be a JSON document that represents an array of objects. +json.exception.parse_error.105 | parse error: operation must have string member 'op' | An operation of a JSON Patch document must contain exactly one "op" member, whose value indicates the operation to perform. Its value must be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors. +json.exception.parse_error.106 | parse error: array index '01' must not begin with '0' | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number wihtout a leading `0`. +json.exception.parse_error.107 | parse error: JSON pointer must be empty or begin with '/' - was: 'foo' | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character. +json.exception.parse_error.108 | parse error: escape character '~' must be followed with '0' or '1' | In a JSON Pointer, only `~0` and `~1` are valid escape sequences. +json.exception.parse_error.109 | parse error: array index 'one' is not a number | A JSON Pointer array index must be a number. +json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read. +json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xf8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read. +json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read. + +@note For an input with n bytes, 1 is the index of the first character and n+1 + is the index of the terminating null byte or the end of file. This also + holds true when reading a byte vector (CBOR or MessagePack). + +@liveexample{The following code shows how a `parse_error` exception can be +caught.,parse_error} + +@sa @ref exception for the base class of the library exceptions +@sa @ref invalid_iterator for exceptions indicating errors with iterators +@sa @ref type_error for exceptions indicating executing a member function with + a wrong type +@sa @ref out_of_range for exceptions indicating access out of the defined range +@sa @ref other_error for exceptions indicating other library errors + +@since version 3.0.0 +*/ +class parse_error : public exception +{ + public: + /*! + @brief create a parse error exception + @param[in] id_ the id of the exception + @param[in] byte_ the byte index where the error occurred (or 0 if the + position cannot be determined) + @param[in] what_arg the explanatory string + @return parse_error object + */ + static parse_error create(int id_, std::size_t byte_, const std::string& what_arg) + { + std::string w = exception::name("parse_error", id_) + "parse error" + + (byte_ != 0 ? (" at " + std::to_string(byte_)) : "") + + ": " + what_arg; + return parse_error(id_, byte_, w.c_str()); + } + + /*! + @brief byte index of the parse error + + The byte index of the last read character in the input file. + + @note For an input with n bytes, 1 is the index of the first character and + n+1 is the index of the terminating null byte or the end of file. + This also holds true when reading a byte vector (CBOR or MessagePack). + */ + const std::size_t byte; + + private: + parse_error(int id_, std::size_t byte_, const char* what_arg) + : exception(id_, what_arg), byte(byte_) {} +}; + +/*! +@brief exception indicating errors with iterators + +This exception is thrown if iterators passed to a library function do not match +the expected semantics. + +Exceptions have ids 2xx. + +name / id | example message | description +----------------------------------- | --------------- | ------------------------- +json.exception.invalid_iterator.201 | iterators are not compatible | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. +json.exception.invalid_iterator.202 | iterator does not fit current value | In an erase or insert function, the passed iterator @a pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion. +json.exception.invalid_iterator.203 | iterators do not fit current value | Either iterator passed to function @ref erase(IteratorType first, IteratorType last) does not belong to the JSON value from which values shall be erased. It hence does not define a valid range to delete values from. +json.exception.invalid_iterator.204 | iterators out of range | When an iterator range for a primitive type (number, boolean, or string) is passed to a constructor or an erase function, this range has to be exactly (@ref begin(), @ref end()), because this is the only way the single stored value is expressed. All other ranges are invalid. +json.exception.invalid_iterator.205 | iterator out of range | When an iterator for a primitive type (number, boolean, or string) is passed to an erase function, the iterator has to be the @ref begin() iterator, because it is the only way to address the stored value. All other iterators are invalid. +json.exception.invalid_iterator.206 | cannot construct with iterators from null | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) belong to a JSON null value and hence to not define a valid range. +json.exception.invalid_iterator.207 | cannot use key() for non-object iterators | The key() member function can only be used on iterators belonging to a JSON object, because other types do not have a concept of a key. +json.exception.invalid_iterator.208 | cannot use operator[] for object iterators | The operator[] to specify a concrete offset cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. +json.exception.invalid_iterator.209 | cannot use offsets with object iterators | The offset operators (+, -, +=, -=) cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. +json.exception.invalid_iterator.210 | iterators do not fit | The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. +json.exception.invalid_iterator.211 | passed iterators may not belong to container | The iterator range passed to the insert function must not be a subrange of the container to insert to. +json.exception.invalid_iterator.212 | cannot compare iterators of different containers | When two iterators are compared, they must belong to the same container. +json.exception.invalid_iterator.213 | cannot compare order of object iterators | The order of object iterators cannot be compared, because JSON objects are unordered. +json.exception.invalid_iterator.214 | cannot get value | Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to @ref begin(). + +@liveexample{The following code shows how an `invalid_iterator` exception can be +caught.,invalid_iterator} + +@sa @ref exception for the base class of the library exceptions +@sa @ref parse_error for exceptions indicating a parse error +@sa @ref type_error for exceptions indicating executing a member function with + a wrong type +@sa @ref out_of_range for exceptions indicating access out of the defined range +@sa @ref other_error for exceptions indicating other library errors + +@since version 3.0.0 +*/ +class invalid_iterator : public exception +{ + public: + static invalid_iterator create(int id_, const std::string& what_arg) + { + std::string w = exception::name("invalid_iterator", id_) + what_arg; + return invalid_iterator(id_, w.c_str()); + } + + private: + invalid_iterator(int id_, const char* what_arg) + : exception(id_, what_arg) {} +}; + +/*! +@brief exception indicating executing a member function with a wrong type + +This exception is thrown in case of a type error; that is, a library function is +executed on a JSON value whose type does not match the expected semantics. + +Exceptions have ids 3xx. + +name / id | example message | description +----------------------------- | --------------- | ------------------------- +json.exception.type_error.301 | cannot create object from initializer list | To create an object from an initializer list, the initializer list must consist only of a list of pairs whose first element is a string. When this constraint is violated, an array is created instead. +json.exception.type_error.302 | type must be object, but is array | During implicit or explicit value conversion, the JSON type must be compatible to the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types. +json.exception.type_error.303 | incompatible ReferenceType for get_ref, actual type is object | To retrieve a reference to a value stored in a @ref basic_json object with @ref get_ref, the type of the reference must match the value type. For instance, for a JSON array, the @a ReferenceType must be @ref array_t&. +json.exception.type_error.304 | cannot use at() with string | The @ref at() member functions can only be executed for certain JSON types. +json.exception.type_error.305 | cannot use operator[] with string | The @ref operator[] member functions can only be executed for certain JSON types. +json.exception.type_error.306 | cannot use value() with string | The @ref value() member functions can only be executed for certain JSON types. +json.exception.type_error.307 | cannot use erase() with string | The @ref erase() member functions can only be executed for certain JSON types. +json.exception.type_error.308 | cannot use push_back() with string | The @ref push_back() and @ref operator+= member functions can only be executed for certain JSON types. +json.exception.type_error.309 | cannot use insert() with | The @ref insert() member functions can only be executed for certain JSON types. +json.exception.type_error.310 | cannot use swap() with number | The @ref swap() member functions can only be executed for certain JSON types. +json.exception.type_error.311 | cannot use emplace_back() with string | The @ref emplace_back() member function can only be executed for certain JSON types. +json.exception.type_error.312 | cannot use update() with string | The @ref update() member functions can only be executed for certain JSON types. +json.exception.type_error.313 | invalid value to unflatten | The @ref unflatten function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well defined. +json.exception.type_error.314 | only objects can be unflattened | The @ref unflatten function only works for an object whose keys are JSON Pointers. +json.exception.type_error.315 | values in object must be primitive | The @ref unflatten function only works for an object whose keys are JSON Pointers and whose values are primitive. + +@liveexample{The following code shows how a `type_error` exception can be +caught.,type_error} + +@sa @ref exception for the base class of the library exceptions +@sa @ref parse_error for exceptions indicating a parse error +@sa @ref invalid_iterator for exceptions indicating errors with iterators +@sa @ref out_of_range for exceptions indicating access out of the defined range +@sa @ref other_error for exceptions indicating other library errors + +@since version 3.0.0 +*/ +class type_error : public exception +{ + public: + static type_error create(int id_, const std::string& what_arg) + { + std::string w = exception::name("type_error", id_) + what_arg; + return type_error(id_, w.c_str()); + } + + private: + type_error(int id_, const char* what_arg) : exception(id_, what_arg) {} +}; + +/*! +@brief exception indicating access out of the defined range + +This exception is thrown in case a library function is called on an input +parameter that exceeds the expected range, for instance in case of array +indices or nonexisting object keys. + +Exceptions have ids 4xx. + +name / id | example message | description +------------------------------- | --------------- | ------------------------- +json.exception.out_of_range.401 | array index 3 is out of range | The provided array index @a i is larger than @a size-1. +json.exception.out_of_range.402 | array index '-' (3) is out of range | The special array index `-` in a JSON Pointer never describes a valid element of the array, but the index past the end. That is, it can only be used to add elements at this position, but not to read it. +json.exception.out_of_range.403 | key 'foo' not found | The provided key was not found in the JSON object. +json.exception.out_of_range.404 | unresolved reference token 'foo' | A reference token in a JSON Pointer could not be resolved. +json.exception.out_of_range.405 | JSON pointer has no parent | The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value. +json.exception.out_of_range.406 | number overflow parsing '10E1000' | A parsed number could not be stored as without changing it to NaN or INF. + +@liveexample{The following code shows how an `out_of_range` exception can be +caught.,out_of_range} + +@sa @ref exception for the base class of the library exceptions +@sa @ref parse_error for exceptions indicating a parse error +@sa @ref invalid_iterator for exceptions indicating errors with iterators +@sa @ref type_error for exceptions indicating executing a member function with + a wrong type +@sa @ref other_error for exceptions indicating other library errors + +@since version 3.0.0 +*/ +class out_of_range : public exception +{ + public: + static out_of_range create(int id_, const std::string& what_arg) + { + std::string w = exception::name("out_of_range", id_) + what_arg; + return out_of_range(id_, w.c_str()); + } + + private: + out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {} +}; + +/*! +@brief exception indicating other library errors + +This exception is thrown in case of errors that cannot be classified with the +other exception types. + +Exceptions have ids 5xx. + +name / id | example message | description +------------------------------ | --------------- | ------------------------- +json.exception.other_error.501 | unsuccessful: {"op":"test","path":"/baz", "value":"bar"} | A JSON Patch operation 'test' failed. The unsuccessful operation is also printed. +json.exception.other_error.502 | invalid object size for conversion | Some conversions to user-defined types impose constraints on the object size (e.g. std::pair) + +@sa @ref exception for the base class of the library exceptions +@sa @ref parse_error for exceptions indicating a parse error +@sa @ref invalid_iterator for exceptions indicating errors with iterators +@sa @ref type_error for exceptions indicating executing a member function with + a wrong type +@sa @ref out_of_range for exceptions indicating access out of the defined range + +@liveexample{The following code shows how an `other_error` exception can be +caught.,other_error} + +@since version 3.0.0 +*/ +class other_error : public exception +{ + public: + static other_error create(int id_, const std::string& what_arg) + { + std::string w = exception::name("other_error", id_) + what_arg; + return other_error(id_, w.c_str()); + } + + private: + other_error(int id_, const char* what_arg) : exception(id_, what_arg) {} +}; + + + +/////////////////////////// +// JSON type enumeration // +/////////////////////////// + +/*! +@brief the JSON type enumeration + +This enumeration collects the different JSON types. It is internally used to +distinguish the stored values, and the functions @ref basic_json::is_null(), +@ref basic_json::is_object(), @ref basic_json::is_array(), +@ref basic_json::is_string(), @ref basic_json::is_boolean(), +@ref basic_json::is_number() (with @ref basic_json::is_number_integer(), +@ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), +@ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and +@ref basic_json::is_structured() rely on it. + +@note There are three enumeration entries (number_integer, number_unsigned, and +number_float), because the library distinguishes these three types for numbers: +@ref basic_json::number_unsigned_t is used for unsigned integers, +@ref basic_json::number_integer_t is used for signed integers, and +@ref basic_json::number_float_t is used for floating-point numbers or to +approximate integers which do not fit in the limits of their respective type. + +@sa @ref basic_json::basic_json(const value_t value_type) -- create a JSON +value with the default value for a given type + +@since version 1.0.0 +*/ +enum class value_t : uint8_t +{ + null, ///< null value + object, ///< object (unordered set of name/value pairs) + array, ///< array (ordered collection of values) + string, ///< string value + boolean, ///< boolean value + number_integer, ///< number value (signed integer) + number_unsigned, ///< number value (unsigned integer) + number_float, ///< number value (floating-point) + discarded ///< discarded by the the parser callback function +}; + +/*! +@brief comparison operator for JSON types + +Returns an ordering that is similar to Python: +- order: null < boolean < number < object < array < string +- furthermore, each type is not smaller than itself +- discarded values are not comparable + +@since version 1.0.0 +*/ +inline bool operator<(const value_t lhs, const value_t rhs) noexcept +{ + static constexpr std::array order = {{ + 0, // null + 3, // object + 4, // array + 5, // string + 1, // boolean + 2, // integer + 2, // unsigned + 2, // float + } + }; + + const auto l_index = static_cast(lhs); + const auto r_index = static_cast(rhs); + return (l_index < order.size() and r_index < order.size() and order[l_index] < order[r_index]); +} + + +///////////// +// helpers // +///////////// + +template struct is_basic_json : std::false_type {}; + +NLOHMANN_BASIC_JSON_TPL_DECLARATION +struct is_basic_json : std::true_type {}; + +// alias templates to reduce boilerplate +template +using enable_if_t = typename std::enable_if::type; + +template +using uncvref_t = typename std::remove_cv::type>::type; + +// implementation of C++14 index_sequence and affiliates +// source: https://stackoverflow.com/a/32223343 +template +struct index_sequence +{ + using type = index_sequence; + using value_type = std::size_t; + static constexpr std::size_t size() noexcept + { + return sizeof...(Ints); + } +}; + +template +struct merge_and_renumber; + +template +struct merge_and_renumber, index_sequence> + : index_sequence < I1..., (sizeof...(I1) + I2)... > + {}; + +template +struct make_index_sequence + : merge_and_renumber < typename make_index_sequence < N / 2 >::type, + typename make_index_sequence < N - N / 2 >::type > +{}; + +template<> struct make_index_sequence<0> : index_sequence<> { }; +template<> struct make_index_sequence<1> : index_sequence<0> { }; + +template +using index_sequence_for = make_index_sequence; + +/* +Implementation of two C++17 constructs: conjunction, negation. This is needed +to avoid evaluating all the traits in a condition + +For example: not std::is_same::value and has_value_type::value +will not compile when T = void (on MSVC at least). Whereas +conjunction>, has_value_type>::value will +stop evaluating if negation<...>::value == false + +Please note that those constructs must be used with caution, since symbols can +become very long quickly (which can slow down compilation and cause MSVC +internal compiler errors). Only use it when you have to (see example ahead). +*/ +template struct conjunction : std::true_type {}; +template struct conjunction : B1 {}; +template +struct conjunction : std::conditional, B1>::type {}; + +template struct negation : std::integral_constant < bool, !B::value > {}; + +// dispatch utility (taken from ranges-v3) +template struct priority_tag : priority_tag < N - 1 > {}; +template<> struct priority_tag<0> {}; + + +////////////////// +// constructors // +////////////////// + +template struct external_constructor; + +template<> +struct external_constructor +{ + template + static void construct(BasicJsonType& j, typename BasicJsonType::boolean_t b) noexcept + { + j.m_type = value_t::boolean; + j.m_value = b; + j.assert_invariant(); + } +}; + +template<> +struct external_constructor +{ + template + static void construct(BasicJsonType& j, const typename BasicJsonType::string_t& s) + { + j.m_type = value_t::string; + j.m_value = s; + j.assert_invariant(); + } + + template + static void construct(BasicJsonType& j, typename BasicJsonType::string_t&& s) + { + j.m_type = value_t::string; + j.m_value = std::move(s); + j.assert_invariant(); + } +}; + +template<> +struct external_constructor +{ + template + static void construct(BasicJsonType& j, typename BasicJsonType::number_float_t val) noexcept + { + j.m_type = value_t::number_float; + j.m_value = val; + j.assert_invariant(); + } +}; + +template<> +struct external_constructor +{ + template + static void construct(BasicJsonType& j, typename BasicJsonType::number_unsigned_t val) noexcept + { + j.m_type = value_t::number_unsigned; + j.m_value = val; + j.assert_invariant(); + } +}; + +template<> +struct external_constructor +{ + template + static void construct(BasicJsonType& j, typename BasicJsonType::number_integer_t val) noexcept + { + j.m_type = value_t::number_integer; + j.m_value = val; + j.assert_invariant(); + } +}; + +template<> +struct external_constructor +{ + template + static void construct(BasicJsonType& j, const typename BasicJsonType::array_t& arr) + { + j.m_type = value_t::array; + j.m_value = arr; + j.assert_invariant(); + } + + template + static void construct(BasicJsonType& j, typename BasicJsonType::array_t&& arr) + { + j.m_type = value_t::array; + j.m_value = std::move(arr); + j.assert_invariant(); + } + + template::value, + int> = 0> + static void construct(BasicJsonType& j, const CompatibleArrayType& arr) + { + using std::begin; + using std::end; + j.m_type = value_t::array; + j.m_value.array = j.template create(begin(arr), end(arr)); + j.assert_invariant(); + } + + template + static void construct(BasicJsonType& j, const std::vector& arr) + { + j.m_type = value_t::array; + j.m_value = value_t::array; + j.m_value.array->reserve(arr.size()); + for (bool x : arr) + { + j.m_value.array->push_back(x); + } + j.assert_invariant(); + } + + template::value, int> = 0> + static void construct(BasicJsonType& j, const std::valarray& arr) + { + j.m_type = value_t::array; + j.m_value = value_t::array; + j.m_value.array->resize(arr.size()); + std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin()); + j.assert_invariant(); + } +}; + +template<> +struct external_constructor +{ + template + static void construct(BasicJsonType& j, const typename BasicJsonType::object_t& obj) + { + j.m_type = value_t::object; + j.m_value = obj; + j.assert_invariant(); + } + + template + static void construct(BasicJsonType& j, typename BasicJsonType::object_t&& obj) + { + j.m_type = value_t::object; + j.m_value = std::move(obj); + j.assert_invariant(); + } + + template::value, int> = 0> + static void construct(BasicJsonType& j, const CompatibleObjectType& obj) + { + using std::begin; + using std::end; + + j.m_type = value_t::object; + j.m_value.object = j.template create(begin(obj), end(obj)); + j.assert_invariant(); + } +}; + + +//////////////////////// +// has_/is_ functions // +//////////////////////// + +/*! +@brief Helper to determine whether there's a key_type for T. + +This helper is used to tell associative containers apart from other containers +such as sequence containers. For instance, `std::map` passes the test as it +contains a `mapped_type`, whereas `std::vector` fails the test. + +@sa http://stackoverflow.com/a/7728728/266378 +@since version 1.0.0, overworked in version 2.0.6 +*/ +#define NLOHMANN_JSON_HAS_HELPER(type) \ + template struct has_##type { \ + private: \ + template \ + static int detect(U &&); \ + static void detect(...); \ + public: \ + static constexpr bool value = \ + std::is_integral()))>::value; \ + } + +NLOHMANN_JSON_HAS_HELPER(mapped_type); +NLOHMANN_JSON_HAS_HELPER(key_type); +NLOHMANN_JSON_HAS_HELPER(value_type); +NLOHMANN_JSON_HAS_HELPER(iterator); + +#undef NLOHMANN_JSON_HAS_HELPER + + +template +struct is_compatible_object_type_impl : std::false_type {}; + +template +struct is_compatible_object_type_impl +{ + static constexpr auto value = + std::is_constructible::value and + std::is_constructible::value; +}; + +template +struct is_compatible_object_type +{ + static auto constexpr value = is_compatible_object_type_impl < + conjunction>, + has_mapped_type, + has_key_type>::value, + typename BasicJsonType::object_t, CompatibleObjectType >::value; +}; + +template +struct is_basic_json_nested_type +{ + static auto constexpr value = std::is_same::value or + std::is_same::value or + std::is_same::value or + std::is_same::value; +}; + +template +struct is_compatible_array_type +{ + static auto constexpr value = + conjunction>, + negation>, + negation>, + negation>, + has_value_type, + has_iterator>::value; +}; + +template +struct is_compatible_integer_type_impl : std::false_type {}; + +template +struct is_compatible_integer_type_impl +{ + // is there an assert somewhere on overflows? + using RealLimits = std::numeric_limits; + using CompatibleLimits = std::numeric_limits; + + static constexpr auto value = + std::is_constructible::value and + CompatibleLimits::is_integer and + RealLimits::is_signed == CompatibleLimits::is_signed; +}; + +template +struct is_compatible_integer_type +{ + static constexpr auto value = + is_compatible_integer_type_impl < + std::is_integral::value and + not std::is_same::value, + RealIntegerType, CompatibleNumberIntegerType > ::value; +}; + + +// trait checking if JSONSerializer::from_json(json const&, udt&) exists +template +struct has_from_json +{ + private: + // also check the return type of from_json + template::from_json( + std::declval(), std::declval()))>::value>> + static int detect(U&&); + static void detect(...); + + public: + static constexpr bool value = std::is_integral>()))>::value; +}; + +// This trait checks if JSONSerializer::from_json(json const&) exists +// this overload is used for non-default-constructible user-defined-types +template +struct has_non_default_from_json +{ + private: + template < + typename U, + typename = enable_if_t::from_json(std::declval()))>::value >> + static int detect(U&&); + static void detect(...); + + public: + static constexpr bool value = std::is_integral>()))>::value; +}; + +// This trait checks if BasicJsonType::json_serializer::to_json exists +template +struct has_to_json +{ + private: + template::to_json( + std::declval(), std::declval()))> + static int detect(U&&); + static void detect(...); + + public: + static constexpr bool value = std::is_integral>()))>::value; +}; + + +///////////// +// to_json // +///////////// + +template::value, int> = 0> +void to_json(BasicJsonType& j, T b) noexcept +{ + external_constructor::construct(j, b); +} + +template::value, int> = 0> +void to_json(BasicJsonType& j, const CompatibleString& s) +{ + external_constructor::construct(j, s); +} + +template +void to_json(BasicJsonType& j, typename BasicJsonType::string_t&& s) +{ + external_constructor::construct(j, std::move(s)); +} + +template::value, int> = 0> +void to_json(BasicJsonType& j, FloatType val) noexcept +{ + external_constructor::construct(j, static_cast(val)); +} + +template < + typename BasicJsonType, typename CompatibleNumberUnsignedType, + enable_if_t::value, int> = 0 > +void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noexcept +{ + external_constructor::construct(j, static_cast(val)); +} + +template < + typename BasicJsonType, typename CompatibleNumberIntegerType, + enable_if_t::value, int> = 0 > +void to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noexcept +{ + external_constructor::construct(j, static_cast(val)); +} + +template::value, int> = 0> +void to_json(BasicJsonType& j, EnumType e) noexcept +{ + using underlying_type = typename std::underlying_type::type; + external_constructor::construct(j, static_cast(e)); +} + +template +void to_json(BasicJsonType& j, const std::vector& e) +{ + external_constructor::construct(j, e); +} + +template < + typename BasicJsonType, typename CompatibleArrayType, + enable_if_t < + is_compatible_array_type::value or + std::is_same::value, + int > = 0 > +void to_json(BasicJsonType& j, const CompatibleArrayType& arr) +{ + external_constructor::construct(j, arr); +} + +template ::value, int> = 0> +void to_json(BasicJsonType& j, std::valarray arr) +{ + external_constructor::construct(j, std::move(arr)); +} + +template +void to_json(BasicJsonType& j, typename BasicJsonType::array_t&& arr) +{ + external_constructor::construct(j, std::move(arr)); +} + +template < + typename BasicJsonType, typename CompatibleObjectType, + enable_if_t::value, + int> = 0 > +void to_json(BasicJsonType& j, const CompatibleObjectType& obj) +{ + external_constructor::construct(j, obj); +} + +template +void to_json(BasicJsonType& j, typename BasicJsonType::object_t&& obj) +{ + external_constructor::construct(j, std::move(obj)); +} + +template::value, + int> = 0> +void to_json(BasicJsonType& j, T (&arr)[N]) +{ + external_constructor::construct(j, arr); +} + +template +void to_json(BasicJsonType& j, const std::pair& p) +{ + j = {p.first, p.second}; +} + +template +void to_json_tuple_impl(BasicJsonType& j, const Tuple& t, index_sequence) +{ + j = {std::get(t)...}; +} + +template +void to_json(BasicJsonType& j, const std::tuple& t) +{ + to_json_tuple_impl(j, t, index_sequence_for {}); +} + +/////////////// +// from_json // +/////////////// + +// overloads for basic_json template parameters +template::value and + not std::is_same::value, + int> = 0> +void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val) +{ + switch (static_cast(j)) + { + case value_t::number_unsigned: + { + val = static_cast(*j.template get_ptr()); + break; + } + case value_t::number_integer: + { + val = static_cast(*j.template get_ptr()); + break; + } + case value_t::number_float: + { + val = static_cast(*j.template get_ptr()); + break; + } + + default: + JSON_THROW(type_error::create(302, "type must be number, but is " + std::string(j.type_name()))); + } +} + +template +void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b) +{ + if (JSON_UNLIKELY(not j.is_boolean())) + { + JSON_THROW(type_error::create(302, "type must be boolean, but is " + std::string(j.type_name()))); + } + b = *j.template get_ptr(); +} + +template +void from_json(const BasicJsonType& j, typename BasicJsonType::string_t& s) +{ + if (JSON_UNLIKELY(not j.is_string())) + { + JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name()))); + } + s = *j.template get_ptr(); +} + +template +void from_json(const BasicJsonType& j, typename BasicJsonType::number_float_t& val) +{ + get_arithmetic_value(j, val); +} + +template +void from_json(const BasicJsonType& j, typename BasicJsonType::number_unsigned_t& val) +{ + get_arithmetic_value(j, val); +} + +template +void from_json(const BasicJsonType& j, typename BasicJsonType::number_integer_t& val) +{ + get_arithmetic_value(j, val); +} + +template::value, int> = 0> +void from_json(const BasicJsonType& j, EnumType& e) +{ + typename std::underlying_type::type val; + get_arithmetic_value(j, val); + e = static_cast(val); +} + +template +void from_json(const BasicJsonType& j, typename BasicJsonType::array_t& arr) +{ + if (JSON_UNLIKELY(not j.is_array())) + { + JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()))); + } + arr = *j.template get_ptr(); +} + +// forward_list doesn't have an insert method +template::value, int> = 0> +void from_json(const BasicJsonType& j, std::forward_list& l) +{ + if (JSON_UNLIKELY(not j.is_array())) + { + JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()))); + } + std::transform(j.rbegin(), j.rend(), + std::front_inserter(l), [](const BasicJsonType & i) + { + return i.template get(); + }); +} + +// valarray doesn't have an insert method +template::value, int> = 0> +void from_json(const BasicJsonType& j, std::valarray& l) +{ + if (JSON_UNLIKELY(not j.is_array())) + { + JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()))); + } + l.resize(j.size()); + std::copy(j.m_value.array->begin(), j.m_value.array->end(), std::begin(l)); +} + +template +void from_json_array_impl(const BasicJsonType& j, CompatibleArrayType& arr, priority_tag<0> /*unused*/) +{ + using std::end; + + std::transform(j.begin(), j.end(), + std::inserter(arr, end(arr)), [](const BasicJsonType & i) + { + // get() returns *this, this won't call a from_json + // method when value_type is BasicJsonType + return i.template get(); + }); +} + +template +auto from_json_array_impl(const BasicJsonType& j, CompatibleArrayType& arr, priority_tag<1> /*unused*/) +-> decltype( + arr.reserve(std::declval()), + void()) +{ + using std::end; + + arr.reserve(j.size()); + std::transform(j.begin(), j.end(), + std::inserter(arr, end(arr)), [](const BasicJsonType & i) + { + // get() returns *this, this won't call a from_json + // method when value_type is BasicJsonType + return i.template get(); + }); +} + +template +void from_json_array_impl(const BasicJsonType& j, std::array& arr, priority_tag<2> /*unused*/) +{ + for (std::size_t i = 0; i < N; ++i) + { + arr[i] = j.at(i).template get(); + } +} + +template::value and + std::is_convertible::value and + not std::is_same::value, int> = 0> +void from_json(const BasicJsonType& j, CompatibleArrayType& arr) +{ + if (JSON_UNLIKELY(not j.is_array())) + { + JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()))); + } + + from_json_array_impl(j, arr, priority_tag<2> {}); +} + +template::value, int> = 0> +void from_json(const BasicJsonType& j, CompatibleObjectType& obj) +{ + if (JSON_UNLIKELY(not j.is_object())) + { + JSON_THROW(type_error::create(302, "type must be object, but is " + std::string(j.type_name()))); + } + + auto inner_object = j.template get_ptr(); + using value_type = typename CompatibleObjectType::value_type; + std::transform( + inner_object->begin(), inner_object->end(), + std::inserter(obj, obj.begin()), + [](typename BasicJsonType::object_t::value_type const & p) + { + return value_type(p.first, p.second.template get()); + }); +} + +// overload for arithmetic types, not chosen for basic_json template arguments +// (BooleanType, etc..); note: Is it really necessary to provide explicit +// overloads for boolean_t etc. in case of a custom BooleanType which is not +// an arithmetic type? +template::value and + not std::is_same::value and + not std::is_same::value and + not std::is_same::value and + not std::is_same::value, + int> = 0> +void from_json(const BasicJsonType& j, ArithmeticType& val) +{ + switch (static_cast(j)) + { + case value_t::number_unsigned: + { + val = static_cast(*j.template get_ptr()); + break; + } + case value_t::number_integer: + { + val = static_cast(*j.template get_ptr()); + break; + } + case value_t::number_float: + { + val = static_cast(*j.template get_ptr()); + break; + } + case value_t::boolean: + { + val = static_cast(*j.template get_ptr()); + break; + } + + default: + JSON_THROW(type_error::create(302, "type must be number, but is " + std::string(j.type_name()))); + } +} + +template +void from_json(const BasicJsonType& j, std::pair& p) +{ + p = {j.at(0).template get(), j.at(1).template get()}; +} + +template +void from_json_tuple_impl(const BasicJsonType& j, Tuple& t, index_sequence) +{ + t = std::make_tuple(j.at(Idx).template get::type>()...); +} + +template +void from_json(const BasicJsonType& j, std::tuple& t) +{ + from_json_tuple_impl(j, t, index_sequence_for {}); +} + +struct to_json_fn +{ + private: + template + auto call(BasicJsonType& j, T&& val, priority_tag<1> /*unused*/) const noexcept(noexcept(to_json(j, std::forward(val)))) + -> decltype(to_json(j, std::forward(val)), void()) + { + return to_json(j, std::forward(val)); + } + + template + void call(BasicJsonType& /*unused*/, T&& /*unused*/, priority_tag<0> /*unused*/) const noexcept + { + static_assert(sizeof(BasicJsonType) == 0, + "could not find to_json() method in T's namespace"); + +#ifdef _MSC_VER + // Visual Studio does not show a stacktrace for the above assert. + using decayed = uncvref_t; + static_assert(sizeof(typename decayed::force_msvc_stacktrace) == 0, + "forcing msvc stacktrace to show which T we're talking about."); +#endif + } + + public: + template + void operator()(BasicJsonType& j, T&& val) const + noexcept(noexcept(std::declval().call(j, std::forward(val), priority_tag<1> {}))) + { + return call(j, std::forward(val), priority_tag<1> {}); + } +}; + +struct from_json_fn +{ + private: + template + auto call(const BasicJsonType& j, T& val, priority_tag<1> /*unused*/) const + noexcept(noexcept(from_json(j, val))) + -> decltype(from_json(j, val), void()) + { + return from_json(j, val); + } + + template + void call(const BasicJsonType& /*unused*/, T& /*unused*/, priority_tag<0> /*unused*/) const noexcept + { + static_assert(sizeof(BasicJsonType) == 0, + "could not find from_json() method in T's namespace"); +#ifdef _MSC_VER + // Visual Studio does not show a stacktrace for the above assert. + using decayed = uncvref_t; + static_assert(sizeof(typename decayed::force_msvc_stacktrace) == 0, + "forcing msvc stacktrace to show which T we're talking about."); +#endif + } + + public: + template + void operator()(const BasicJsonType& j, T& val) const + noexcept(noexcept(std::declval().call(j, val, priority_tag<1> {}))) + { + return call(j, val, priority_tag<1> {}); + } +}; + +// taken from ranges-v3 +template +struct static_const +{ + static constexpr T value{}; +}; + +template +constexpr T static_const::value; + +//////////////////// +// input adapters // +//////////////////// + +/*! +@brief abstract input adapter interface + +Produces a stream of std::char_traits::int_type characters from a +std::istream, a buffer, or some other input type. Accepts the return of exactly +one non-EOF character for future input. The int_type characters returned +consist of all valid char values as positive values (typically unsigned char), +plus an EOF value outside that range, specified by the value of the function +std::char_traits::eof(). This value is typically -1, but could be any +arbitrary value which is not a valid char value. +*/ +struct input_adapter_protocol +{ + /// get a character [0,255] or std::char_traits::eof(). + virtual std::char_traits::int_type get_character() = 0; + /// restore the last non-eof() character to input + virtual void unget_character() = 0; + virtual ~input_adapter_protocol() = default; +}; + +/// a type to simplify interfaces +using input_adapter_t = std::shared_ptr; + +/*! +Input adapter for a (caching) istream. Ignores a UFT Byte Order Mark at +beginning of input. Does not support changing the underlying std::streambuf +in mid-input. Maintains underlying std::istream and std::streambuf to support +subsequent use of standard std::istream operations to process any input +characters following those used in parsing the JSON input. Clears the +std::istream flags; any input errors (e.g., EOF) will be detected by the first +subsequent call for input from the std::istream. +*/ +class input_stream_adapter : public input_adapter_protocol +{ + public: + ~input_stream_adapter() override + { + // clear stream flags; we use underlying streambuf I/O, do not + // maintain ifstream flags + is.clear(); + } + + explicit input_stream_adapter(std::istream& i) + : is(i), sb(*i.rdbuf()) + { + // ignore Byte Order Mark at start of input + std::char_traits::int_type c; + if ((c = get_character()) == 0xEF) + { + if ((c = get_character()) == 0xBB) + { + if ((c = get_character()) == 0xBF) + { + return; // Ignore BOM + } + else if (c != std::char_traits::eof()) + { + is.unget(); + } + is.putback('\xBB'); + } + else if (c != std::char_traits::eof()) + { + is.unget(); + } + is.putback('\xEF'); + } + else if (c != std::char_traits::eof()) + { + is.unget(); // Not BOM. Process as usual. + } + } + + // delete because of pointer members + input_stream_adapter(const input_stream_adapter&) = delete; + input_stream_adapter& operator=(input_stream_adapter&) = delete; + + // std::istream/std::streambuf use std::char_traits::to_int_type, to + // ensure that std::char_traits::eof() and the character 0xff do not + // end up as the same value, eg. 0xffffffff. + std::char_traits::int_type get_character() override + { + return sb.sbumpc(); + } + + void unget_character() override + { + sb.sungetc(); // is.unget() avoided for performance + } + + private: + /// the associated input stream + std::istream& is; + std::streambuf& sb; +}; + +/// input adapter for buffer input +class input_buffer_adapter : public input_adapter_protocol +{ + public: + input_buffer_adapter(const char* b, const std::size_t l) + : cursor(b), limit(b + l), start(b) + { + // skip byte order mark + if (l >= 3 and b[0] == '\xEF' and b[1] == '\xBB' and b[2] == '\xBF') + { + cursor += 3; + } + } + + // delete because of pointer members + input_buffer_adapter(const input_buffer_adapter&) = delete; + input_buffer_adapter& operator=(input_buffer_adapter&) = delete; + + std::char_traits::int_type get_character() noexcept override + { + if (JSON_LIKELY(cursor < limit)) + { + return std::char_traits::to_int_type(*(cursor++)); + } + + return std::char_traits::eof(); + } + + void unget_character() noexcept override + { + if (JSON_LIKELY(cursor > start)) + { + --cursor; + } + } + + private: + /// pointer to the current character + const char* cursor; + /// pointer past the last character + const char* limit; + /// pointer to the first character + const char* start; +}; + +class input_adapter +{ + public: + // native support + + /// input adapter for input stream + input_adapter(std::istream& i) + : ia(std::make_shared(i)) {} + + /// input adapter for input stream + input_adapter(std::istream&& i) + : ia(std::make_shared(i)) {} + + /// input adapter for buffer + template::value and + std::is_integral< + typename std::remove_pointer::type>::value and + sizeof(typename std::remove_pointer::type) == 1, + int>::type = 0> + input_adapter(CharT b, std::size_t l) + : ia(std::make_shared(reinterpret_cast(b), l)) {} + + // derived support + + /// input adapter for string literal + template::value and + std::is_integral< + typename std::remove_pointer::type>::value and + sizeof(typename std::remove_pointer::type) == 1, + int>::type = 0> + input_adapter(CharT b) + : input_adapter(reinterpret_cast(b), + std::strlen(reinterpret_cast(b))) {} + + /// input adapter for iterator range with contiguous storage + template::iterator_category, + std::random_access_iterator_tag>::value, + int>::type = 0> + input_adapter(IteratorType first, IteratorType last) + { + // assertion to check that the iterator range is indeed contiguous, + // see http://stackoverflow.com/a/35008842/266378 for more discussion + assert(std::accumulate( + first, last, std::pair(true, 0), + [&first](std::pair res, decltype(*first) val) + { + res.first &= (val == *(std::next(std::addressof(*first), res.second++))); + return res; + }).first); + + // assertion to check that each element is 1 byte long + static_assert( + sizeof(typename std::iterator_traits::value_type) == 1, + "each element in the iterator range must have the size of 1 byte"); + + const auto len = static_cast(std::distance(first, last)); + if (JSON_LIKELY(len > 0)) + { + // there is at least one element: use the address of first + ia = std::make_shared(reinterpret_cast(&(*first)), len); + } + else + { + // the address of first cannot be used: use nullptr + ia = std::make_shared(nullptr, len); + } + } + + /// input adapter for array + template + input_adapter(T (&array)[N]) + : input_adapter(std::begin(array), std::end(array)) {} + + /// input adapter for contiguous container + template < + class ContiguousContainer, + typename std::enable_if < + not std::is_pointer::value and + std::is_base_of()))>::iterator_category>::value, + int >::type = 0 > + input_adapter(const ContiguousContainer& c) + : input_adapter(std::begin(c), std::end(c)) {} + + operator input_adapter_t() + { + return ia; + } + + private: + /// the actual adapter + input_adapter_t ia = nullptr; +}; + +////////////////////// +// lexer and parser // +////////////////////// + +/*! +@brief lexical analysis + +This class organizes the lexical analysis during JSON deserialization. +*/ +template +class lexer +{ + using number_integer_t = typename BasicJsonType::number_integer_t; + using number_unsigned_t = typename BasicJsonType::number_unsigned_t; + using number_float_t = typename BasicJsonType::number_float_t; + + public: + /// token types for the parser + enum class token_type + { + uninitialized, ///< indicating the scanner is uninitialized + literal_true, ///< the `true` literal + literal_false, ///< the `false` literal + literal_null, ///< the `null` literal + value_string, ///< a string -- use get_string() for actual value + value_unsigned, ///< an unsigned integer -- use get_number_unsigned() for actual value + value_integer, ///< a signed integer -- use get_number_integer() for actual value + value_float, ///< an floating point number -- use get_number_float() for actual value + begin_array, ///< the character for array begin `[` + begin_object, ///< the character for object begin `{` + end_array, ///< the character for array end `]` + end_object, ///< the character for object end `}` + name_separator, ///< the name separator `:` + value_separator, ///< the value separator `,` + parse_error, ///< indicating a parse error + end_of_input, ///< indicating the end of the input buffer + literal_or_value ///< a literal or the begin of a value (only for diagnostics) + }; + + /// return name of values of type token_type (only used for errors) + static const char* token_type_name(const token_type t) noexcept + { + switch (t) + { + case token_type::uninitialized: + return ""; + case token_type::literal_true: + return "true literal"; + case token_type::literal_false: + return "false literal"; + case token_type::literal_null: + return "null literal"; + case token_type::value_string: + return "string literal"; + case lexer::token_type::value_unsigned: + case lexer::token_type::value_integer: + case lexer::token_type::value_float: + return "number literal"; + case token_type::begin_array: + return "'['"; + case token_type::begin_object: + return "'{'"; + case token_type::end_array: + return "']'"; + case token_type::end_object: + return "'}'"; + case token_type::name_separator: + return "':'"; + case token_type::value_separator: + return "','"; + case token_type::parse_error: + return ""; + case token_type::end_of_input: + return "end of input"; + case token_type::literal_or_value: + return "'[', '{', or a literal"; + default: // catch non-enum values + return "unknown token"; // LCOV_EXCL_LINE + } + } + + explicit lexer(detail::input_adapter_t adapter) + : ia(std::move(adapter)), decimal_point_char(get_decimal_point()) {} + + // delete because of pointer members + lexer(const lexer&) = delete; + lexer& operator=(lexer&) = delete; + + private: + ///////////////////// + // locales + ///////////////////// + + /// return the locale-dependent decimal point + static char get_decimal_point() noexcept + { + const auto loc = localeconv(); + assert(loc != nullptr); + return (loc->decimal_point == nullptr) ? '.' : *(loc->decimal_point); + } + + ///////////////////// + // scan functions + ///////////////////// + + /*! + @brief get codepoint from 4 hex characters following `\u` + + For input "\u c1 c2 c3 c4" the codepoint is: + (c1 * 0x1000) + (c2 * 0x0100) + (c3 * 0x0010) + c4 + = (c1 << 12) + (c2 << 8) + (c3 << 4) + (c4 << 0) + + Furthermore, the possible characters '0'..'9', 'A'..'F', and 'a'..'f' + must be converted to the integers 0x0..0x9, 0xA..0xF, 0xA..0xF, resp. The + conversion is done by subtracting the offset (0x30, 0x37, and 0x57) + between the ASCII value of the character and the desired integer value. + + @return codepoint (0x0000..0xFFFF) or -1 in case of an error (e.g. EOF or + non-hex character) + */ + int get_codepoint() + { + // this function only makes sense after reading `\u` + assert(current == 'u'); + int codepoint = 0; + + const auto factors = { 12, 8, 4, 0 }; + for (const auto factor : factors) + { + get(); + + if (current >= '0' and current <= '9') + { + codepoint += ((current - 0x30) << factor); + } + else if (current >= 'A' and current <= 'F') + { + codepoint += ((current - 0x37) << factor); + } + else if (current >= 'a' and current <= 'f') + { + codepoint += ((current - 0x57) << factor); + } + else + { + return -1; + } + } + + assert(0x0000 <= codepoint and codepoint <= 0xFFFF); + return codepoint; + } + + /*! + @brief check if the next byte(s) are inside a given range + + Adds the current byte and, for each passed range, reads a new byte and + checks if it is inside the range. If a violation was detected, set up an + error message and return false. Otherwise, return true. + + @return true if and only if no range violation was detected + */ + bool next_byte_in_range(std::initializer_list ranges) + { + assert(ranges.size() == 2 or ranges.size() == 4 or ranges.size() == 6); + add(current); + + for (auto range = ranges.begin(); range != ranges.end(); ++range) + { + get(); + if (JSON_LIKELY(*range <= current and current <= *(++range))) + { + add(current); + } + else + { + error_message = "invalid string: ill-formed UTF-8 byte"; + return false; + } + } + + return true; + } + + /*! + @brief scan a string literal + + This function scans a string according to Sect. 7 of RFC 7159. While + scanning, bytes are escaped and copied into buffer yytext. Then the function + returns successfully, yytext is *not* null-terminated (as it may contain \0 + bytes), and yytext.size() is the number of bytes in the string. + + @return token_type::value_string if string could be successfully scanned, + token_type::parse_error otherwise + + @note In case of errors, variable error_message contains a textual + description. + */ + token_type scan_string() + { + // reset yytext (ignore opening quote) + reset(); + + // we entered the function by reading an open quote + assert(current == '\"'); + + while (true) + { + // get next character + switch (get()) + { + // end of file while parsing string + case std::char_traits::eof(): + { + error_message = "invalid string: missing closing quote"; + return token_type::parse_error; + } + + // closing quote + case '\"': + { + return token_type::value_string; + } + + // escapes + case '\\': + { + switch (get()) + { + // quotation mark + case '\"': + add('\"'); + break; + // reverse solidus + case '\\': + add('\\'); + break; + // solidus + case '/': + add('/'); + break; + // backspace + case 'b': + add('\b'); + break; + // form feed + case 'f': + add('\f'); + break; + // line feed + case 'n': + add('\n'); + break; + // carriage return + case 'r': + add('\r'); + break; + // tab + case 't': + add('\t'); + break; + + // unicode escapes + case 'u': + { + const int codepoint1 = get_codepoint(); + int codepoint = codepoint1; // start with codepoint1 + + if (JSON_UNLIKELY(codepoint1 == -1)) + { + error_message = "invalid string: '\\u' must be followed by 4 hex digits"; + return token_type::parse_error; + } + + // check if code point is a high surrogate + if (0xD800 <= codepoint1 and codepoint1 <= 0xDBFF) + { + // expect next \uxxxx entry + if (JSON_LIKELY(get() == '\\' and get() == 'u')) + { + const int codepoint2 = get_codepoint(); + + if (JSON_UNLIKELY(codepoint2 == -1)) + { + error_message = "invalid string: '\\u' must be followed by 4 hex digits"; + return token_type::parse_error; + } + + // check if codepoint2 is a low surrogate + if (JSON_LIKELY(0xDC00 <= codepoint2 and codepoint2 <= 0xDFFF)) + { + // overwrite codepoint + codepoint = + // high surrogate occupies the most significant 22 bits + (codepoint1 << 10) + // low surrogate occupies the least significant 15 bits + + codepoint2 + // there is still the 0xD800, 0xDC00 and 0x10000 noise + // in the result so we have to subtract with: + // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00 + - 0x35FDC00; + } + else + { + error_message = "invalid string: surrogate U+DC00..U+DFFF must be followed by U+DC00..U+DFFF"; + return token_type::parse_error; + } + } + else + { + error_message = "invalid string: surrogate U+DC00..U+DFFF must be followed by U+DC00..U+DFFF"; + return token_type::parse_error; + } + } + else + { + if (JSON_UNLIKELY(0xDC00 <= codepoint1 and codepoint1 <= 0xDFFF)) + { + error_message = "invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF"; + return token_type::parse_error; + } + } + + // result of the above calculation yields a proper codepoint + assert(0x00 <= codepoint and codepoint <= 0x10FFFF); + + // translate code point to bytes + if (codepoint < 0x80) + { + // 1-byte characters: 0xxxxxxx (ASCII) + add(codepoint); + } + else if (codepoint <= 0x7ff) + { + // 2-byte characters: 110xxxxx 10xxxxxx + add(0xC0 | (codepoint >> 6)); + add(0x80 | (codepoint & 0x3F)); + } + else if (codepoint <= 0xffff) + { + // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx + add(0xE0 | (codepoint >> 12)); + add(0x80 | ((codepoint >> 6) & 0x3F)); + add(0x80 | (codepoint & 0x3F)); + } + else + { + // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + add(0xF0 | (codepoint >> 18)); + add(0x80 | ((codepoint >> 12) & 0x3F)); + add(0x80 | ((codepoint >> 6) & 0x3F)); + add(0x80 | (codepoint & 0x3F)); + } + + break; + } + + // other characters after escape + default: + error_message = "invalid string: forbidden character after backslash"; + return token_type::parse_error; + } + + break; + } + + // invalid control characters + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1a: + case 0x1b: + case 0x1c: + case 0x1d: + case 0x1e: + case 0x1f: + { + error_message = "invalid string: control character must be escaped"; + return token_type::parse_error; + } + + // U+0020..U+007F (except U+0022 (quote) and U+005C (backspace)) + case 0x20: + case 0x21: + case 0x23: + case 0x24: + case 0x25: + case 0x26: + case 0x27: + case 0x28: + case 0x29: + case 0x2a: + case 0x2b: + case 0x2c: + case 0x2d: + case 0x2e: + case 0x2f: + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: + case 0x35: + case 0x36: + case 0x37: + case 0x38: + case 0x39: + case 0x3a: + case 0x3b: + case 0x3c: + case 0x3d: + case 0x3e: + case 0x3f: + case 0x40: + case 0x41: + case 0x42: + case 0x43: + case 0x44: + case 0x45: + case 0x46: + case 0x47: + case 0x48: + case 0x49: + case 0x4a: + case 0x4b: + case 0x4c: + case 0x4d: + case 0x4e: + case 0x4f: + case 0x50: + case 0x51: + case 0x52: + case 0x53: + case 0x54: + case 0x55: + case 0x56: + case 0x57: + case 0x58: + case 0x59: + case 0x5a: + case 0x5b: + case 0x5d: + case 0x5e: + case 0x5f: + case 0x60: + case 0x61: + case 0x62: + case 0x63: + case 0x64: + case 0x65: + case 0x66: + case 0x67: + case 0x68: + case 0x69: + case 0x6a: + case 0x6b: + case 0x6c: + case 0x6d: + case 0x6e: + case 0x6f: + case 0x70: + case 0x71: + case 0x72: + case 0x73: + case 0x74: + case 0x75: + case 0x76: + case 0x77: + case 0x78: + case 0x79: + case 0x7a: + case 0x7b: + case 0x7c: + case 0x7d: + case 0x7e: + case 0x7f: + { + add(current); + break; + } + + // U+0080..U+07FF: bytes C2..DF 80..BF + case 0xc2: + case 0xc3: + case 0xc4: + case 0xc5: + case 0xc6: + case 0xc7: + case 0xc8: + case 0xc9: + case 0xca: + case 0xcb: + case 0xcc: + case 0xcd: + case 0xce: + case 0xcf: + case 0xd0: + case 0xd1: + case 0xd2: + case 0xd3: + case 0xd4: + case 0xd5: + case 0xd6: + case 0xd7: + case 0xd8: + case 0xd9: + case 0xda: + case 0xdb: + case 0xdc: + case 0xdd: + case 0xde: + case 0xdf: + { + if (JSON_UNLIKELY(not next_byte_in_range({0x80, 0xBF}))) + { + return token_type::parse_error; + } + break; + } + + // U+0800..U+0FFF: bytes E0 A0..BF 80..BF + case 0xe0: + { + if (JSON_UNLIKELY(not (next_byte_in_range({0xA0, 0xBF, 0x80, 0xBF})))) + { + return token_type::parse_error; + } + break; + } + + // U+1000..U+CFFF: bytes E1..EC 80..BF 80..BF + // U+E000..U+FFFF: bytes EE..EF 80..BF 80..BF + case 0xe1: + case 0xe2: + case 0xe3: + case 0xe4: + case 0xe5: + case 0xe6: + case 0xe7: + case 0xe8: + case 0xe9: + case 0xea: + case 0xeb: + case 0xec: + case 0xee: + case 0xef: + { + if (JSON_UNLIKELY(not (next_byte_in_range({0x80, 0xBF, 0x80, 0xBF})))) + { + return token_type::parse_error; + } + break; + } + + // U+D000..U+D7FF: bytes ED 80..9F 80..BF + case 0xed: + { + if (JSON_UNLIKELY(not (next_byte_in_range({0x80, 0x9F, 0x80, 0xBF})))) + { + return token_type::parse_error; + } + break; + } + + // U+10000..U+3FFFF F0 90..BF 80..BF 80..BF + case 0xf0: + { + if (JSON_UNLIKELY(not (next_byte_in_range({0x90, 0xBF, 0x80, 0xBF, 0x80, 0xBF})))) + { + return token_type::parse_error; + } + break; + } + + // U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF + case 0xf1: + case 0xf2: + case 0xf3: + { + if (JSON_UNLIKELY(not (next_byte_in_range({0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF})))) + { + return token_type::parse_error; + } + break; + } + + // U+100000..U+10FFFF F4 80..8F 80..BF 80..BF + case 0xf4: + { + if (JSON_UNLIKELY(not (next_byte_in_range({0x80, 0x8F, 0x80, 0xBF, 0x80, 0xBF})))) + { + return token_type::parse_error; + } + break; + } + + // remaining bytes (80..C1 and F5..FF) are ill-formed + default: + { + error_message = "invalid string: ill-formed UTF-8 byte"; + return token_type::parse_error; + } + } + } + } + + static void strtof(float& f, const char* str, char** endptr) noexcept + { + f = std::strtof(str, endptr); + } + + static void strtof(double& f, const char* str, char** endptr) noexcept + { + f = std::strtod(str, endptr); + } + + static void strtof(long double& f, const char* str, char** endptr) noexcept + { + f = std::strtold(str, endptr); + } + + /*! + @brief scan a number literal + + This function scans a string according to Sect. 6 of RFC 7159. + + The function is realized with a deterministic finite state machine derived + from the grammar described in RFC 7159. Starting in state "init", the + input is read and used to determined the next state. Only state "done" + accepts the number. State "error" is a trap state to model errors. In the + table below, "anything" means any character but the ones listed before. + + state | 0 | 1-9 | e E | + | - | . | anything + ---------|----------|----------|----------|---------|---------|----------|----------- + init | zero | any1 | [error] | [error] | minus | [error] | [error] + minus | zero | any1 | [error] | [error] | [error] | [error] | [error] + zero | done | done | exponent | done | done | decimal1 | done + any1 | any1 | any1 | exponent | done | done | decimal1 | done + decimal1 | decimal2 | [error] | [error] | [error] | [error] | [error] | [error] + decimal2 | decimal2 | decimal2 | exponent | done | done | done | done + exponent | any2 | any2 | [error] | sign | sign | [error] | [error] + sign | any2 | any2 | [error] | [error] | [error] | [error] | [error] + any2 | any2 | any2 | done | done | done | done | done + + The state machine is realized with one label per state (prefixed with + "scan_number_") and `goto` statements between them. The state machine + contains cycles, but any cycle can be left when EOF is read. Therefore, + the function is guaranteed to terminate. + + During scanning, the read bytes are stored in yytext. This string is + then converted to a signed integer, an unsigned integer, or a + floating-point number. + + @return token_type::value_unsigned, token_type::value_integer, or + token_type::value_float if number could be successfully scanned, + token_type::parse_error otherwise + + @note The scanner is independent of the current locale. Internally, the + locale's decimal point is used instead of `.` to work with the + locale-dependent converters. + */ + token_type scan_number() + { + // reset yytext to store the number's bytes + reset(); + + // the type of the parsed number; initially set to unsigned; will be + // changed if minus sign, decimal point or exponent is read + token_type number_type = token_type::value_unsigned; + + // state (init): we just found out we need to scan a number + switch (current) + { + case '-': + { + add(current); + goto scan_number_minus; + } + + case '0': + { + add(current); + goto scan_number_zero; + } + + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + add(current); + goto scan_number_any1; + } + + default: + { + // all other characters are rejected outside scan_number() + assert(false); // LCOV_EXCL_LINE + } + } + +scan_number_minus: + // state: we just parsed a leading minus sign + number_type = token_type::value_integer; + switch (get()) + { + case '0': + { + add(current); + goto scan_number_zero; + } + + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + add(current); + goto scan_number_any1; + } + + default: + { + error_message = "invalid number; expected digit after '-'"; + return token_type::parse_error; + } + } + +scan_number_zero: + // state: we just parse a zero (maybe with a leading minus sign) + switch (get()) + { + case '.': + { + add(decimal_point_char); + goto scan_number_decimal1; + } + + case 'e': + case 'E': + { + add(current); + goto scan_number_exponent; + } + + default: + goto scan_number_done; + } + +scan_number_any1: + // state: we just parsed a number 0-9 (maybe with a leading minus sign) + switch (get()) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + add(current); + goto scan_number_any1; + } + + case '.': + { + add(decimal_point_char); + goto scan_number_decimal1; + } + + case 'e': + case 'E': + { + add(current); + goto scan_number_exponent; + } + + default: + goto scan_number_done; + } + +scan_number_decimal1: + // state: we just parsed a decimal point + number_type = token_type::value_float; + switch (get()) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + add(current); + goto scan_number_decimal2; + } + + default: + { + error_message = "invalid number; expected digit after '.'"; + return token_type::parse_error; + } + } + +scan_number_decimal2: + // we just parsed at least one number after a decimal point + switch (get()) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + add(current); + goto scan_number_decimal2; + } + + case 'e': + case 'E': + { + add(current); + goto scan_number_exponent; + } + + default: + goto scan_number_done; + } + +scan_number_exponent: + // we just parsed an exponent + number_type = token_type::value_float; + switch (get()) + { + case '+': + case '-': + { + add(current); + goto scan_number_sign; + } + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + add(current); + goto scan_number_any2; + } + + default: + { + error_message = + "invalid number; expected '+', '-', or digit after exponent"; + return token_type::parse_error; + } + } + +scan_number_sign: + // we just parsed an exponent sign + switch (get()) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + add(current); + goto scan_number_any2; + } + + default: + { + error_message = "invalid number; expected digit after exponent sign"; + return token_type::parse_error; + } + } + +scan_number_any2: + // we just parsed a number after the exponent or exponent sign + switch (get()) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + add(current); + goto scan_number_any2; + } + + default: + goto scan_number_done; + } + +scan_number_done: + // unget the character after the number (we only read it to know that + // we are done scanning a number) + unget(); + + char* endptr = nullptr; + errno = 0; + + // try to parse integers first and fall back to floats + if (number_type == token_type::value_unsigned) + { + const auto x = std::strtoull(yytext.data(), &endptr, 10); + + // we checked the number format before + assert(endptr == yytext.data() + yytext.size()); + + if (errno == 0) + { + value_unsigned = static_cast(x); + if (value_unsigned == x) + { + return token_type::value_unsigned; + } + } + } + else if (number_type == token_type::value_integer) + { + const auto x = std::strtoll(yytext.data(), &endptr, 10); + + // we checked the number format before + assert(endptr == yytext.data() + yytext.size()); + + if (errno == 0) + { + value_integer = static_cast(x); + if (value_integer == x) + { + return token_type::value_integer; + } + } + } + + // this code is reached if we parse a floating-point number or if an + // integer conversion above failed + strtof(value_float, yytext.data(), &endptr); + + // we checked the number format before + assert(endptr == yytext.data() + yytext.size()); + + return token_type::value_float; + } + + /*! + @param[in] literal_text the literal text to expect + @param[in] length the length of the passed literal text + @param[in] return_type the token type to return on success + */ + token_type scan_literal(const char* literal_text, const std::size_t length, + token_type return_type) + { + assert(current == literal_text[0]); + for (std::size_t i = 1; i < length; ++i) + { + if (JSON_UNLIKELY(get() != literal_text[i])) + { + error_message = "invalid literal"; + return token_type::parse_error; + } + } + return return_type; + } + + ///////////////////// + // input management + ///////////////////// + + /// reset yytext; current character is beginning of token + void reset() noexcept + { + yytext.clear(); + token_string.clear(); + token_string.push_back(std::char_traits::to_char_type(current)); + } + + /* + @brief get next character from the input + + This function provides the interface to the used input adapter. It does + not throw in case the input reached EOF, but returns a + `std::char_traits::eof()` in that case. Stores the scanned characters + for use in error messages. + + @return character read from the input + */ + std::char_traits::int_type get() + { + ++chars_read; + current = ia->get_character(); + if (JSON_LIKELY(current != std::char_traits::eof())) + { + token_string.push_back(std::char_traits::to_char_type(current)); + } + return current; + } + + /// unget current character (return it again on next get) + void unget() + { + --chars_read; + if (JSON_LIKELY(current != std::char_traits::eof())) + { + ia->unget_character(); + assert(token_string.size() != 0); + token_string.pop_back(); + } + } + + /// add a character to yytext + void add(int c) + { + yytext.push_back(std::char_traits::to_char_type(c)); + } + + public: + ///////////////////// + // value getters + ///////////////////// + + /// return integer value + constexpr number_integer_t get_number_integer() const noexcept + { + return value_integer; + } + + /// return unsigned integer value + constexpr number_unsigned_t get_number_unsigned() const noexcept + { + return value_unsigned; + } + + /// return floating-point value + constexpr number_float_t get_number_float() const noexcept + { + return value_float; + } + + /// return current string value (implicitly resets the token; useful only once) + std::string move_string() + { + return std::move(yytext); + } + + ///////////////////// + // diagnostics + ///////////////////// + + /// return position of last read token + constexpr std::size_t get_position() const noexcept + { + return chars_read; + } + + /// return the last read token (for errors only). Will never contain EOF + /// (an arbitrary value that is not a valid char value, often -1), because + /// 255 may legitimately occur. May contain NUL, which should be escaped. + std::string get_token_string() const + { + // escape control characters + std::string result; + for (auto c : token_string) + { + if ('\x00' <= c and c <= '\x1f') + { + // escape control characters + std::stringstream ss; + ss << "(c) << ">"; + result += ss.str(); + } + else + { + // add character as is + result.push_back(c); + } + } + + return result; + } + + /// return syntax error message + constexpr const char* get_error_message() const noexcept + { + return error_message; + } + + ///////////////////// + // actual scanner + ///////////////////// + + token_type scan() + { + // read next character and ignore whitespace + do + { + get(); + } + while (current == ' ' or current == '\t' or current == '\n' or current == '\r'); + + switch (current) + { + // structural characters + case '[': + return token_type::begin_array; + case ']': + return token_type::end_array; + case '{': + return token_type::begin_object; + case '}': + return token_type::end_object; + case ':': + return token_type::name_separator; + case ',': + return token_type::value_separator; + + // literals + case 't': + return scan_literal("true", 4, token_type::literal_true); + case 'f': + return scan_literal("false", 5, token_type::literal_false); + case 'n': + return scan_literal("null", 4, token_type::literal_null); + + // string + case '\"': + return scan_string(); + + // number + case '-': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + return scan_number(); + + // end of input (the null byte is needed when parsing from + // string literals) + case '\0': + case std::char_traits::eof(): + return token_type::end_of_input; + + // error + default: + error_message = "invalid literal"; + return token_type::parse_error; + } + } + + private: + /// input adapter + detail::input_adapter_t ia = nullptr; + + /// the current character + std::char_traits::int_type current = std::char_traits::eof(); + + /// the number of characters read + std::size_t chars_read = 0; + + /// raw input token string (for error messages) + std::vector token_string { }; + + /// buffer for variable-length tokens (numbers, strings) + std::string yytext { }; + + /// a description of occurred lexer errors + const char* error_message = ""; + + // number values + number_integer_t value_integer = 0; + number_unsigned_t value_unsigned = 0; + number_float_t value_float = 0; + + /// the decimal point + const char decimal_point_char = '.'; +}; + +/*! +@brief syntax analysis + +This class implements a recursive decent parser. +*/ +template +class parser +{ + using number_integer_t = typename BasicJsonType::number_integer_t; + using number_unsigned_t = typename BasicJsonType::number_unsigned_t; + using number_float_t = typename BasicJsonType::number_float_t; + using lexer_t = lexer; + using token_type = typename lexer_t::token_type; + + public: + enum class parse_event_t : uint8_t + { + /// the parser read `{` and started to process a JSON object + object_start, + /// the parser read `}` and finished processing a JSON object + object_end, + /// the parser read `[` and started to process a JSON array + array_start, + /// the parser read `]` and finished processing a JSON array + array_end, + /// the parser read a key of a value in an object + key, + /// the parser finished reading a JSON value + value + }; + + using parser_callback_t = + std::function; + + /// a parser reading from an input adapter + explicit parser(detail::input_adapter_t adapter, + const parser_callback_t cb = nullptr, + const bool allow_exceptions_ = true) + : callback(cb), m_lexer(adapter), allow_exceptions(allow_exceptions_) + {} + + /*! + @brief public parser interface + + @param[in] strict whether to expect the last token to be EOF + @param[in,out] result parsed JSON value + + @throw parse_error.101 in case of an unexpected token + @throw parse_error.102 if to_unicode fails or surrogate error + @throw parse_error.103 if to_unicode fails + */ + void parse(const bool strict, BasicJsonType& result) + { + // read first token + get_token(); + + parse_internal(true, result); + result.assert_invariant(); + + // in strict mode, input must be completely read + if (strict) + { + get_token(); + expect(token_type::end_of_input); + } + + // in case of an error, return discarded value + if (errored) + { + result = value_t::discarded; + return; + } + + // set top-level value to null if it was discarded by the callback + // function + if (result.is_discarded()) + { + result = nullptr; + } + } + + /*! + @brief public accept interface + + @param[in] strict whether to expect the last token to be EOF + @return whether the input is a proper JSON text + */ + bool accept(const bool strict = true) + { + // read first token + get_token(); + + if (not accept_internal()) + { + return false; + } + + // strict => last token must be EOF + return not strict or (get_token() == token_type::end_of_input); + } + + private: + /*! + @brief the actual parser + @throw parse_error.101 in case of an unexpected token + @throw parse_error.102 if to_unicode fails or surrogate error + @throw parse_error.103 if to_unicode fails + */ + void parse_internal(bool keep, BasicJsonType& result) + { + // never parse after a parse error was detected + assert(not errored); + + // start with a discarded value + if (not result.is_discarded()) + { + result.m_value.destroy(result.m_type); + result.m_type = value_t::discarded; + } + + switch (last_token) + { + case token_type::begin_object: + { + if (keep) + { + if (callback) + { + keep = callback(depth++, parse_event_t::object_start, result); + } + + if (not callback or keep) + { + // explicitly set result to object to cope with {} + result.m_type = value_t::object; + result.m_value = value_t::object; + } + } + + // read next token + get_token(); + + // closing } -> we are done + if (last_token == token_type::end_object) + { + if (keep and callback and not callback(--depth, parse_event_t::object_end, result)) + { + result.m_value.destroy(result.m_type); + result.m_type = value_t::discarded; + } + break; + } + + // parse values + std::string key; + BasicJsonType value; + while (true) + { + // store key + if (not expect(token_type::value_string)) + { + return; + } + key = m_lexer.move_string(); + + bool keep_tag = false; + if (keep) + { + if (callback) + { + BasicJsonType k(key); + keep_tag = callback(depth, parse_event_t::key, k); + } + else + { + keep_tag = true; + } + } + + // parse separator (:) + get_token(); + if (not expect(token_type::name_separator)) + { + return; + } + + // parse and add value + get_token(); + value.m_value.destroy(value.m_type); + value.m_type = value_t::discarded; + parse_internal(keep, value); + + if (JSON_UNLIKELY(errored)) + { + return; + } + + if (keep and keep_tag and not value.is_discarded()) + { + result.m_value.object->emplace(std::move(key), std::move(value)); + } + + // comma -> next value + get_token(); + if (last_token == token_type::value_separator) + { + get_token(); + continue; + } + + // closing } + if (not expect(token_type::end_object)) + { + return; + } + break; + } + + if (keep and callback and not callback(--depth, parse_event_t::object_end, result)) + { + result.m_value.destroy(result.m_type); + result.m_type = value_t::discarded; + } + break; + } + + case token_type::begin_array: + { + if (keep) + { + if (callback) + { + keep = callback(depth++, parse_event_t::array_start, result); + } + + if (not callback or keep) + { + // explicitly set result to array to cope with [] + result.m_type = value_t::array; + result.m_value = value_t::array; + } + } + + // read next token + get_token(); + + // closing ] -> we are done + if (last_token == token_type::end_array) + { + if (callback and not callback(--depth, parse_event_t::array_end, result)) + { + result.m_value.destroy(result.m_type); + result.m_type = value_t::discarded; + } + break; + } + + // parse values + BasicJsonType value; + while (true) + { + // parse value + value.m_value.destroy(value.m_type); + value.m_type = value_t::discarded; + parse_internal(keep, value); + + if (JSON_UNLIKELY(errored)) + { + return; + } + + if (keep and not value.is_discarded()) + { + result.m_value.array->push_back(std::move(value)); + } + + // comma -> next value + get_token(); + if (last_token == token_type::value_separator) + { + get_token(); + continue; + } + + // closing ] + if (not expect(token_type::end_array)) + { + return; + } + break; + } + + if (keep and callback and not callback(--depth, parse_event_t::array_end, result)) + { + result.m_value.destroy(result.m_type); + result.m_type = value_t::discarded; + } + break; + } + + case token_type::literal_null: + { + result.m_type = value_t::null; + break; + } + + case token_type::value_string: + { + result.m_type = value_t::string; + result.m_value = m_lexer.move_string(); + break; + } + + case token_type::literal_true: + { + result.m_type = value_t::boolean; + result.m_value = true; + break; + } + + case token_type::literal_false: + { + result.m_type = value_t::boolean; + result.m_value = false; + break; + } + + case token_type::value_unsigned: + { + result.m_type = value_t::number_unsigned; + result.m_value = m_lexer.get_number_unsigned(); + break; + } + + case token_type::value_integer: + { + result.m_type = value_t::number_integer; + result.m_value = m_lexer.get_number_integer(); + break; + } + + case token_type::value_float: + { + result.m_type = value_t::number_float; + result.m_value = m_lexer.get_number_float(); + + // throw in case of infinity or NAN + if (JSON_UNLIKELY(not std::isfinite(result.m_value.number_float))) + { + if (allow_exceptions) + { + JSON_THROW(out_of_range::create(406, "number overflow parsing '" + + m_lexer.get_token_string() + "'")); + } + expect(token_type::uninitialized); + } + break; + } + + case token_type::parse_error: + { + // using "uninitialized" to avoid "expected" message + if (not expect(token_type::uninitialized)) + { + return; + } + break; // LCOV_EXCL_LINE + } + + default: + { + // the last token was unexpected; we expected a value + if (not expect(token_type::literal_or_value)) + { + return; + } + break; // LCOV_EXCL_LINE + } + } + + if (keep and callback and not callback(depth, parse_event_t::value, result)) + { + result.m_type = value_t::discarded; + } + } + + /*! + @brief the acutal acceptor + + @invariant 1. The last token is not yet processed. Therefore, the caller + of this function must make sure a token has been read. + 2. When this function returns, the last token is processed. + That is, the last read character was already considered. + + This invariant makes sure that no token needs to be "unput". + */ + bool accept_internal() + { + switch (last_token) + { + case token_type::begin_object: + { + // read next token + get_token(); + + // closing } -> we are done + if (last_token == token_type::end_object) + { + return true; + } + + // parse values + while (true) + { + // parse key + if (last_token != token_type::value_string) + { + return false; + } + + // parse separator (:) + get_token(); + if (last_token != token_type::name_separator) + { + return false; + } + + // parse value + get_token(); + if (not accept_internal()) + { + return false; + } + + // comma -> next value + get_token(); + if (last_token == token_type::value_separator) + { + get_token(); + continue; + } + + // closing } + return (last_token == token_type::end_object); + } + } + + case token_type::begin_array: + { + // read next token + get_token(); + + // closing ] -> we are done + if (last_token == token_type::end_array) + { + return true; + } + + // parse values + while (true) + { + // parse value + if (not accept_internal()) + { + return false; + } + + // comma -> next value + get_token(); + if (last_token == token_type::value_separator) + { + get_token(); + continue; + } + + // closing ] + return (last_token == token_type::end_array); + } + } + + case token_type::value_float: + { + // reject infinity or NAN + return std::isfinite(m_lexer.get_number_float()); + } + + case token_type::literal_false: + case token_type::literal_null: + case token_type::literal_true: + case token_type::value_integer: + case token_type::value_string: + case token_type::value_unsigned: + return true; + + default: // the last token was unexpected + return false; + } + } + + /// get next token from lexer + token_type get_token() + { + return (last_token = m_lexer.scan()); + } + + /*! + @throw parse_error.101 if expected token did not occur + */ + bool expect(token_type t) + { + if (JSON_UNLIKELY(t != last_token)) + { + errored = true; + expected = t; + if (allow_exceptions) + { + throw_exception(); + } + else + { + return false; + } + } + + return true; + } + + [[noreturn]] void throw_exception() const + { + std::string error_msg = "syntax error - "; + if (last_token == token_type::parse_error) + { + error_msg += std::string(m_lexer.get_error_message()) + "; last read: '" + + m_lexer.get_token_string() + "'"; + } + else + { + error_msg += "unexpected " + std::string(lexer_t::token_type_name(last_token)); + } + + if (expected != token_type::uninitialized) + { + error_msg += "; expected " + std::string(lexer_t::token_type_name(expected)); + } + + JSON_THROW(parse_error::create(101, m_lexer.get_position(), error_msg)); + } + + private: + /// current level of recursion + int depth = 0; + /// callback function + const parser_callback_t callback = nullptr; + /// the type of the last read token + token_type last_token = token_type::uninitialized; + /// the lexer + lexer_t m_lexer; + /// whether a syntax error occurred + bool errored = false; + /// possible reason for the syntax error + token_type expected = token_type::uninitialized; + /// whether to throw exceptions in case of errors + const bool allow_exceptions = true; +}; + +/////////////// +// iterators // +/////////////// + +/*! +@brief an iterator for primitive JSON types + +This class models an iterator for primitive JSON types (boolean, number, +string). It's only purpose is to allow the iterator/const_iterator classes +to "iterate" over primitive values. Internally, the iterator is modeled by +a `difference_type` variable. Value begin_value (`0`) models the begin, +end_value (`1`) models past the end. +*/ +class primitive_iterator_t +{ + public: + using difference_type = std::ptrdiff_t; + + constexpr difference_type get_value() const noexcept + { + return m_it; + } + + /// set iterator to a defined beginning + void set_begin() noexcept + { + m_it = begin_value; + } + + /// set iterator to a defined past the end + void set_end() noexcept + { + m_it = end_value; + } + + /// return whether the iterator can be dereferenced + constexpr bool is_begin() const noexcept + { + return m_it == begin_value; + } + + /// return whether the iterator is at end + constexpr bool is_end() const noexcept + { + return m_it == end_value; + } + + friend constexpr bool operator==(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept + { + return lhs.m_it == rhs.m_it; + } + + friend constexpr bool operator<(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept + { + return lhs.m_it < rhs.m_it; + } + + primitive_iterator_t operator+(difference_type i) + { + auto result = *this; + result += i; + return result; + } + + friend constexpr difference_type operator-(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept + { + return lhs.m_it - rhs.m_it; + } + + friend std::ostream& operator<<(std::ostream& os, primitive_iterator_t it) + { + return os << it.m_it; + } + + primitive_iterator_t& operator++() + { + ++m_it; + return *this; + } + + primitive_iterator_t operator++(int) + { + auto result = *this; + m_it++; + return result; + } + + primitive_iterator_t& operator--() + { + --m_it; + return *this; + } + + primitive_iterator_t operator--(int) + { + auto result = *this; + m_it--; + return result; + } + + primitive_iterator_t& operator+=(difference_type n) + { + m_it += n; + return *this; + } + + primitive_iterator_t& operator-=(difference_type n) + { + m_it -= n; + return *this; + } + + private: + static constexpr difference_type begin_value = 0; + static constexpr difference_type end_value = begin_value + 1; + + /// iterator as signed integer type + difference_type m_it = (std::numeric_limits::min)(); +}; + +/*! +@brief an iterator value + +@note This structure could easily be a union, but MSVC currently does not allow +unions members with complex constructors, see https://github.com/nlohmann/json/pull/105. +*/ +template struct internal_iterator +{ + /// iterator for JSON objects + typename BasicJsonType::object_t::iterator object_iterator {}; + /// iterator for JSON arrays + typename BasicJsonType::array_t::iterator array_iterator {}; + /// generic iterator for all other types + primitive_iterator_t primitive_iterator {}; +}; + +template class iteration_proxy; + +/*! +@brief a template for a bidirectional iterator for the @ref basic_json class + +This class implements a both iterators (iterator and const_iterator) for the +@ref basic_json class. + +@note An iterator is called *initialized* when a pointer to a JSON value has + been set (e.g., by a constructor or a copy assignment). If the iterator is + default-constructed, it is *uninitialized* and most methods are undefined. + **The library uses assertions to detect calls on uninitialized iterators.** + +@requirement The class satisfies the following concept requirements: +- +[BidirectionalIterator](http://en.cppreference.com/w/cpp/concept/BidirectionalIterator): + The iterator that can be moved can be moved in both directions (i.e. + incremented and decremented). + +@since version 1.0.0, simplified in version 2.0.9, change to bidirectional + iterators in version 3.0.0 (see https://github.com/nlohmann/json/issues/593) +*/ +template +class iter_impl : public std::iterator +{ + /// allow basic_json to access private members + friend iter_impl::value, typename std::remove_const::type, const BasicJsonType>::type>; + friend BasicJsonType; + friend iteration_proxy; + + using object_t = typename BasicJsonType::object_t; + using array_t = typename BasicJsonType::array_t; + // make sure BasicJsonType is basic_json or const basic_json + static_assert(is_basic_json::type>::value, + "iter_impl only accepts (const) basic_json"); + + public: + /// the type of the values when the iterator is dereferenced + using value_type = typename BasicJsonType::value_type; + /// a type to represent differences between iterators + using difference_type = typename BasicJsonType::difference_type; + /// defines a pointer to the type iterated over (value_type) + using pointer = typename std::conditional::value, + typename BasicJsonType::const_pointer, + typename BasicJsonType::pointer>::type; + /// defines a reference to the type iterated over (value_type) + using reference = + typename std::conditional::value, + typename BasicJsonType::const_reference, + typename BasicJsonType::reference>::type; + + /// default constructor + iter_impl() = default; + + /*! + @brief constructor for a given JSON instance + @param[in] object pointer to a JSON object for this iterator + @pre object != nullptr + @post The iterator is initialized; i.e. `m_object != nullptr`. + */ + explicit iter_impl(pointer object) noexcept : m_object(object) + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case value_t::object: + { + m_it.object_iterator = typename object_t::iterator(); + break; + } + + case value_t::array: + { + m_it.array_iterator = typename array_t::iterator(); + break; + } + + default: + { + m_it.primitive_iterator = primitive_iterator_t(); + break; + } + } + } + + /*! + @note The conventional copy constructor and copy assignment are implicitly + defined. Combined with the following converting constructor and + assignment, they support: (1) copy from iterator to iterator, (2) + copy from const iterator to const iterator, and (3) conversion from + iterator to const iterator. However conversion from const iterator + to iterator is not defined. + */ + + /*! + @brief converting constructor + @param[in] other non-const iterator to copy from + @note It is not checked whether @a other is initialized. + */ + iter_impl(const iter_impl::type>& other) noexcept + : m_object(other.m_object), m_it(other.m_it) {} + + /*! + @brief converting assignment + @param[in,out] other non-const iterator to copy from + @return const/non-const iterator + @note It is not checked whether @a other is initialized. + */ + iter_impl& operator=(const iter_impl::type>& other) noexcept + { + m_object = other.m_object; + m_it = other.m_it; + return *this; + } + + private: + /*! + @brief set the iterator to the first value + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + void set_begin() noexcept + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case value_t::object: + { + m_it.object_iterator = m_object->m_value.object->begin(); + break; + } + + case value_t::array: + { + m_it.array_iterator = m_object->m_value.array->begin(); + break; + } + + case value_t::null: + { + // set to end so begin()==end() is true: null is empty + m_it.primitive_iterator.set_end(); + break; + } + + default: + { + m_it.primitive_iterator.set_begin(); + break; + } + } + } + + /*! + @brief set the iterator past the last value + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + void set_end() noexcept + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case value_t::object: + { + m_it.object_iterator = m_object->m_value.object->end(); + break; + } + + case value_t::array: + { + m_it.array_iterator = m_object->m_value.array->end(); + break; + } + + default: + { + m_it.primitive_iterator.set_end(); + break; + } + } + } + + public: + /*! + @brief return a reference to the value pointed to by the iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + reference operator*() const + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case value_t::object: + { + assert(m_it.object_iterator != m_object->m_value.object->end()); + return m_it.object_iterator->second; + } + + case value_t::array: + { + assert(m_it.array_iterator != m_object->m_value.array->end()); + return *m_it.array_iterator; + } + + case value_t::null: + JSON_THROW(invalid_iterator::create(214, "cannot get value")); + + default: + { + if (JSON_LIKELY(m_it.primitive_iterator.is_begin())) + { + return *m_object; + } + + JSON_THROW(invalid_iterator::create(214, "cannot get value")); + } + } + } + + /*! + @brief dereference the iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + pointer operator->() const + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case value_t::object: + { + assert(m_it.object_iterator != m_object->m_value.object->end()); + return &(m_it.object_iterator->second); + } + + case value_t::array: + { + assert(m_it.array_iterator != m_object->m_value.array->end()); + return &*m_it.array_iterator; + } + + default: + { + if (JSON_LIKELY(m_it.primitive_iterator.is_begin())) + { + return m_object; + } + + JSON_THROW(invalid_iterator::create(214, "cannot get value")); + } + } + } + + /*! + @brief post-increment (it++) + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl operator++(int) + { + auto result = *this; + ++(*this); + return result; + } + + /*! + @brief pre-increment (++it) + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl& operator++() + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case value_t::object: + { + std::advance(m_it.object_iterator, 1); + break; + } + + case value_t::array: + { + std::advance(m_it.array_iterator, 1); + break; + } + + default: + { + ++m_it.primitive_iterator; + break; + } + } + + return *this; + } + + /*! + @brief post-decrement (it--) + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl operator--(int) + { + auto result = *this; + --(*this); + return result; + } + + /*! + @brief pre-decrement (--it) + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl& operator--() + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case value_t::object: + { + std::advance(m_it.object_iterator, -1); + break; + } + + case value_t::array: + { + std::advance(m_it.array_iterator, -1); + break; + } + + default: + { + --m_it.primitive_iterator; + break; + } + } + + return *this; + } + + /*! + @brief comparison: equal + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + bool operator==(const iter_impl& other) const + { + // if objects are not the same, the comparison is undefined + if (JSON_UNLIKELY(m_object != other.m_object)) + { + JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers")); + } + + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case value_t::object: + return (m_it.object_iterator == other.m_it.object_iterator); + + case value_t::array: + return (m_it.array_iterator == other.m_it.array_iterator); + + default: + return (m_it.primitive_iterator == other.m_it.primitive_iterator); + } + } + + /*! + @brief comparison: not equal + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + bool operator!=(const iter_impl& other) const + { + return not operator==(other); + } + + /*! + @brief comparison: smaller + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + bool operator<(const iter_impl& other) const + { + // if objects are not the same, the comparison is undefined + if (JSON_UNLIKELY(m_object != other.m_object)) + { + JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers")); + } + + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case value_t::object: + JSON_THROW(invalid_iterator::create(213, "cannot compare order of object iterators")); + + case value_t::array: + return (m_it.array_iterator < other.m_it.array_iterator); + + default: + return (m_it.primitive_iterator < other.m_it.primitive_iterator); + } + } + + /*! + @brief comparison: less than or equal + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + bool operator<=(const iter_impl& other) const + { + return not other.operator < (*this); + } + + /*! + @brief comparison: greater than + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + bool operator>(const iter_impl& other) const + { + return not operator<=(other); + } + + /*! + @brief comparison: greater than or equal + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + bool operator>=(const iter_impl& other) const + { + return not operator<(other); + } + + /*! + @brief add to iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl& operator+=(difference_type i) + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case value_t::object: + JSON_THROW(invalid_iterator::create(209, "cannot use offsets with object iterators")); + + case value_t::array: + { + std::advance(m_it.array_iterator, i); + break; + } + + default: + { + m_it.primitive_iterator += i; + break; + } + } + + return *this; + } + + /*! + @brief subtract from iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl& operator-=(difference_type i) + { + return operator+=(-i); + } + + /*! + @brief add to iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl operator+(difference_type i) const + { + auto result = *this; + result += i; + return result; + } + + /*! + @brief addition of distance and iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + friend iter_impl operator+(difference_type i, const iter_impl& it) + { + auto result = it; + result += i; + return result; + } + + /*! + @brief subtract from iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl operator-(difference_type i) const + { + auto result = *this; + result -= i; + return result; + } + + /*! + @brief return difference + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + difference_type operator-(const iter_impl& other) const + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case value_t::object: + JSON_THROW(invalid_iterator::create(209, "cannot use offsets with object iterators")); + + case value_t::array: + return m_it.array_iterator - other.m_it.array_iterator; + + default: + return m_it.primitive_iterator - other.m_it.primitive_iterator; + } + } + + /*! + @brief access to successor + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + reference operator[](difference_type n) const + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case value_t::object: + JSON_THROW(invalid_iterator::create(208, "cannot use operator[] for object iterators")); + + case value_t::array: + return *std::next(m_it.array_iterator, n); + + case value_t::null: + JSON_THROW(invalid_iterator::create(214, "cannot get value")); + + default: + { + if (JSON_LIKELY(m_it.primitive_iterator.get_value() == -n)) + { + return *m_object; + } + + JSON_THROW(invalid_iterator::create(214, "cannot get value")); + } + } + } + + /*! + @brief return the key of an object iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + typename object_t::key_type key() const + { + assert(m_object != nullptr); + + if (JSON_LIKELY(m_object->is_object())) + { + return m_it.object_iterator->first; + } + + JSON_THROW(invalid_iterator::create(207, "cannot use key() for non-object iterators")); + } + + /*! + @brief return the value of an iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + reference value() const + { + return operator*(); + } + + private: + /// associated JSON instance + pointer m_object = nullptr; + /// the actual iterator of the associated instance + internal_iterator::type> m_it = {}; +}; + +/// proxy class for the iterator_wrapper functions +template class iteration_proxy +{ + private: + /// helper class for iteration + class iteration_proxy_internal + { + private: + /// the iterator + IteratorType anchor; + /// an index for arrays (used to create key names) + std::size_t array_index = 0; + + public: + explicit iteration_proxy_internal(IteratorType it) noexcept : anchor(it) {} + + /// dereference operator (needed for range-based for) + iteration_proxy_internal& operator*() + { + return *this; + } + + /// increment operator (needed for range-based for) + iteration_proxy_internal& operator++() + { + ++anchor; + ++array_index; + + return *this; + } + + /// inequality operator (needed for range-based for) + bool operator!=(const iteration_proxy_internal& o) const noexcept + { + return anchor != o.anchor; + } + + /// return key of the iterator + std::string key() const + { + assert(anchor.m_object != nullptr); + + switch (anchor.m_object->type()) + { + // use integer array index as key + case value_t::array: + return std::to_string(array_index); + + // use key from the object + case value_t::object: + return anchor.key(); + + // use an empty key for all primitive types + default: + return ""; + } + } + + /// return value of the iterator + typename IteratorType::reference value() const + { + return anchor.value(); + } + }; + + /// the container to iterate + typename IteratorType::reference container; + + public: + /// construct iteration proxy from a container + explicit iteration_proxy(typename IteratorType::reference cont) + : container(cont) {} + + /// return iterator begin (needed for range-based for) + iteration_proxy_internal begin() noexcept + { + return iteration_proxy_internal(container.begin()); + } + + /// return iterator end (needed for range-based for) + iteration_proxy_internal end() noexcept + { + return iteration_proxy_internal(container.end()); + } +}; + +/*! +@brief a template for a reverse iterator class + +@tparam Base the base iterator type to reverse. Valid types are @ref +iterator (to create @ref reverse_iterator) and @ref const_iterator (to +create @ref const_reverse_iterator). + +@requirement The class satisfies the following concept requirements: +- +[BidirectionalIterator](http://en.cppreference.com/w/cpp/concept/BidirectionalIterator): + The iterator that can be moved can be moved in both directions (i.e. + incremented and decremented). +- [OutputIterator](http://en.cppreference.com/w/cpp/concept/OutputIterator): + It is possible to write to the pointed-to element (only if @a Base is + @ref iterator). + +@since version 1.0.0 +*/ +template +class json_reverse_iterator : public std::reverse_iterator +{ + public: + using difference_type = std::ptrdiff_t; + /// shortcut to the reverse iterator adaptor + using base_iterator = std::reverse_iterator; + /// the reference type for the pointed-to element + using reference = typename Base::reference; + + /// create reverse iterator from iterator + json_reverse_iterator(const typename base_iterator::iterator_type& it) noexcept + : base_iterator(it) {} + + /// create reverse iterator from base class + json_reverse_iterator(const base_iterator& it) noexcept : base_iterator(it) {} + + /// post-increment (it++) + json_reverse_iterator operator++(int) + { + return static_cast(base_iterator::operator++(1)); + } + + /// pre-increment (++it) + json_reverse_iterator& operator++() + { + return static_cast(base_iterator::operator++()); + } + + /// post-decrement (it--) + json_reverse_iterator operator--(int) + { + return static_cast(base_iterator::operator--(1)); + } + + /// pre-decrement (--it) + json_reverse_iterator& operator--() + { + return static_cast(base_iterator::operator--()); + } + + /// add to iterator + json_reverse_iterator& operator+=(difference_type i) + { + return static_cast(base_iterator::operator+=(i)); + } + + /// add to iterator + json_reverse_iterator operator+(difference_type i) const + { + return static_cast(base_iterator::operator+(i)); + } + + /// subtract from iterator + json_reverse_iterator operator-(difference_type i) const + { + return static_cast(base_iterator::operator-(i)); + } + + /// return difference + difference_type operator-(const json_reverse_iterator& other) const + { + return base_iterator(*this) - base_iterator(other); + } + + /// access to successor + reference operator[](difference_type n) const + { + return *(this->operator+(n)); + } + + /// return the key of an object iterator + auto key() const -> decltype(std::declval().key()) + { + auto it = --this->base(); + return it.key(); + } + + /// return the value of an iterator + reference value() const + { + auto it = --this->base(); + return it.operator * (); + } +}; + +///////////////////// +// output adapters // +///////////////////// + +/// abstract output adapter interface +template struct output_adapter_protocol +{ + virtual void write_character(CharType c) = 0; + virtual void write_characters(const CharType* s, std::size_t length) = 0; + virtual ~output_adapter_protocol() = default; +}; + +/// a type to simplify interfaces +template +using output_adapter_t = std::shared_ptr>; + +/// output adapter for byte vectors +template +class output_vector_adapter : public output_adapter_protocol +{ + public: + explicit output_vector_adapter(std::vector& vec) : v(vec) {} + + void write_character(CharType c) override + { + v.push_back(c); + } + + void write_characters(const CharType* s, std::size_t length) override + { + std::copy(s, s + length, std::back_inserter(v)); + } + + private: + std::vector& v; +}; + +/// output adapter for output streams +template +class output_stream_adapter : public output_adapter_protocol +{ + public: + explicit output_stream_adapter(std::basic_ostream& s) : stream(s) {} + + void write_character(CharType c) override + { + stream.put(c); + } + + void write_characters(const CharType* s, std::size_t length) override + { + stream.write(s, static_cast(length)); + } + + private: + std::basic_ostream& stream; +}; + +/// output adapter for basic_string +template +class output_string_adapter : public output_adapter_protocol +{ + public: + explicit output_string_adapter(std::basic_string& s) : str(s) {} + + void write_character(CharType c) override + { + str.push_back(c); + } + + void write_characters(const CharType* s, std::size_t length) override + { + str.append(s, length); + } + + private: + std::basic_string& str; +}; + +template +class output_adapter +{ + public: + output_adapter(std::vector& vec) + : oa(std::make_shared>(vec)) {} + + output_adapter(std::basic_ostream& s) + : oa(std::make_shared>(s)) {} + + output_adapter(std::basic_string& s) + : oa(std::make_shared>(s)) {} + + operator output_adapter_t() + { + return oa; + } + + private: + output_adapter_t oa = nullptr; +}; + +////////////////////////////// +// binary reader and writer // +////////////////////////////// + +/*! +@brief deserialization of CBOR and MessagePack values +*/ +template +class binary_reader +{ + using number_integer_t = typename BasicJsonType::number_integer_t; + using number_unsigned_t = typename BasicJsonType::number_unsigned_t; + + public: + /*! + @brief create a binary reader + + @param[in] adapter input adapter to read from + */ + explicit binary_reader(input_adapter_t adapter) : ia(std::move(adapter)) + { + assert(ia); + } + + /*! + @brief create a JSON value from CBOR input + + @param[in] strict whether to expect the input to be consumed completed + @return JSON value created from CBOR input + + @throw parse_error.110 if input ended unexpectedly or the end of file was + not reached when @a strict was set to true + @throw parse_error.112 if unsupported byte was read + */ + BasicJsonType parse_cbor(const bool strict) + { + const auto res = parse_cbor_internal(); + if (strict) + { + get(); + check_eof(true); + } + return res; + } + + /*! + @brief create a JSON value from MessagePack input + + @param[in] strict whether to expect the input to be consumed completed + @return JSON value created from MessagePack input + + @throw parse_error.110 if input ended unexpectedly or the end of file was + not reached when @a strict was set to true + @throw parse_error.112 if unsupported byte was read + */ + BasicJsonType parse_msgpack(const bool strict) + { + const auto res = parse_msgpack_internal(); + if (strict) + { + get(); + check_eof(true); + } + return res; + } + + /*! + @brief determine system byte order + + @return true if and only if system's byte order is little endian + + @note from http://stackoverflow.com/a/1001328/266378 + */ + static constexpr bool little_endianess(int num = 1) noexcept + { + return (*reinterpret_cast(&num) == 1); + } + + private: + /*! + @param[in] get_char whether a new character should be retrieved from the + input (true, default) or whether the last read + character should be considered instead + */ + BasicJsonType parse_cbor_internal(const bool get_char = true) + { + switch (get_char ? get() : current) + { + // EOF + case std::char_traits::eof(): + JSON_THROW(parse_error::create(110, chars_read, "unexpected end of input")); + + // Integer 0x00..0x17 (0..23) + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + return static_cast(current); + + case 0x18: // Unsigned integer (one-byte uint8_t follows) + return get_number(); + + case 0x19: // Unsigned integer (two-byte uint16_t follows) + return get_number(); + + case 0x1a: // Unsigned integer (four-byte uint32_t follows) + return get_number(); + + case 0x1b: // Unsigned integer (eight-byte uint64_t follows) + return get_number(); + + // Negative integer -1-0x00..-1-0x17 (-1..-24) + case 0x20: + case 0x21: + case 0x22: + case 0x23: + case 0x24: + case 0x25: + case 0x26: + case 0x27: + case 0x28: + case 0x29: + case 0x2a: + case 0x2b: + case 0x2c: + case 0x2d: + case 0x2e: + case 0x2f: + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: + case 0x35: + case 0x36: + case 0x37: + return static_cast(0x20 - 1 - current); + + case 0x38: // Negative integer (one-byte uint8_t follows) + { + // must be uint8_t ! + return static_cast(-1) - get_number(); + } + + case 0x39: // Negative integer -1-n (two-byte uint16_t follows) + { + return static_cast(-1) - get_number(); + } + + case 0x3a: // Negative integer -1-n (four-byte uint32_t follows) + { + return static_cast(-1) - get_number(); + } + + case 0x3b: // Negative integer -1-n (eight-byte uint64_t follows) + { + return static_cast(-1) - + static_cast(get_number()); + } + + // UTF-8 string (0x00..0x17 bytes follow) + case 0x60: + case 0x61: + case 0x62: + case 0x63: + case 0x64: + case 0x65: + case 0x66: + case 0x67: + case 0x68: + case 0x69: + case 0x6a: + case 0x6b: + case 0x6c: + case 0x6d: + case 0x6e: + case 0x6f: + case 0x70: + case 0x71: + case 0x72: + case 0x73: + case 0x74: + case 0x75: + case 0x76: + case 0x77: + case 0x78: // UTF-8 string (one-byte uint8_t for n follows) + case 0x79: // UTF-8 string (two-byte uint16_t for n follow) + case 0x7a: // UTF-8 string (four-byte uint32_t for n follow) + case 0x7b: // UTF-8 string (eight-byte uint64_t for n follow) + case 0x7f: // UTF-8 string (indefinite length) + { + return get_cbor_string(); + } + + // array (0x00..0x17 data items follow) + case 0x80: + case 0x81: + case 0x82: + case 0x83: + case 0x84: + case 0x85: + case 0x86: + case 0x87: + case 0x88: + case 0x89: + case 0x8a: + case 0x8b: + case 0x8c: + case 0x8d: + case 0x8e: + case 0x8f: + case 0x90: + case 0x91: + case 0x92: + case 0x93: + case 0x94: + case 0x95: + case 0x96: + case 0x97: + { + return get_cbor_array(current & 0x1f); + } + + case 0x98: // array (one-byte uint8_t for n follows) + { + return get_cbor_array(get_number()); + } + + case 0x99: // array (two-byte uint16_t for n follow) + { + return get_cbor_array(get_number()); + } + + case 0x9a: // array (four-byte uint32_t for n follow) + { + return get_cbor_array(get_number()); + } + + case 0x9b: // array (eight-byte uint64_t for n follow) + { + return get_cbor_array(get_number()); + } + + case 0x9f: // array (indefinite length) + { + BasicJsonType result = value_t::array; + while (get() != 0xff) + { + result.push_back(parse_cbor_internal(false)); + } + return result; + } + + // map (0x00..0x17 pairs of data items follow) + case 0xa0: + case 0xa1: + case 0xa2: + case 0xa3: + case 0xa4: + case 0xa5: + case 0xa6: + case 0xa7: + case 0xa8: + case 0xa9: + case 0xaa: + case 0xab: + case 0xac: + case 0xad: + case 0xae: + case 0xaf: + case 0xb0: + case 0xb1: + case 0xb2: + case 0xb3: + case 0xb4: + case 0xb5: + case 0xb6: + case 0xb7: + { + return get_cbor_object(current & 0x1f); + } + + case 0xb8: // map (one-byte uint8_t for n follows) + { + return get_cbor_object(get_number()); + } + + case 0xb9: // map (two-byte uint16_t for n follow) + { + return get_cbor_object(get_number()); + } + + case 0xba: // map (four-byte uint32_t for n follow) + { + return get_cbor_object(get_number()); + } + + case 0xbb: // map (eight-byte uint64_t for n follow) + { + return get_cbor_object(get_number()); + } + + case 0xbf: // map (indefinite length) + { + BasicJsonType result = value_t::object; + while (get() != 0xff) + { + auto key = get_cbor_string(); + result[key] = parse_cbor_internal(); + } + return result; + } + + case 0xf4: // false + { + return false; + } + + case 0xf5: // true + { + return true; + } + + case 0xf6: // null + { + return value_t::null; + } + + case 0xf9: // Half-Precision Float (two-byte IEEE 754) + { + const int byte1 = get(); + check_eof(); + const int byte2 = get(); + check_eof(); + + // code from RFC 7049, Appendix D, Figure 3: + // As half-precision floating-point numbers were only added + // to IEEE 754 in 2008, today's programming platforms often + // still only have limited support for them. It is very + // easy to include at least decoding support for them even + // without such support. An example of a small decoder for + // half-precision floating-point numbers in the C language + // is shown in Fig. 3. + const int half = (byte1 << 8) + byte2; + const int exp = (half >> 10) & 0x1f; + const int mant = half & 0x3ff; + double val; + if (exp == 0) + { + val = std::ldexp(mant, -24); + } + else if (exp != 31) + { + val = std::ldexp(mant + 1024, exp - 25); + } + else + { + val = (mant == 0) ? std::numeric_limits::infinity() + : std::numeric_limits::quiet_NaN(); + } + return (half & 0x8000) != 0 ? -val : val; + } + + case 0xfa: // Single-Precision Float (four-byte IEEE 754) + { + return get_number(); + } + + case 0xfb: // Double-Precision Float (eight-byte IEEE 754) + { + return get_number(); + } + + default: // anything else (0xFF is handled inside the other types) + { + std::stringstream ss; + ss << std::setw(2) << std::setfill('0') << std::hex << current; + JSON_THROW(parse_error::create(112, chars_read, "error reading CBOR; last byte: 0x" + ss.str())); + } + } + } + + BasicJsonType parse_msgpack_internal() + { + switch (get()) + { + // EOF + case std::char_traits::eof(): + JSON_THROW(parse_error::create(110, chars_read, "unexpected end of input")); + + // positive fixint + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1a: + case 0x1b: + case 0x1c: + case 0x1d: + case 0x1e: + case 0x1f: + case 0x20: + case 0x21: + case 0x22: + case 0x23: + case 0x24: + case 0x25: + case 0x26: + case 0x27: + case 0x28: + case 0x29: + case 0x2a: + case 0x2b: + case 0x2c: + case 0x2d: + case 0x2e: + case 0x2f: + case 0x30: + case 0x31: + case 0x32: + case 0x33: + case 0x34: + case 0x35: + case 0x36: + case 0x37: + case 0x38: + case 0x39: + case 0x3a: + case 0x3b: + case 0x3c: + case 0x3d: + case 0x3e: + case 0x3f: + case 0x40: + case 0x41: + case 0x42: + case 0x43: + case 0x44: + case 0x45: + case 0x46: + case 0x47: + case 0x48: + case 0x49: + case 0x4a: + case 0x4b: + case 0x4c: + case 0x4d: + case 0x4e: + case 0x4f: + case 0x50: + case 0x51: + case 0x52: + case 0x53: + case 0x54: + case 0x55: + case 0x56: + case 0x57: + case 0x58: + case 0x59: + case 0x5a: + case 0x5b: + case 0x5c: + case 0x5d: + case 0x5e: + case 0x5f: + case 0x60: + case 0x61: + case 0x62: + case 0x63: + case 0x64: + case 0x65: + case 0x66: + case 0x67: + case 0x68: + case 0x69: + case 0x6a: + case 0x6b: + case 0x6c: + case 0x6d: + case 0x6e: + case 0x6f: + case 0x70: + case 0x71: + case 0x72: + case 0x73: + case 0x74: + case 0x75: + case 0x76: + case 0x77: + case 0x78: + case 0x79: + case 0x7a: + case 0x7b: + case 0x7c: + case 0x7d: + case 0x7e: + case 0x7f: + return static_cast(current); + + // fixmap + case 0x80: + case 0x81: + case 0x82: + case 0x83: + case 0x84: + case 0x85: + case 0x86: + case 0x87: + case 0x88: + case 0x89: + case 0x8a: + case 0x8b: + case 0x8c: + case 0x8d: + case 0x8e: + case 0x8f: + { + return get_msgpack_object(current & 0x0f); + } + + // fixarray + case 0x90: + case 0x91: + case 0x92: + case 0x93: + case 0x94: + case 0x95: + case 0x96: + case 0x97: + case 0x98: + case 0x99: + case 0x9a: + case 0x9b: + case 0x9c: + case 0x9d: + case 0x9e: + case 0x9f: + { + return get_msgpack_array(current & 0x0f); + } + + // fixstr + case 0xa0: + case 0xa1: + case 0xa2: + case 0xa3: + case 0xa4: + case 0xa5: + case 0xa6: + case 0xa7: + case 0xa8: + case 0xa9: + case 0xaa: + case 0xab: + case 0xac: + case 0xad: + case 0xae: + case 0xaf: + case 0xb0: + case 0xb1: + case 0xb2: + case 0xb3: + case 0xb4: + case 0xb5: + case 0xb6: + case 0xb7: + case 0xb8: + case 0xb9: + case 0xba: + case 0xbb: + case 0xbc: + case 0xbd: + case 0xbe: + case 0xbf: + return get_msgpack_string(); + + case 0xc0: // nil + return value_t::null; + + case 0xc2: // false + return false; + + case 0xc3: // true + return true; + + case 0xca: // float 32 + return get_number(); + + case 0xcb: // float 64 + return get_number(); + + case 0xcc: // uint 8 + return get_number(); + + case 0xcd: // uint 16 + return get_number(); + + case 0xce: // uint 32 + return get_number(); + + case 0xcf: // uint 64 + return get_number(); + + case 0xd0: // int 8 + return get_number(); + + case 0xd1: // int 16 + return get_number(); + + case 0xd2: // int 32 + return get_number(); + + case 0xd3: // int 64 + return get_number(); + + case 0xd9: // str 8 + case 0xda: // str 16 + case 0xdb: // str 32 + return get_msgpack_string(); + + case 0xdc: // array 16 + { + return get_msgpack_array(get_number()); + } + + case 0xdd: // array 32 + { + return get_msgpack_array(get_number()); + } + + case 0xde: // map 16 + { + return get_msgpack_object(get_number()); + } + + case 0xdf: // map 32 + { + return get_msgpack_object(get_number()); + } + + // positive fixint + case 0xe0: + case 0xe1: + case 0xe2: + case 0xe3: + case 0xe4: + case 0xe5: + case 0xe6: + case 0xe7: + case 0xe8: + case 0xe9: + case 0xea: + case 0xeb: + case 0xec: + case 0xed: + case 0xee: + case 0xef: + case 0xf0: + case 0xf1: + case 0xf2: + case 0xf3: + case 0xf4: + case 0xf5: + case 0xf6: + case 0xf7: + case 0xf8: + case 0xf9: + case 0xfa: + case 0xfb: + case 0xfc: + case 0xfd: + case 0xfe: + case 0xff: + return static_cast(current); + + default: // anything else + { + std::stringstream ss; + ss << std::setw(2) << std::setfill('0') << std::hex << current; + JSON_THROW(parse_error::create(112, chars_read, + "error reading MessagePack; last byte: 0x" + ss.str())); + } + } + } + + /*! + @brief get next character from the input + + This function provides the interface to the used input adapter. It does + not throw in case the input reached EOF, but returns a -'ve valued + `std::char_traits::eof()` in that case. + + @return character read from the input + */ + int get() + { + ++chars_read; + return (current = ia->get_character()); + } + + /* + @brief read a number from the input + + @tparam NumberType the type of the number + + @return number of type @a NumberType + + @note This function needs to respect the system's endianess, because + bytes in CBOR and MessagePack are stored in network order (big + endian) and therefore need reordering on little endian systems. + + @throw parse_error.110 if input has less than `sizeof(NumberType)` bytes + */ + template NumberType get_number() + { + // step 1: read input into array with system's byte order + std::array vec; + for (std::size_t i = 0; i < sizeof(NumberType); ++i) + { + get(); + check_eof(); + + // reverse byte order prior to conversion if necessary + if (is_little_endian) + { + vec[sizeof(NumberType) - i - 1] = static_cast(current); + } + else + { + vec[i] = static_cast(current); // LCOV_EXCL_LINE + } + } + + // step 2: convert array into number of type T and return + NumberType result; + std::memcpy(&result, vec.data(), sizeof(NumberType)); + return result; + } + + /*! + @brief create a string by reading characters from the input + + @param[in] len number of bytes to read + + @note We can not reserve @a len bytes for the result, because @a len + may be too large. Usually, @ref check_eof() detects the end of + the input before we run out of string memory. + + @return string created by reading @a len bytes + + @throw parse_error.110 if input has less than @a len bytes + */ + template + std::string get_string(const NumberType len) + { + std::string result; + std::generate_n(std::back_inserter(result), len, [this]() + { + get(); + check_eof(); + return static_cast(current); + }); + return result; + } + + /*! + @brief reads a CBOR string + + This function first reads starting bytes to determine the expected + string length and then copies this number of bytes into a string. + Additionally, CBOR's strings with indefinite lengths are supported. + + @return string + + @throw parse_error.110 if input ended + @throw parse_error.113 if an unexpected byte is read + */ + std::string get_cbor_string() + { + check_eof(); + + switch (current) + { + // UTF-8 string (0x00..0x17 bytes follow) + case 0x60: + case 0x61: + case 0x62: + case 0x63: + case 0x64: + case 0x65: + case 0x66: + case 0x67: + case 0x68: + case 0x69: + case 0x6a: + case 0x6b: + case 0x6c: + case 0x6d: + case 0x6e: + case 0x6f: + case 0x70: + case 0x71: + case 0x72: + case 0x73: + case 0x74: + case 0x75: + case 0x76: + case 0x77: + { + return get_string(current & 0x1f); + } + + case 0x78: // UTF-8 string (one-byte uint8_t for n follows) + { + return get_string(get_number()); + } + + case 0x79: // UTF-8 string (two-byte uint16_t for n follow) + { + return get_string(get_number()); + } + + case 0x7a: // UTF-8 string (four-byte uint32_t for n follow) + { + return get_string(get_number()); + } + + case 0x7b: // UTF-8 string (eight-byte uint64_t for n follow) + { + return get_string(get_number()); + } + + case 0x7f: // UTF-8 string (indefinite length) + { + std::string result; + while (get() != 0xff) + { + check_eof(); + result.push_back(static_cast(current)); + } + return result; + } + + default: + { + std::stringstream ss; + ss << std::setw(2) << std::setfill('0') << std::hex << current; + JSON_THROW(parse_error::create(113, chars_read, "expected a CBOR string; last byte: 0x" + ss.str())); + } + } + } + + template + BasicJsonType get_cbor_array(const NumberType len) + { + BasicJsonType result = value_t::array; + std::generate_n(std::back_inserter(*result.m_value.array), len, [this]() + { + return parse_cbor_internal(); + }); + return result; + } + + template + BasicJsonType get_cbor_object(const NumberType len) + { + BasicJsonType result = value_t::object; + std::generate_n(std::inserter(*result.m_value.object, + result.m_value.object->end()), + len, [this]() + { + get(); + auto key = get_cbor_string(); + auto val = parse_cbor_internal(); + return std::make_pair(std::move(key), std::move(val)); + }); + return result; + } + + /*! + @brief reads a MessagePack string + + This function first reads starting bytes to determine the expected + string length and then copies this number of bytes into a string. + + @return string + + @throw parse_error.110 if input ended + @throw parse_error.113 if an unexpected byte is read + */ + std::string get_msgpack_string() + { + check_eof(); + + switch (current) + { + // fixstr + case 0xa0: + case 0xa1: + case 0xa2: + case 0xa3: + case 0xa4: + case 0xa5: + case 0xa6: + case 0xa7: + case 0xa8: + case 0xa9: + case 0xaa: + case 0xab: + case 0xac: + case 0xad: + case 0xae: + case 0xaf: + case 0xb0: + case 0xb1: + case 0xb2: + case 0xb3: + case 0xb4: + case 0xb5: + case 0xb6: + case 0xb7: + case 0xb8: + case 0xb9: + case 0xba: + case 0xbb: + case 0xbc: + case 0xbd: + case 0xbe: + case 0xbf: + { + return get_string(current & 0x1f); + } + + case 0xd9: // str 8 + { + return get_string(get_number()); + } + + case 0xda: // str 16 + { + return get_string(get_number()); + } + + case 0xdb: // str 32 + { + return get_string(get_number()); + } + + default: + { + std::stringstream ss; + ss << std::setw(2) << std::setfill('0') << std::hex << current; + JSON_THROW(parse_error::create(113, chars_read, + "expected a MessagePack string; last byte: 0x" + ss.str())); + } + } + } + + template + BasicJsonType get_msgpack_array(const NumberType len) + { + BasicJsonType result = value_t::array; + std::generate_n(std::back_inserter(*result.m_value.array), len, [this]() + { + return parse_msgpack_internal(); + }); + return result; + } + + template + BasicJsonType get_msgpack_object(const NumberType len) + { + BasicJsonType result = value_t::object; + std::generate_n(std::inserter(*result.m_value.object, + result.m_value.object->end()), + len, [this]() + { + get(); + auto key = get_msgpack_string(); + auto val = parse_msgpack_internal(); + return std::make_pair(std::move(key), std::move(val)); + }); + return result; + } + + /*! + @brief check if input ended + @throw parse_error.110 if input ended + */ + void check_eof(const bool expect_eof = false) const + { + if (expect_eof) + { + if (JSON_UNLIKELY(current != std::char_traits::eof())) + { + JSON_THROW(parse_error::create(110, chars_read, "expected end of input")); + } + } + else + { + if (JSON_UNLIKELY(current == std::char_traits::eof())) + { + JSON_THROW(parse_error::create(110, chars_read, "unexpected end of input")); + } + } + } + + private: + /// input adapter + input_adapter_t ia = nullptr; + + /// the current character + int current = std::char_traits::eof(); + + /// the number of characters read + std::size_t chars_read = 0; + + /// whether we can assume little endianess + const bool is_little_endian = little_endianess(); +}; + +/*! +@brief serialization to CBOR and MessagePack values +*/ +template +class binary_writer +{ + public: + /*! + @brief create a binary writer + + @param[in] adapter output adapter to write to + */ + explicit binary_writer(output_adapter_t adapter) : oa(adapter) + { + assert(oa); + } + + /*! + @brief[in] j JSON value to serialize + */ + void write_cbor(const BasicJsonType& j) + { + switch (j.type()) + { + case value_t::null: + { + oa->write_character(static_cast(0xf6)); + break; + } + + case value_t::boolean: + { + oa->write_character(j.m_value.boolean + ? static_cast(0xf5) + : static_cast(0xf4)); + break; + } + + case value_t::number_integer: + { + if (j.m_value.number_integer >= 0) + { + // CBOR does not differentiate between positive signed + // integers and unsigned integers. Therefore, we used the + // code from the value_t::number_unsigned case here. + if (j.m_value.number_integer <= 0x17) + { + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_integer <= (std::numeric_limits::max)()) + { + oa->write_character(static_cast(0x18)); + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_integer <= (std::numeric_limits::max)()) + { + oa->write_character(static_cast(0x19)); + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_integer <= (std::numeric_limits::max)()) + { + oa->write_character(static_cast(0x1a)); + write_number(static_cast(j.m_value.number_integer)); + } + else + { + oa->write_character(static_cast(0x1b)); + write_number(static_cast(j.m_value.number_integer)); + } + } + else + { + // The conversions below encode the sign in the first + // byte, and the value is converted to a positive number. + const auto positive_number = -1 - j.m_value.number_integer; + if (j.m_value.number_integer >= -24) + { + write_number(static_cast(0x20 + positive_number)); + } + else if (positive_number <= (std::numeric_limits::max)()) + { + oa->write_character(static_cast(0x38)); + write_number(static_cast(positive_number)); + } + else if (positive_number <= (std::numeric_limits::max)()) + { + oa->write_character(static_cast(0x39)); + write_number(static_cast(positive_number)); + } + else if (positive_number <= (std::numeric_limits::max)()) + { + oa->write_character(static_cast(0x3a)); + write_number(static_cast(positive_number)); + } + else + { + oa->write_character(static_cast(0x3b)); + write_number(static_cast(positive_number)); + } + } + break; + } + + case value_t::number_unsigned: + { + if (j.m_value.number_unsigned <= 0x17) + { + write_number(static_cast(j.m_value.number_unsigned)); + } + else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + { + oa->write_character(static_cast(0x18)); + write_number(static_cast(j.m_value.number_unsigned)); + } + else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + { + oa->write_character(static_cast(0x19)); + write_number(static_cast(j.m_value.number_unsigned)); + } + else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + { + oa->write_character(static_cast(0x1a)); + write_number(static_cast(j.m_value.number_unsigned)); + } + else + { + oa->write_character(static_cast(0x1b)); + write_number(static_cast(j.m_value.number_unsigned)); + } + break; + } + + case value_t::number_float: // Double-Precision Float + { + oa->write_character(static_cast(0xfb)); + write_number(j.m_value.number_float); + break; + } + + case value_t::string: + { + // step 1: write control byte and the string length + const auto N = j.m_value.string->size(); + if (N <= 0x17) + { + write_number(static_cast(0x60 + N)); + } + else if (N <= 0xff) + { + oa->write_character(static_cast(0x78)); + write_number(static_cast(N)); + } + else if (N <= 0xffff) + { + oa->write_character(static_cast(0x79)); + write_number(static_cast(N)); + } + else if (N <= 0xffffffff) + { + oa->write_character(static_cast(0x7a)); + write_number(static_cast(N)); + } + // LCOV_EXCL_START + else if (N <= 0xffffffffffffffff) + { + oa->write_character(static_cast(0x7b)); + write_number(static_cast(N)); + } + // LCOV_EXCL_STOP + + // step 2: write the string + oa->write_characters( + reinterpret_cast(j.m_value.string->c_str()), + j.m_value.string->size()); + break; + } + + case value_t::array: + { + // step 1: write control byte and the array size + const auto N = j.m_value.array->size(); + if (N <= 0x17) + { + write_number(static_cast(0x80 + N)); + } + else if (N <= 0xff) + { + oa->write_character(static_cast(0x98)); + write_number(static_cast(N)); + } + else if (N <= 0xffff) + { + oa->write_character(static_cast(0x99)); + write_number(static_cast(N)); + } + else if (N <= 0xffffffff) + { + oa->write_character(static_cast(0x9a)); + write_number(static_cast(N)); + } + // LCOV_EXCL_START + else if (N <= 0xffffffffffffffff) + { + oa->write_character(static_cast(0x9b)); + write_number(static_cast(N)); + } + // LCOV_EXCL_STOP + + // step 2: write each element + for (const auto& el : *j.m_value.array) + { + write_cbor(el); + } + break; + } + + case value_t::object: + { + // step 1: write control byte and the object size + const auto N = j.m_value.object->size(); + if (N <= 0x17) + { + write_number(static_cast(0xa0 + N)); + } + else if (N <= 0xff) + { + oa->write_character(static_cast(0xb8)); + write_number(static_cast(N)); + } + else if (N <= 0xffff) + { + oa->write_character(static_cast(0xb9)); + write_number(static_cast(N)); + } + else if (N <= 0xffffffff) + { + oa->write_character(static_cast(0xba)); + write_number(static_cast(N)); + } + // LCOV_EXCL_START + else if (N <= 0xffffffffffffffff) + { + oa->write_character(static_cast(0xbb)); + write_number(static_cast(N)); + } + // LCOV_EXCL_STOP + + // step 2: write each element + for (const auto& el : *j.m_value.object) + { + write_cbor(el.first); + write_cbor(el.second); + } + break; + } + + default: + break; + } + } + + /*! + @brief[in] j JSON value to serialize + */ + void write_msgpack(const BasicJsonType& j) + { + switch (j.type()) + { + case value_t::null: // nil + { + oa->write_character(static_cast(0xc0)); + break; + } + + case value_t::boolean: // true and false + { + oa->write_character(j.m_value.boolean + ? static_cast(0xc3) + : static_cast(0xc2)); + break; + } + + case value_t::number_integer: + { + if (j.m_value.number_integer >= 0) + { + // MessagePack does not differentiate between positive + // signed integers and unsigned integers. Therefore, we used + // the code from the value_t::number_unsigned case here. + if (j.m_value.number_unsigned < 128) + { + // positive fixnum + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + { + // uint 8 + oa->write_character(static_cast(0xcc)); + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + { + // uint 16 + oa->write_character(static_cast(0xcd)); + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + { + // uint 32 + oa->write_character(static_cast(0xce)); + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + { + // uint 64 + oa->write_character(static_cast(0xcf)); + write_number(static_cast(j.m_value.number_integer)); + } + } + else + { + if (j.m_value.number_integer >= -32) + { + // negative fixnum + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_integer >= (std::numeric_limits::min)() and + j.m_value.number_integer <= (std::numeric_limits::max)()) + { + // int 8 + oa->write_character(static_cast(0xd0)); + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_integer >= (std::numeric_limits::min)() and + j.m_value.number_integer <= (std::numeric_limits::max)()) + { + // int 16 + oa->write_character(static_cast(0xd1)); + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_integer >= (std::numeric_limits::min)() and + j.m_value.number_integer <= (std::numeric_limits::max)()) + { + // int 32 + oa->write_character(static_cast(0xd2)); + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_integer >= (std::numeric_limits::min)() and + j.m_value.number_integer <= (std::numeric_limits::max)()) + { + // int 64 + oa->write_character(static_cast(0xd3)); + write_number(static_cast(j.m_value.number_integer)); + } + } + break; + } + + case value_t::number_unsigned: + { + if (j.m_value.number_unsigned < 128) + { + // positive fixnum + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + { + // uint 8 + oa->write_character(static_cast(0xcc)); + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + { + // uint 16 + oa->write_character(static_cast(0xcd)); + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + { + // uint 32 + oa->write_character(static_cast(0xce)); + write_number(static_cast(j.m_value.number_integer)); + } + else if (j.m_value.number_unsigned <= (std::numeric_limits::max)()) + { + // uint 64 + oa->write_character(static_cast(0xcf)); + write_number(static_cast(j.m_value.number_integer)); + } + break; + } + + case value_t::number_float: // float 64 + { + oa->write_character(static_cast(0xcb)); + write_number(j.m_value.number_float); + break; + } + + case value_t::string: + { + // step 1: write control byte and the string length + const auto N = j.m_value.string->size(); + if (N <= 31) + { + // fixstr + write_number(static_cast(0xa0 | N)); + } + else if (N <= 255) + { + // str 8 + oa->write_character(static_cast(0xd9)); + write_number(static_cast(N)); + } + else if (N <= 65535) + { + // str 16 + oa->write_character(static_cast(0xda)); + write_number(static_cast(N)); + } + else if (N <= 4294967295) + { + // str 32 + oa->write_character(static_cast(0xdb)); + write_number(static_cast(N)); + } + + // step 2: write the string + oa->write_characters( + reinterpret_cast(j.m_value.string->c_str()), + j.m_value.string->size()); + break; + } + + case value_t::array: + { + // step 1: write control byte and the array size + const auto N = j.m_value.array->size(); + if (N <= 15) + { + // fixarray + write_number(static_cast(0x90 | N)); + } + else if (N <= 0xffff) + { + // array 16 + oa->write_character(static_cast(0xdc)); + write_number(static_cast(N)); + } + else if (N <= 0xffffffff) + { + // array 32 + oa->write_character(static_cast(0xdd)); + write_number(static_cast(N)); + } + + // step 2: write each element + for (const auto& el : *j.m_value.array) + { + write_msgpack(el); + } + break; + } + + case value_t::object: + { + // step 1: write control byte and the object size + const auto N = j.m_value.object->size(); + if (N <= 15) + { + // fixmap + write_number(static_cast(0x80 | (N & 0xf))); + } + else if (N <= 65535) + { + // map 16 + oa->write_character(static_cast(0xde)); + write_number(static_cast(N)); + } + else if (N <= 4294967295) + { + // map 32 + oa->write_character(static_cast(0xdf)); + write_number(static_cast(N)); + } + + // step 2: write each element + for (const auto& el : *j.m_value.object) + { + write_msgpack(el.first); + write_msgpack(el.second); + } + break; + } + + default: + break; + } + } + + private: + /* + @brief write a number to output input + + @param[in] n number of type @a NumberType + @tparam NumberType the type of the number + + @note This function needs to respect the system's endianess, because bytes + in CBOR and MessagePack are stored in network order (big endian) and + therefore need reordering on little endian systems. + */ + template void write_number(NumberType n) + { + // step 1: write number to array of length NumberType + std::array vec; + std::memcpy(vec.data(), &n, sizeof(NumberType)); + + // step 2: write array to output (with possible reordering) + if (is_little_endian) + { + // reverse byte order prior to conversion if necessary + std::reverse(vec.begin(), vec.end()); + } + + oa->write_characters(vec.data(), sizeof(NumberType)); + } + + private: + /// whether we can assume little endianess + const bool is_little_endian = binary_reader::little_endianess(); + + /// the output + output_adapter_t oa = nullptr; +}; + +/////////////////// +// serialization // +/////////////////// + +template +class serializer +{ + using string_t = typename BasicJsonType::string_t; + using number_float_t = typename BasicJsonType::number_float_t; + using number_integer_t = typename BasicJsonType::number_integer_t; + using number_unsigned_t = typename BasicJsonType::number_unsigned_t; + public: + /*! + @param[in] s output stream to serialize to + @param[in] ichar indentation character to use + */ + serializer(output_adapter_t s, const char ichar) + : o(std::move(s)), loc(std::localeconv()), + thousands_sep(loc->thousands_sep == nullptr ? '\0' : * (loc->thousands_sep)), + decimal_point(loc->decimal_point == nullptr ? '\0' : * (loc->decimal_point)), + indent_char(ichar), indent_string(512, indent_char) {} + + // delete because of pointer members + serializer(const serializer&) = delete; + serializer& operator=(const serializer&) = delete; + + /*! + @brief internal implementation of the serialization function + + This function is called by the public member function dump and organizes + the serialization internally. The indentation level is propagated as + additional parameter. In case of arrays and objects, the function is + called recursively. + + - strings and object keys are escaped using `escape_string()` + - integer numbers are converted implicitly via `operator<<` + - floating-point numbers are converted to a string using `"%g"` format + + @param[in] val value to serialize + @param[in] pretty_print whether the output shall be pretty-printed + @param[in] indent_step the indent level + @param[in] current_indent the current indent level (only used internally) + */ + void dump(const BasicJsonType& val, const bool pretty_print, + const bool ensure_ascii, + const unsigned int indent_step, + const unsigned int current_indent = 0) + { + switch (val.m_type) + { + case value_t::object: + { + if (val.m_value.object->empty()) + { + o->write_characters("{}", 2); + return; + } + + if (pretty_print) + { + o->write_characters("{\n", 2); + + // variable to hold indentation for recursive calls + const auto new_indent = current_indent + indent_step; + if (JSON_UNLIKELY(indent_string.size() < new_indent)) + { + indent_string.resize(indent_string.size() * 2, ' '); + } + + // first n-1 elements + auto i = val.m_value.object->cbegin(); + for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i) + { + o->write_characters(indent_string.c_str(), new_indent); + o->write_character('\"'); + dump_escaped(i->first, ensure_ascii); + o->write_characters("\": ", 3); + dump(i->second, true, ensure_ascii, indent_step, new_indent); + o->write_characters(",\n", 2); + } + + // last element + assert(i != val.m_value.object->cend()); + assert(std::next(i) == val.m_value.object->cend()); + o->write_characters(indent_string.c_str(), new_indent); + o->write_character('\"'); + dump_escaped(i->first, ensure_ascii); + o->write_characters("\": ", 3); + dump(i->second, true, ensure_ascii, indent_step, new_indent); + + o->write_character('\n'); + o->write_characters(indent_string.c_str(), current_indent); + o->write_character('}'); + } + else + { + o->write_character('{'); + + // first n-1 elements + auto i = val.m_value.object->cbegin(); + for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i) + { + o->write_character('\"'); + dump_escaped(i->first, ensure_ascii); + o->write_characters("\":", 2); + dump(i->second, false, ensure_ascii, indent_step, current_indent); + o->write_character(','); + } + + // last element + assert(i != val.m_value.object->cend()); + assert(std::next(i) == val.m_value.object->cend()); + o->write_character('\"'); + dump_escaped(i->first, ensure_ascii); + o->write_characters("\":", 2); + dump(i->second, false, ensure_ascii, indent_step, current_indent); + + o->write_character('}'); + } + + return; + } + + case value_t::array: + { + if (val.m_value.array->empty()) + { + o->write_characters("[]", 2); + return; + } + + if (pretty_print) + { + o->write_characters("[\n", 2); + + // variable to hold indentation for recursive calls + const auto new_indent = current_indent + indent_step; + if (JSON_UNLIKELY(indent_string.size() < new_indent)) + { + indent_string.resize(indent_string.size() * 2, ' '); + } + + // first n-1 elements + for (auto i = val.m_value.array->cbegin(); + i != val.m_value.array->cend() - 1; ++i) + { + o->write_characters(indent_string.c_str(), new_indent); + dump(*i, true, ensure_ascii, indent_step, new_indent); + o->write_characters(",\n", 2); + } + + // last element + assert(not val.m_value.array->empty()); + o->write_characters(indent_string.c_str(), new_indent); + dump(val.m_value.array->back(), true, ensure_ascii, indent_step, new_indent); + + o->write_character('\n'); + o->write_characters(indent_string.c_str(), current_indent); + o->write_character(']'); + } + else + { + o->write_character('['); + + // first n-1 elements + for (auto i = val.m_value.array->cbegin(); + i != val.m_value.array->cend() - 1; ++i) + { + dump(*i, false, ensure_ascii, indent_step, current_indent); + o->write_character(','); + } + + // last element + assert(not val.m_value.array->empty()); + dump(val.m_value.array->back(), false, ensure_ascii, indent_step, current_indent); + + o->write_character(']'); + } + + return; + } + + case value_t::string: + { + o->write_character('\"'); + dump_escaped(*val.m_value.string, ensure_ascii); + o->write_character('\"'); + return; + } + + case value_t::boolean: + { + if (val.m_value.boolean) + { + o->write_characters("true", 4); + } + else + { + o->write_characters("false", 5); + } + return; + } + + case value_t::number_integer: + { + dump_integer(val.m_value.number_integer); + return; + } + + case value_t::number_unsigned: + { + dump_integer(val.m_value.number_unsigned); + return; + } + + case value_t::number_float: + { + dump_float(val.m_value.number_float); + return; + } + + case value_t::discarded: + { + o->write_characters("", 11); + return; + } + + case value_t::null: + { + o->write_characters("null", 4); + return; + } + } + } + + private: + /*! + @brief returns the number of expected bytes following in UTF-8 string + + @param[in] u the first byte of a UTF-8 string + @return the number of expected bytes following + */ + static constexpr std::size_t bytes_following(const uint8_t u) + { + return ((u <= 127) ? 0 + : ((192 <= u and u <= 223) ? 1 + : ((224 <= u and u <= 239) ? 2 + : ((240 <= u and u <= 247) ? 3 : std::string::npos)))); + } + + /*! + @brief calculates the extra space to escape a JSON string + + @param[in] s the string to escape + @param[in] ensure_ascii whether to escape non-ASCII characters with + \uXXXX sequences + @return the number of characters required to escape string @a s + + @complexity Linear in the length of string @a s. + */ + static std::size_t extra_space(const string_t& s, + const bool ensure_ascii) noexcept + { + std::size_t res = 0; + + for (std::size_t i = 0; i < s.size(); ++i) + { + switch (s[i]) + { + // control characters that can be escaped with a backslash + case '"': + case '\\': + case '\b': + case '\f': + case '\n': + case '\r': + case '\t': + { + // from c (1 byte) to \x (2 bytes) + res += 1; + break; + } + + // control characters that need \uxxxx escaping + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x04: + case 0x05: + case 0x06: + case 0x07: + case 0x0b: + case 0x0e: + case 0x0f: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + case 0x19: + case 0x1a: + case 0x1b: + case 0x1c: + case 0x1d: + case 0x1e: + case 0x1f: + { + // from c (1 byte) to \uxxxx (6 bytes) + res += 5; + break; + } + + default: + { + if (ensure_ascii and (s[i] & 0x80 or s[i] == 0x7F)) + { + const auto bytes = bytes_following(static_cast(s[i])); + if (bytes == std::string::npos) + { + // invalid characters are treated as is, so no + // additional space will be used + break; + } + + if (bytes == 3) + { + // codepoints that need 4 bytes (i.e., 3 additional + // bytes) in UTF-8 need a surrogate pair when \u + // escaping is used: from 4 bytes to \uxxxx\uxxxx + // (12 bytes) + res += (12 - bytes - 1); + } + else + { + // from x bytes to \uxxxx (6 bytes) + res += (6 - bytes - 1); + } + + // skip the additional bytes + i += bytes; + } + break; + } + } + } + + return res; + } + + static void escape_codepoint(int codepoint, string_t& result, std::size_t& pos) + { + // expecting a proper codepoint + assert(0x00 <= codepoint and codepoint <= 0x10FFFF); + + // the last written character was the backslash before the 'u' + assert(result[pos] == '\\'); + + // write the 'u' + result[++pos] = 'u'; + + // convert a number 0..15 to its hex representation (0..f) + static const std::array hexify = + { + { + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' + } + }; + + if (codepoint < 0x10000) + { + // codepoints U+0000..U+FFFF can be represented as \uxxxx. + result[++pos] = hexify[(codepoint >> 12) & 0x0F]; + result[++pos] = hexify[(codepoint >> 8) & 0x0F]; + result[++pos] = hexify[(codepoint >> 4) & 0x0F]; + result[++pos] = hexify[codepoint & 0x0F]; + } + else + { + // codepoints U+10000..U+10FFFF need a surrogate pair to be + // represented as \uxxxx\uxxxx. + // http://www.unicode.org/faq/utf_bom.html#utf16-4 + codepoint -= 0x10000; + const int high_surrogate = 0xD800 | ((codepoint >> 10) & 0x3FF); + const int low_surrogate = 0xDC00 | (codepoint & 0x3FF); + result[++pos] = hexify[(high_surrogate >> 12) & 0x0F]; + result[++pos] = hexify[(high_surrogate >> 8) & 0x0F]; + result[++pos] = hexify[(high_surrogate >> 4) & 0x0F]; + result[++pos] = hexify[high_surrogate & 0x0F]; + ++pos; // backslash is already in output + result[++pos] = 'u'; + result[++pos] = hexify[(low_surrogate >> 12) & 0x0F]; + result[++pos] = hexify[(low_surrogate >> 8) & 0x0F]; + result[++pos] = hexify[(low_surrogate >> 4) & 0x0F]; + result[++pos] = hexify[low_surrogate & 0x0F]; + } + + ++pos; + } + + /*! + @brief dump escaped string + + Escape a string by replacing certain special characters by a sequence of an + escape character (backslash) and another character and other control + characters by a sequence of "\u" followed by a four-digit hex + representation. The escaped string is written to output stream @a o. + + @param[in] s the string to escape + @param[in] ensure_ascii whether to escape non-ASCII characters with + \uXXXX sequences + + @complexity Linear in the length of string @a s. + */ + void dump_escaped(const string_t& s, const bool ensure_ascii) const + { + const auto space = extra_space(s, ensure_ascii); + if (space == 0) + { + o->write_characters(s.c_str(), s.size()); + return; + } + + // create a result string of necessary size + string_t result(s.size() + space, '\\'); + std::size_t pos = 0; + + for (std::size_t i = 0; i < s.size(); ++i) + { + switch (s[i]) + { + case '"': // quotation mark (0x22) + { + result[pos + 1] = '"'; + pos += 2; + break; + } + + case '\\': // reverse solidus (0x5c) + { + // nothing to change + pos += 2; + break; + } + + case '\b': // backspace (0x08) + { + result[pos + 1] = 'b'; + pos += 2; + break; + } + + case '\f': // formfeed (0x0c) + { + result[pos + 1] = 'f'; + pos += 2; + break; + } + + case '\n': // newline (0x0a) + { + result[pos + 1] = 'n'; + pos += 2; + break; + } + + case '\r': // carriage return (0x0d) + { + result[pos + 1] = 'r'; + pos += 2; + break; + } + + case '\t': // horizontal tab (0x09) + { + result[pos + 1] = 't'; + pos += 2; + break; + } + + default: + { + // escape control characters (0x00..0x1F) or, if + // ensure_ascii parameter is used, non-ASCII characters + if ((0x00 <= s[i] and s[i] <= 0x1F) or + (ensure_ascii and (s[i] & 0x80 or s[i] == 0x7F))) + { + const auto bytes = bytes_following(static_cast(s[i])); + if (bytes == std::string::npos) + { + // copy invalid character as is + result[pos++] = s[i]; + break; + } + + // check that the additional bytes are present + assert(i + bytes < s.size()); + + // to use \uxxxx escaping, we first need to caluclate + // the codepoint from the UTF-8 bytes + int codepoint = 0; + + assert(0 <= bytes and bytes <= 3); + switch (bytes) + { + case 0: + { + codepoint = s[i] & 0xFF; + break; + } + + case 1: + { + codepoint = ((s[i] & 0x3F) << 6) + + (s[i + 1] & 0x7F); + break; + } + + case 2: + { + codepoint = ((s[i] & 0x1F) << 12) + + ((s[i + 1] & 0x7F) << 6) + + (s[i + 2] & 0x7F); + break; + } + + case 3: + { + codepoint = ((s[i] & 0xF) << 18) + + ((s[i + 1] & 0x7F) << 12) + + ((s[i + 2] & 0x7F) << 6) + + (s[i + 3] & 0x7F); + break; + } + + default: + break; // LCOV_EXCL_LINE + } + + escape_codepoint(codepoint, result, pos); + i += bytes; + } + else + { + // all other characters are added as-is + result[pos++] = s[i]; + } + break; + } + } + } + + assert(pos == result.size()); + o->write_characters(result.c_str(), result.size()); + } + + /*! + @brief dump an integer + + Dump a given integer to output stream @a o. Works internally with + @a number_buffer. + + @param[in] x integer number (signed or unsigned) to dump + @tparam NumberType either @a number_integer_t or @a number_unsigned_t + */ + template < + typename NumberType, + detail::enable_if_t::value or + std::is_same::value, + int> = 0 > + void dump_integer(NumberType x) + { + // special case for "0" + if (x == 0) + { + o->write_character('0'); + return; + } + + const bool is_negative = (x <= 0) and (x != 0); // see issue #755 + std::size_t i = 0; + + while (x != 0) + { + // spare 1 byte for '\0' + assert(i < number_buffer.size() - 1); + + const auto digit = std::labs(static_cast(x % 10)); + number_buffer[i++] = static_cast('0' + digit); + x /= 10; + } + + if (is_negative) + { + // make sure there is capacity for the '-' + assert(i < number_buffer.size() - 2); + number_buffer[i++] = '-'; + } + + std::reverse(number_buffer.begin(), number_buffer.begin() + i); + o->write_characters(number_buffer.data(), i); + } + + /*! + @brief dump a floating-point number + + Dump a given floating-point number to output stream @a o. Works internally + with @a number_buffer. + + @param[in] x floating-point number to dump + */ + void dump_float(number_float_t x) + { + // NaN / inf + if (not std::isfinite(x) or std::isnan(x)) + { + o->write_characters("null", 4); + return; + } + + // get number of digits for a text -> float -> text round-trip + static constexpr auto d = std::numeric_limits::digits10; + + // the actual conversion + std::ptrdiff_t len = snprintf(number_buffer.data(), number_buffer.size(), "%.*g", d, x); + + // negative value indicates an error + assert(len > 0); + // check if buffer was large enough + assert(static_cast(len) < number_buffer.size()); + + // erase thousands separator + if (thousands_sep != '\0') + { + const auto end = std::remove(number_buffer.begin(), + number_buffer.begin() + len, thousands_sep); + std::fill(end, number_buffer.end(), '\0'); + assert((end - number_buffer.begin()) <= len); + len = (end - number_buffer.begin()); + } + + // convert decimal point to '.' + if (decimal_point != '\0' and decimal_point != '.') + { + const auto dec_pos = std::find(number_buffer.begin(), number_buffer.end(), decimal_point); + if (dec_pos != number_buffer.end()) + { + *dec_pos = '.'; + } + } + + o->write_characters(number_buffer.data(), static_cast(len)); + + // determine if need to append ".0" + const bool value_is_int_like = + std::none_of(number_buffer.begin(), number_buffer.begin() + len + 1, + [](char c) + { + return (c == '.' or c == 'e'); + }); + + if (value_is_int_like) + { + o->write_characters(".0", 2); + } + } + + private: + /// the output of the serializer + output_adapter_t o = nullptr; + + /// a (hopefully) large enough character buffer + std::array number_buffer{{}}; + + /// the locale + const std::lconv* loc = nullptr; + /// the locale's thousand separator character + const char thousands_sep = '\0'; + /// the locale's decimal point character + const char decimal_point = '\0'; + + /// the indentation character + const char indent_char; + + /// the indentation string + string_t indent_string; +}; + +template +class json_ref +{ + public: + using value_type = BasicJsonType; + + json_ref(value_type&& value) + : owned_value(std::move(value)), + value_ref(&owned_value), + is_rvalue(true) + {} + + json_ref(const value_type& value) + : value_ref(const_cast(&value)), + is_rvalue(false) + {} + + json_ref(std::initializer_list init) + : owned_value(init), + value_ref(&owned_value), + is_rvalue(true) + {} + + template + json_ref(Args&& ... args) + : owned_value(std::forward(args)...), + value_ref(&owned_value), + is_rvalue(true) + {} + + // class should be movable only + json_ref(json_ref&&) = default; + json_ref(const json_ref&) = delete; + json_ref& operator=(const json_ref&) = delete; + + value_type moved_or_copied() const + { + if (is_rvalue) + { + return std::move(*value_ref); + } + return *value_ref; + } + + value_type const& operator*() const + { + return *static_cast(value_ref); + } + + value_type const* operator->() const + { + return static_cast(value_ref); + } + + private: + mutable value_type owned_value = nullptr; + value_type* value_ref = nullptr; + const bool is_rvalue; +}; + +} // namespace detail + +/// namespace to hold default `to_json` / `from_json` functions +namespace +{ +constexpr const auto& to_json = detail::static_const::value; +constexpr const auto& from_json = detail::static_const::value; +} + + +/*! +@brief default JSONSerializer template argument + +This serializer ignores the template arguments and uses ADL +([argument-dependent lookup](http://en.cppreference.com/w/cpp/language/adl)) +for serialization. +*/ +template +struct adl_serializer +{ + /*! + @brief convert a JSON value to any value type + + This function is usually called by the `get()` function of the + @ref basic_json class (either explicit or via conversion operators). + + @param[in] j JSON value to read from + @param[in,out] val value to write to + */ + template + static void from_json(BasicJsonType&& j, ValueType& val) noexcept( + noexcept(::nlohmann::from_json(std::forward(j), val))) + { + ::nlohmann::from_json(std::forward(j), val); + } + + /*! + @brief convert any value type to a JSON value + + This function is usually called by the constructors of the @ref basic_json + class. + + @param[in,out] j JSON value to write to + @param[in] val value to read from + */ + template + static void to_json(BasicJsonType& j, ValueType&& val) noexcept( + noexcept(::nlohmann::to_json(j, std::forward(val)))) + { + ::nlohmann::to_json(j, std::forward(val)); + } +}; + +/*! +@brief JSON Pointer + +A JSON pointer defines a string syntax for identifying a specific value +within a JSON document. It can be used with functions `at` and +`operator[]`. Furthermore, JSON pointers are the base for JSON patches. + +@sa [RFC 6901](https://tools.ietf.org/html/rfc6901) + +@since version 2.0.0 +*/ +class json_pointer +{ + /// allow basic_json to access private members + NLOHMANN_BASIC_JSON_TPL_DECLARATION + friend class basic_json; + + public: + /*! + @brief create JSON pointer + + Create a JSON pointer according to the syntax described in + [Section 3 of RFC6901](https://tools.ietf.org/html/rfc6901#section-3). + + @param[in] s string representing the JSON pointer; if omitted, the empty + string is assumed which references the whole JSON value + + @throw parse_error.107 if the given JSON pointer @a s is nonempty and + does not begin with a slash (`/`); see example below + + @throw parse_error.108 if a tilde (`~`) in the given JSON pointer @a s + is not followed by `0` (representing `~`) or `1` (representing `/`); + see example below + + @liveexample{The example shows the construction several valid JSON + pointers as well as the exceptional behavior.,json_pointer} + + @since version 2.0.0 + */ + explicit json_pointer(const std::string& s = "") : reference_tokens(split(s)) {} + + /*! + @brief return a string representation of the JSON pointer + + @invariant For each JSON pointer `ptr`, it holds: + @code {.cpp} + ptr == json_pointer(ptr.to_string()); + @endcode + + @return a string representation of the JSON pointer + + @liveexample{The example shows the result of `to_string`., + json_pointer__to_string} + + @since version 2.0.0 + */ + std::string to_string() const noexcept + { + return std::accumulate(reference_tokens.begin(), reference_tokens.end(), + std::string{}, + [](const std::string & a, const std::string & b) + { + return a + "/" + escape(b); + }); + } + + /// @copydoc to_string() + operator std::string() const + { + return to_string(); + } + + private: + /*! + @brief remove and return last reference pointer + @throw out_of_range.405 if JSON pointer has no parent + */ + std::string pop_back() + { + if (JSON_UNLIKELY(is_root())) + { + JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent")); + } + + auto last = reference_tokens.back(); + reference_tokens.pop_back(); + return last; + } + + /// return whether pointer points to the root document + bool is_root() const + { + return reference_tokens.empty(); + } + + json_pointer top() const + { + if (JSON_UNLIKELY(is_root())) + { + JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent")); + } + + json_pointer result = *this; + result.reference_tokens = {reference_tokens[0]}; + return result; + } + + + /*! + @brief create and return a reference to the pointed to value + + @complexity Linear in the number of reference tokens. + + @throw parse_error.109 if array index is not a number + @throw type_error.313 if value cannot be unflattened + */ + NLOHMANN_BASIC_JSON_TPL_DECLARATION + NLOHMANN_BASIC_JSON_TPL& get_and_create(NLOHMANN_BASIC_JSON_TPL& j) const; + + /*! + @brief return a reference to the pointed to value + + @note This version does not throw if a value is not present, but tries to + create nested values instead. For instance, calling this function + with pointer `"/this/that"` on a null value is equivalent to calling + `operator[]("this").operator[]("that")` on that value, effectively + changing the null value to an object. + + @param[in] ptr a JSON value + + @return reference to the JSON value pointed to by the JSON pointer + + @complexity Linear in the length of the JSON pointer. + + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index was not a number + @throw out_of_range.404 if the JSON pointer can not be resolved + */ + NLOHMANN_BASIC_JSON_TPL_DECLARATION + NLOHMANN_BASIC_JSON_TPL& get_unchecked(NLOHMANN_BASIC_JSON_TPL* ptr) const; + + /*! + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index was not a number + @throw out_of_range.402 if the array index '-' is used + @throw out_of_range.404 if the JSON pointer can not be resolved + */ + NLOHMANN_BASIC_JSON_TPL_DECLARATION + NLOHMANN_BASIC_JSON_TPL& get_checked(NLOHMANN_BASIC_JSON_TPL* ptr) const; + + /*! + @brief return a const reference to the pointed to value + + @param[in] ptr a JSON value + + @return const reference to the JSON value pointed to by the JSON + pointer + + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index was not a number + @throw out_of_range.402 if the array index '-' is used + @throw out_of_range.404 if the JSON pointer can not be resolved + */ + NLOHMANN_BASIC_JSON_TPL_DECLARATION + const NLOHMANN_BASIC_JSON_TPL& get_unchecked(const NLOHMANN_BASIC_JSON_TPL* ptr) const; + + /*! + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index was not a number + @throw out_of_range.402 if the array index '-' is used + @throw out_of_range.404 if the JSON pointer can not be resolved + */ + NLOHMANN_BASIC_JSON_TPL_DECLARATION + const NLOHMANN_BASIC_JSON_TPL& get_checked(const NLOHMANN_BASIC_JSON_TPL* ptr) const; + + /*! + @brief split the string input to reference tokens + + @note This function is only called by the json_pointer constructor. + All exceptions below are documented there. + + @throw parse_error.107 if the pointer is not empty or begins with '/' + @throw parse_error.108 if character '~' is not followed by '0' or '1' + */ + static std::vector split(const std::string& reference_string) + { + std::vector result; + + // special case: empty reference string -> no reference tokens + if (reference_string.empty()) + { + return result; + } + + // check if nonempty reference string begins with slash + if (JSON_UNLIKELY(reference_string[0] != '/')) + { + JSON_THROW(detail::parse_error::create(107, 1, + "JSON pointer must be empty or begin with '/' - was: '" + + reference_string + "'")); + } + + // extract the reference tokens: + // - slash: position of the last read slash (or end of string) + // - start: position after the previous slash + for ( + // search for the first slash after the first character + std::size_t slash = reference_string.find_first_of('/', 1), + // set the beginning of the first reference token + start = 1; + // we can stop if start == string::npos+1 = 0 + start != 0; + // set the beginning of the next reference token + // (will eventually be 0 if slash == std::string::npos) + start = slash + 1, + // find next slash + slash = reference_string.find_first_of('/', start)) + { + // use the text between the beginning of the reference token + // (start) and the last slash (slash). + auto reference_token = reference_string.substr(start, slash - start); + + // check reference tokens are properly escaped + for (std::size_t pos = reference_token.find_first_of('~'); + pos != std::string::npos; + pos = reference_token.find_first_of('~', pos + 1)) + { + assert(reference_token[pos] == '~'); + + // ~ must be followed by 0 or 1 + if (JSON_UNLIKELY(pos == reference_token.size() - 1 or + (reference_token[pos + 1] != '0' and + reference_token[pos + 1] != '1'))) + { + JSON_THROW(detail::parse_error::create(108, 0, "escape character '~' must be followed with '0' or '1'")); + } + } + + // finally, store the reference token + unescape(reference_token); + result.push_back(reference_token); + } + + return result; + } + + /*! + @brief replace all occurrences of a substring by another string + + @param[in,out] s the string to manipulate; changed so that all + occurrences of @a f are replaced with @a t + @param[in] f the substring to replace with @a t + @param[in] t the string to replace @a f + + @pre The search string @a f must not be empty. **This precondition is + enforced with an assertion.** + + @since version 2.0.0 + */ + static void replace_substring(std::string& s, const std::string& f, + const std::string& t) + { + assert(not f.empty()); + for (auto pos = s.find(f); // find first occurrence of f + pos != std::string::npos; // make sure f was found + s.replace(pos, f.size(), t), // replace with t, and + pos = s.find(f, pos + t.size())) // find next occurrence of f + {} + } + + /// escape "~"" to "~0" and "/" to "~1" + static std::string escape(std::string s) + { + replace_substring(s, "~", "~0"); + replace_substring(s, "/", "~1"); + return s; + } + + /// unescape "~1" to tilde and "~0" to slash (order is important!) + static void unescape(std::string& s) + { + replace_substring(s, "~1", "/"); + replace_substring(s, "~0", "~"); + } + + /*! + @param[in] reference_string the reference string to the current value + @param[in] value the value to consider + @param[in,out] result the result object to insert values to + + @note Empty objects or arrays are flattened to `null`. + */ + NLOHMANN_BASIC_JSON_TPL_DECLARATION + static void flatten(const std::string& reference_string, + const NLOHMANN_BASIC_JSON_TPL& value, + NLOHMANN_BASIC_JSON_TPL& result); + + /*! + @param[in] value flattened JSON + + @return unflattened JSON + + @throw parse_error.109 if array index is not a number + @throw type_error.314 if value is not an object + @throw type_error.315 if object values are not primitive + @throw type_error.313 if value cannot be unflattened + */ + NLOHMANN_BASIC_JSON_TPL_DECLARATION + static NLOHMANN_BASIC_JSON_TPL + unflatten(const NLOHMANN_BASIC_JSON_TPL& value); + + friend bool operator==(json_pointer const& lhs, + json_pointer const& rhs) noexcept; + + friend bool operator!=(json_pointer const& lhs, + json_pointer const& rhs) noexcept; + + /// the reference tokens + std::vector reference_tokens; +}; + +/*! +@brief a class to store JSON values + +@tparam ObjectType type for JSON objects (`std::map` by default; will be used +in @ref object_t) +@tparam ArrayType type for JSON arrays (`std::vector` by default; will be used +in @ref array_t) +@tparam StringType type for JSON strings and object keys (`std::string` by +default; will be used in @ref string_t) +@tparam BooleanType type for JSON booleans (`bool` by default; will be used +in @ref boolean_t) +@tparam NumberIntegerType type for JSON integer numbers (`int64_t` by +default; will be used in @ref number_integer_t) +@tparam NumberUnsignedType type for JSON unsigned integer numbers (@c +`uint64_t` by default; will be used in @ref number_unsigned_t) +@tparam NumberFloatType type for JSON floating-point numbers (`double` by +default; will be used in @ref number_float_t) +@tparam AllocatorType type of the allocator to use (`std::allocator` by +default) +@tparam JSONSerializer the serializer to resolve internal calls to `to_json()` +and `from_json()` (@ref adl_serializer by default) + +@requirement The class satisfies the following concept requirements: +- Basic + - [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible): + JSON values can be default constructed. The result will be a JSON null + value. + - [MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible): + A JSON value can be constructed from an rvalue argument. + - [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible): + A JSON value can be copy-constructed from an lvalue expression. + - [MoveAssignable](http://en.cppreference.com/w/cpp/concept/MoveAssignable): + A JSON value van be assigned from an rvalue argument. + - [CopyAssignable](http://en.cppreference.com/w/cpp/concept/CopyAssignable): + A JSON value can be copy-assigned from an lvalue expression. + - [Destructible](http://en.cppreference.com/w/cpp/concept/Destructible): + JSON values can be destructed. +- Layout + - [StandardLayoutType](http://en.cppreference.com/w/cpp/concept/StandardLayoutType): + JSON values have + [standard layout](http://en.cppreference.com/w/cpp/language/data_members#Standard_layout): + All non-static data members are private and standard layout types, the + class has no virtual functions or (virtual) base classes. +- Library-wide + - [EqualityComparable](http://en.cppreference.com/w/cpp/concept/EqualityComparable): + JSON values can be compared with `==`, see @ref + operator==(const_reference,const_reference). + - [LessThanComparable](http://en.cppreference.com/w/cpp/concept/LessThanComparable): + JSON values can be compared with `<`, see @ref + operator<(const_reference,const_reference). + - [Swappable](http://en.cppreference.com/w/cpp/concept/Swappable): + Any JSON lvalue or rvalue of can be swapped with any lvalue or rvalue of + other compatible types, using unqualified function call @ref swap(). + - [NullablePointer](http://en.cppreference.com/w/cpp/concept/NullablePointer): + JSON values can be compared against `std::nullptr_t` objects which are used + to model the `null` value. +- Container + - [Container](http://en.cppreference.com/w/cpp/concept/Container): + JSON values can be used like STL containers and provide iterator access. + - [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer); + JSON values can be used like STL containers and provide reverse iterator + access. + +@invariant The member variables @a m_value and @a m_type have the following +relationship: +- If `m_type == value_t::object`, then `m_value.object != nullptr`. +- If `m_type == value_t::array`, then `m_value.array != nullptr`. +- If `m_type == value_t::string`, then `m_value.string != nullptr`. +The invariants are checked by member function assert_invariant(). + +@internal +@note ObjectType trick from http://stackoverflow.com/a/9860911 +@endinternal + +@see [RFC 7159: The JavaScript Object Notation (JSON) Data Interchange +Format](http://rfc7159.net/rfc7159) + +@since version 1.0.0 + +@nosubgrouping +*/ +NLOHMANN_BASIC_JSON_TPL_DECLARATION +class basic_json +{ + private: + template friend struct detail::external_constructor; + friend ::nlohmann::json_pointer; + friend ::nlohmann::detail::parser; + friend ::nlohmann::detail::serializer; + template + friend class ::nlohmann::detail::iter_impl; + template + friend class ::nlohmann::detail::binary_writer; + template + friend class ::nlohmann::detail::binary_reader; + + /// workaround type for MSVC + using basic_json_t = NLOHMANN_BASIC_JSON_TPL; + + // convenience aliases for types residing in namespace detail; + using lexer = ::nlohmann::detail::lexer; + using parser = ::nlohmann::detail::parser; + + using primitive_iterator_t = ::nlohmann::detail::primitive_iterator_t; + template + using internal_iterator = ::nlohmann::detail::internal_iterator; + template + using iter_impl = ::nlohmann::detail::iter_impl; + template + using iteration_proxy = ::nlohmann::detail::iteration_proxy; + template using json_reverse_iterator = ::nlohmann::detail::json_reverse_iterator; + + template + using output_adapter_t = ::nlohmann::detail::output_adapter_t; + + using binary_reader = ::nlohmann::detail::binary_reader; + template using binary_writer = ::nlohmann::detail::binary_writer; + + using serializer = ::nlohmann::detail::serializer; + + public: + using value_t = detail::value_t; + // forward declarations + using json_pointer = ::nlohmann::json_pointer; + template + using json_serializer = JSONSerializer; + + using initializer_list_t = std::initializer_list>; + + //////////////// + // exceptions // + //////////////// + + /// @name exceptions + /// Classes to implement user-defined exceptions. + /// @{ + + /// @copydoc detail::exception + using exception = detail::exception; + /// @copydoc detail::parse_error + using parse_error = detail::parse_error; + /// @copydoc detail::invalid_iterator + using invalid_iterator = detail::invalid_iterator; + /// @copydoc detail::type_error + using type_error = detail::type_error; + /// @copydoc detail::out_of_range + using out_of_range = detail::out_of_range; + /// @copydoc detail::other_error + using other_error = detail::other_error; + + /// @} + + + ///////////////////// + // container types // + ///////////////////// + + /// @name container types + /// The canonic container types to use @ref basic_json like any other STL + /// container. + /// @{ + + /// the type of elements in a basic_json container + using value_type = basic_json; + + /// the type of an element reference + using reference = value_type&; + /// the type of an element const reference + using const_reference = const value_type&; + + /// a type to represent differences between iterators + using difference_type = std::ptrdiff_t; + /// a type to represent container sizes + using size_type = std::size_t; + + /// the allocator type + using allocator_type = AllocatorType; + + /// the type of an element pointer + using pointer = typename std::allocator_traits::pointer; + /// the type of an element const pointer + using const_pointer = typename std::allocator_traits::const_pointer; + + /// an iterator for a basic_json container + using iterator = iter_impl; + /// a const iterator for a basic_json container + using const_iterator = iter_impl; + /// a reverse iterator for a basic_json container + using reverse_iterator = json_reverse_iterator; + /// a const reverse iterator for a basic_json container + using const_reverse_iterator = json_reverse_iterator; + + /// @} + + + /*! + @brief returns the allocator associated with the container + */ + static allocator_type get_allocator() + { + return allocator_type(); + } + + /*! + @brief returns version information on the library + + This function returns a JSON object with information about the library, + including the version number and information on the platform and compiler. + + @return JSON object holding version information + key | description + ----------- | --------------- + `compiler` | Information on the used compiler. It is an object with the following keys: `c++` (the used C++ standard), `family` (the compiler family; possible values are `clang`, `icc`, `gcc`, `ilecpp`, `msvc`, `pgcpp`, `sunpro`, and `unknown`), and `version` (the compiler version). + `copyright` | The copyright line for the library as string. + `name` | The name of the library as string. + `platform` | The used platform as string. Possible values are `win32`, `linux`, `apple`, `unix`, and `unknown`. + `url` | The URL of the project as string. + `version` | The version of the library. It is an object with the following keys: `major`, `minor`, and `patch` as defined by [Semantic Versioning](http://semver.org), and `string` (the version string). + + @liveexample{The following code shows an example output of the `meta()` + function.,meta} + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. + + @complexity Constant. + + @since 2.1.0 + */ + static basic_json meta() + { + basic_json result; + + result["copyright"] = "(C) 2013-2017 Niels Lohmann"; + result["name"] = "JSON for Modern C++"; + result["url"] = "https://github.com/nlohmann/json"; + result["version"] = + { + {"string", "2.1.1"}, {"major", 2}, {"minor", 1}, {"patch", 1} + }; + +#ifdef _WIN32 + result["platform"] = "win32"; +#elif defined __linux__ + result["platform"] = "linux"; +#elif defined __APPLE__ + result["platform"] = "apple"; +#elif defined __unix__ + result["platform"] = "unix"; +#else + result["platform"] = "unknown"; +#endif + +#if defined(__ICC) || defined(__INTEL_COMPILER) + result["compiler"] = {{"family", "icc"}, {"version", __INTEL_COMPILER}}; +#elif defined(__clang__) + result["compiler"] = {{"family", "clang"}, {"version", __clang_version__}}; +#elif defined(__GNUC__) || defined(__GNUG__) + result["compiler"] = {{"family", "gcc"}, {"version", std::to_string(__GNUC__) + "." + std::to_string(__GNUC_MINOR__) + "." + std::to_string(__GNUC_PATCHLEVEL__)}}; +#elif defined(__HP_cc) || defined(__HP_aCC) + result["compiler"] = "hp" +#elif defined(__IBMCPP__) + result["compiler"] = {{"family", "ilecpp"}, {"version", __IBMCPP__}}; +#elif defined(_MSC_VER) + result["compiler"] = {{"family", "msvc"}, {"version", _MSC_VER}}; +#elif defined(__PGI) + result["compiler"] = {{"family", "pgcpp"}, {"version", __PGI}}; +#elif defined(__SUNPRO_CC) + result["compiler"] = {{"family", "sunpro"}, {"version", __SUNPRO_CC}}; +#else + result["compiler"] = {{"family", "unknown"}, {"version", "unknown"}}; +#endif + +#ifdef __cplusplus + result["compiler"]["c++"] = std::to_string(__cplusplus); +#else + result["compiler"]["c++"] = "unknown"; +#endif + return result; + } + + + /////////////////////////// + // JSON value data types // + /////////////////////////// + + /// @name JSON value data types + /// The data types to store a JSON value. These types are derived from + /// the template arguments passed to class @ref basic_json. + /// @{ + + /*! + @brief a type for an object + + [RFC 7159](http://rfc7159.net/rfc7159) describes JSON objects as follows: + > An object is an unordered collection of zero or more name/value pairs, + > where a name is a string and a value is a string, number, boolean, null, + > object, or array. + + To store objects in C++, a type is defined by the template parameters + described below. + + @tparam ObjectType the container to store objects (e.g., `std::map` or + `std::unordered_map`) + @tparam StringType the type of the keys or names (e.g., `std::string`). + The comparison function `std::less` is used to order elements + inside the container. + @tparam AllocatorType the allocator to use for objects (e.g., + `std::allocator`) + + #### Default type + + With the default values for @a ObjectType (`std::map`), @a StringType + (`std::string`), and @a AllocatorType (`std::allocator`), the default + value for @a object_t is: + + @code {.cpp} + std::map< + std::string, // key_type + basic_json, // value_type + std::less, // key_compare + std::allocator> // allocator_type + > + @endcode + + #### Behavior + + The choice of @a object_t influences the behavior of the JSON class. With + the default type, objects have the following behavior: + + - When all names are unique, objects will be interoperable in the sense + that all software implementations receiving that object will agree on + the name-value mappings. + - When the names within an object are not unique, later stored name/value + pairs overwrite previously stored name/value pairs, leaving the used + names unique. For instance, `{"key": 1}` and `{"key": 2, "key": 1}` will + be treated as equal and both stored as `{"key": 1}`. + - Internally, name/value pairs are stored in lexicographical order of the + names. Objects will also be serialized (see @ref dump) in this order. + For instance, `{"b": 1, "a": 2}` and `{"a": 2, "b": 1}` will be stored + and serialized as `{"a": 2, "b": 1}`. + - When comparing objects, the order of the name/value pairs is irrelevant. + This makes objects interoperable in the sense that they will not be + affected by these differences. For instance, `{"b": 1, "a": 2}` and + `{"a": 2, "b": 1}` will be treated as equal. + + #### Limits + + [RFC 7159](http://rfc7159.net/rfc7159) specifies: + > An implementation may set limits on the maximum depth of nesting. + + In this class, the object's limit of nesting is not explicitly constrained. + However, a maximum depth of nesting may be introduced by the compiler or + runtime environment. A theoretical limit can be queried by calling the + @ref max_size function of a JSON object. + + #### Storage + + Objects are stored as pointers in a @ref basic_json type. That is, for any + access to object values, a pointer of type `object_t*` must be + dereferenced. + + @sa @ref array_t -- type for an array value + + @since version 1.0.0 + + @note The order name/value pairs are added to the object is *not* + preserved by the library. Therefore, iterating an object may return + name/value pairs in a different order than they were originally stored. In + fact, keys will be traversed in alphabetical order as `std::map` with + `std::less` is used by default. Please note this behavior conforms to [RFC + 7159](http://rfc7159.net/rfc7159), because any order implements the + specified "unordered" nature of JSON objects. + */ + +#if defined(JSON_HAS_CPP_14) + // Use transparent comparator if possible, combined with perfect forwarding + // on find() and count() calls prevents unnecessary string construction. + using object_comparator_t = std::less<>; +#else + using object_comparator_t = std::less; +#endif + using object_t = ObjectType>>; + + /*! + @brief a type for an array + + [RFC 7159](http://rfc7159.net/rfc7159) describes JSON arrays as follows: + > An array is an ordered sequence of zero or more values. + + To store objects in C++, a type is defined by the template parameters + explained below. + + @tparam ArrayType container type to store arrays (e.g., `std::vector` or + `std::list`) + @tparam AllocatorType allocator to use for arrays (e.g., `std::allocator`) + + #### Default type + + With the default values for @a ArrayType (`std::vector`) and @a + AllocatorType (`std::allocator`), the default value for @a array_t is: + + @code {.cpp} + std::vector< + basic_json, // value_type + std::allocator // allocator_type + > + @endcode + + #### Limits + + [RFC 7159](http://rfc7159.net/rfc7159) specifies: + > An implementation may set limits on the maximum depth of nesting. + + In this class, the array's limit of nesting is not explicitly constrained. + However, a maximum depth of nesting may be introduced by the compiler or + runtime environment. A theoretical limit can be queried by calling the + @ref max_size function of a JSON array. + + #### Storage + + Arrays are stored as pointers in a @ref basic_json type. That is, for any + access to array values, a pointer of type `array_t*` must be dereferenced. + + @sa @ref object_t -- type for an object value + + @since version 1.0.0 + */ + using array_t = ArrayType>; + + /*! + @brief a type for a string + + [RFC 7159](http://rfc7159.net/rfc7159) describes JSON strings as follows: + > A string is a sequence of zero or more Unicode characters. + + To store objects in C++, a type is defined by the template parameter + described below. Unicode values are split by the JSON class into + byte-sized characters during deserialization. + + @tparam StringType the container to store strings (e.g., `std::string`). + Note this container is used for keys/names in objects, see @ref object_t. + + #### Default type + + With the default values for @a StringType (`std::string`), the default + value for @a string_t is: + + @code {.cpp} + std::string + @endcode + + #### Encoding + + Strings are stored in UTF-8 encoding. Therefore, functions like + `std::string::size()` or `std::string::length()` return the number of + bytes in the string rather than the number of characters or glyphs. + + #### String comparison + + [RFC 7159](http://rfc7159.net/rfc7159) states: + > Software implementations are typically required to test names of object + > members for equality. Implementations that transform the textual + > representation into sequences of Unicode code units and then perform the + > comparison numerically, code unit by code unit, are interoperable in the + > sense that implementations will agree in all cases on equality or + > inequality of two strings. For example, implementations that compare + > strings with escaped characters unconverted may incorrectly find that + > `"a\\b"` and `"a\u005Cb"` are not equal. + + This implementation is interoperable as it does compare strings code unit + by code unit. + + #### Storage + + String values are stored as pointers in a @ref basic_json type. That is, + for any access to string values, a pointer of type `string_t*` must be + dereferenced. + + @since version 1.0.0 + */ + using string_t = StringType; + + /*! + @brief a type for a boolean + + [RFC 7159](http://rfc7159.net/rfc7159) implicitly describes a boolean as a + type which differentiates the two literals `true` and `false`. + + To store objects in C++, a type is defined by the template parameter @a + BooleanType which chooses the type to use. + + #### Default type + + With the default values for @a BooleanType (`bool`), the default value for + @a boolean_t is: + + @code {.cpp} + bool + @endcode + + #### Storage + + Boolean values are stored directly inside a @ref basic_json type. + + @since version 1.0.0 + */ + using boolean_t = BooleanType; + + /*! + @brief a type for a number (integer) + + [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: + > The representation of numbers is similar to that used in most + > programming languages. A number is represented in base 10 using decimal + > digits. It contains an integer component that may be prefixed with an + > optional minus sign, which may be followed by a fraction part and/or an + > exponent part. Leading zeros are not allowed. (...) Numeric values that + > cannot be represented in the grammar below (such as Infinity and NaN) + > are not permitted. + + This description includes both integer and floating-point numbers. + However, C++ allows more precise storage if it is known whether the number + is a signed integer, an unsigned integer or a floating-point number. + Therefore, three different types, @ref number_integer_t, @ref + number_unsigned_t and @ref number_float_t are used. + + To store integer numbers in C++, a type is defined by the template + parameter @a NumberIntegerType which chooses the type to use. + + #### Default type + + With the default values for @a NumberIntegerType (`int64_t`), the default + value for @a number_integer_t is: + + @code {.cpp} + int64_t + @endcode + + #### Default behavior + + - The restrictions about leading zeros is not enforced in C++. Instead, + leading zeros in integer literals lead to an interpretation as octal + number. Internally, the value will be stored as decimal number. For + instance, the C++ integer literal `010` will be serialized to `8`. + During deserialization, leading zeros yield an error. + - Not-a-number (NaN) values will be serialized to `null`. + + #### Limits + + [RFC 7159](http://rfc7159.net/rfc7159) specifies: + > An implementation may set limits on the range and precision of numbers. + + When the default type is used, the maximal integer number that can be + stored is `9223372036854775807` (INT64_MAX) and the minimal integer number + that can be stored is `-9223372036854775808` (INT64_MIN). Integer numbers + that are out of range will yield over/underflow when used in a + constructor. During deserialization, too large or small integer numbers + will be automatically be stored as @ref number_unsigned_t or @ref + number_float_t. + + [RFC 7159](http://rfc7159.net/rfc7159) further states: + > Note that when such software is used, numbers that are integers and are + > in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are interoperable in the sense + > that implementations will agree exactly on their numeric values. + + As this range is a subrange of the exactly supported range [INT64_MIN, + INT64_MAX], this class's integer type is interoperable. + + #### Storage + + Integer number values are stored directly inside a @ref basic_json type. + + @sa @ref number_float_t -- type for number values (floating-point) + + @sa @ref number_unsigned_t -- type for number values (unsigned integer) + + @since version 1.0.0 + */ + using number_integer_t = NumberIntegerType; + + /*! + @brief a type for a number (unsigned) + + [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: + > The representation of numbers is similar to that used in most + > programming languages. A number is represented in base 10 using decimal + > digits. It contains an integer component that may be prefixed with an + > optional minus sign, which may be followed by a fraction part and/or an + > exponent part. Leading zeros are not allowed. (...) Numeric values that + > cannot be represented in the grammar below (such as Infinity and NaN) + > are not permitted. + + This description includes both integer and floating-point numbers. + However, C++ allows more precise storage if it is known whether the number + is a signed integer, an unsigned integer or a floating-point number. + Therefore, three different types, @ref number_integer_t, @ref + number_unsigned_t and @ref number_float_t are used. + + To store unsigned integer numbers in C++, a type is defined by the + template parameter @a NumberUnsignedType which chooses the type to use. + + #### Default type + + With the default values for @a NumberUnsignedType (`uint64_t`), the + default value for @a number_unsigned_t is: + + @code {.cpp} + uint64_t + @endcode + + #### Default behavior + + - The restrictions about leading zeros is not enforced in C++. Instead, + leading zeros in integer literals lead to an interpretation as octal + number. Internally, the value will be stored as decimal number. For + instance, the C++ integer literal `010` will be serialized to `8`. + During deserialization, leading zeros yield an error. + - Not-a-number (NaN) values will be serialized to `null`. + + #### Limits + + [RFC 7159](http://rfc7159.net/rfc7159) specifies: + > An implementation may set limits on the range and precision of numbers. + + When the default type is used, the maximal integer number that can be + stored is `18446744073709551615` (UINT64_MAX) and the minimal integer + number that can be stored is `0`. Integer numbers that are out of range + will yield over/underflow when used in a constructor. During + deserialization, too large or small integer numbers will be automatically + be stored as @ref number_integer_t or @ref number_float_t. + + [RFC 7159](http://rfc7159.net/rfc7159) further states: + > Note that when such software is used, numbers that are integers and are + > in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are interoperable in the sense + > that implementations will agree exactly on their numeric values. + + As this range is a subrange (when considered in conjunction with the + number_integer_t type) of the exactly supported range [0, UINT64_MAX], + this class's integer type is interoperable. + + #### Storage + + Integer number values are stored directly inside a @ref basic_json type. + + @sa @ref number_float_t -- type for number values (floating-point) + @sa @ref number_integer_t -- type for number values (integer) + + @since version 2.0.0 + */ + using number_unsigned_t = NumberUnsignedType; + + /*! + @brief a type for a number (floating-point) + + [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: + > The representation of numbers is similar to that used in most + > programming languages. A number is represented in base 10 using decimal + > digits. It contains an integer component that may be prefixed with an + > optional minus sign, which may be followed by a fraction part and/or an + > exponent part. Leading zeros are not allowed. (...) Numeric values that + > cannot be represented in the grammar below (such as Infinity and NaN) + > are not permitted. + + This description includes both integer and floating-point numbers. + However, C++ allows more precise storage if it is known whether the number + is a signed integer, an unsigned integer or a floating-point number. + Therefore, three different types, @ref number_integer_t, @ref + number_unsigned_t and @ref number_float_t are used. + + To store floating-point numbers in C++, a type is defined by the template + parameter @a NumberFloatType which chooses the type to use. + + #### Default type + + With the default values for @a NumberFloatType (`double`), the default + value for @a number_float_t is: + + @code {.cpp} + double + @endcode + + #### Default behavior + + - The restrictions about leading zeros is not enforced in C++. Instead, + leading zeros in floating-point literals will be ignored. Internally, + the value will be stored as decimal number. For instance, the C++ + floating-point literal `01.2` will be serialized to `1.2`. During + deserialization, leading zeros yield an error. + - Not-a-number (NaN) values will be serialized to `null`. + + #### Limits + + [RFC 7159](http://rfc7159.net/rfc7159) states: + > This specification allows implementations to set limits on the range and + > precision of numbers accepted. Since software that implements IEEE + > 754-2008 binary64 (double precision) numbers is generally available and + > widely used, good interoperability can be achieved by implementations + > that expect no more precision or range than these provide, in the sense + > that implementations will approximate JSON numbers within the expected + > precision. + + This implementation does exactly follow this approach, as it uses double + precision floating-point numbers. Note values smaller than + `-1.79769313486232e+308` and values greater than `1.79769313486232e+308` + will be stored as NaN internally and be serialized to `null`. + + #### Storage + + Floating-point number values are stored directly inside a @ref basic_json + type. + + @sa @ref number_integer_t -- type for number values (integer) + + @sa @ref number_unsigned_t -- type for number values (unsigned integer) + + @since version 1.0.0 + */ + using number_float_t = NumberFloatType; + + /// @} + + private: + + /// helper for exception-safe object creation + template + static T* create(Args&& ... args) + { + AllocatorType alloc; + auto deleter = [&](T * object) + { + alloc.deallocate(object, 1); + }; + std::unique_ptr object(alloc.allocate(1), deleter); + alloc.construct(object.get(), std::forward(args)...); + assert(object != nullptr); + return object.release(); + } + + //////////////////////// + // JSON value storage // + //////////////////////// + + /*! + @brief a JSON value + + The actual storage for a JSON value of the @ref basic_json class. This + union combines the different storage types for the JSON value types + defined in @ref value_t. + + JSON type | value_t type | used type + --------- | --------------- | ------------------------ + object | object | pointer to @ref object_t + array | array | pointer to @ref array_t + string | string | pointer to @ref string_t + boolean | boolean | @ref boolean_t + number | number_integer | @ref number_integer_t + number | number_unsigned | @ref number_unsigned_t + number | number_float | @ref number_float_t + null | null | *no value is stored* + + @note Variable-length types (objects, arrays, and strings) are stored as + pointers. The size of the union should not exceed 64 bits if the default + value types are used. + + @since version 1.0.0 + */ + union json_value + { + /// object (stored with pointer to save storage) + object_t* object; + /// array (stored with pointer to save storage) + array_t* array; + /// string (stored with pointer to save storage) + string_t* string; + /// boolean + boolean_t boolean; + /// number (integer) + number_integer_t number_integer; + /// number (unsigned integer) + number_unsigned_t number_unsigned; + /// number (floating-point) + number_float_t number_float; + + /// default constructor (for null values) + json_value() = default; + /// constructor for booleans + json_value(boolean_t v) noexcept : boolean(v) {} + /// constructor for numbers (integer) + json_value(number_integer_t v) noexcept : number_integer(v) {} + /// constructor for numbers (unsigned) + json_value(number_unsigned_t v) noexcept : number_unsigned(v) {} + /// constructor for numbers (floating-point) + json_value(number_float_t v) noexcept : number_float(v) {} + /// constructor for empty values of a given type + json_value(value_t t) + { + switch (t) + { + case value_t::object: + { + object = create(); + break; + } + + case value_t::array: + { + array = create(); + break; + } + + case value_t::string: + { + string = create(""); + break; + } + + case value_t::boolean: + { + boolean = boolean_t(false); + break; + } + + case value_t::number_integer: + { + number_integer = number_integer_t(0); + break; + } + + case value_t::number_unsigned: + { + number_unsigned = number_unsigned_t(0); + break; + } + + case value_t::number_float: + { + number_float = number_float_t(0.0); + break; + } + + case value_t::null: + { + object = nullptr; // silence warning, see #821 + break; + } + + default: + { + object = nullptr; // silence warning, see #821 + if (JSON_UNLIKELY(t == value_t::null)) + { + JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 2.1.1")); // LCOV_EXCL_LINE + } + break; + } + } + } + + /// constructor for strings + json_value(const string_t& value) + { + string = create(value); + } + + /// constructor for rvalue strings + json_value(string_t&& value) + { + string = create(std::move(value)); + } + + /// constructor for objects + json_value(const object_t& value) + { + object = create(value); + } + + /// constructor for rvalue objects + json_value(object_t&& value) + { + object = create(std::move(value)); + } + + /// constructor for arrays + json_value(const array_t& value) + { + array = create(value); + } + + /// constructor for rvalue arrays + json_value(array_t&& value) + { + array = create(std::move(value)); + } + + void destroy(value_t t) + { + switch (t) + { + case value_t::object: + { + AllocatorType alloc; + alloc.destroy(object); + alloc.deallocate(object, 1); + break; + } + + case value_t::array: + { + AllocatorType alloc; + alloc.destroy(array); + alloc.deallocate(array, 1); + break; + } + + case value_t::string: + { + AllocatorType alloc; + alloc.destroy(string); + alloc.deallocate(string, 1); + break; + } + + default: + { + break; + } + } + } + }; + + /*! + @brief checks the class invariants + + This function asserts the class invariants. It needs to be called at the + end of every constructor to make sure that created objects respect the + invariant. Furthermore, it has to be called each time the type of a JSON + value is changed, because the invariant expresses a relationship between + @a m_type and @a m_value. + */ + void assert_invariant() const + { + assert(m_type != value_t::object or m_value.object != nullptr); + assert(m_type != value_t::array or m_value.array != nullptr); + assert(m_type != value_t::string or m_value.string != nullptr); + } + + public: + ////////////////////////// + // JSON parser callback // + ////////////////////////// + + using parse_event_t = typename parser::parse_event_t; + + /*! + @brief per-element parser callback type + + With a parser callback function, the result of parsing a JSON text can be + influenced. When passed to @ref parse, it is called on certain events + (passed as @ref parse_event_t via parameter @a event) with a set recursion + depth @a depth and context JSON value @a parsed. The return value of the + callback function is a boolean indicating whether the element that emitted + the callback shall be kept or not. + + We distinguish six scenarios (determined by the event type) in which the + callback function can be called. The following table describes the values + of the parameters @a depth, @a event, and @a parsed. + + parameter @a event | description | parameter @a depth | parameter @a parsed + ------------------ | ----------- | ------------------ | ------------------- + parse_event_t::object_start | the parser read `{` and started to process a JSON object | depth of the parent of the JSON object | a JSON value with type discarded + parse_event_t::key | the parser read a key of a value in an object | depth of the currently parsed JSON object | a JSON string containing the key + parse_event_t::object_end | the parser read `}` and finished processing a JSON object | depth of the parent of the JSON object | the parsed JSON object + parse_event_t::array_start | the parser read `[` and started to process a JSON array | depth of the parent of the JSON array | a JSON value with type discarded + parse_event_t::array_end | the parser read `]` and finished processing a JSON array | depth of the parent of the JSON array | the parsed JSON array + parse_event_t::value | the parser finished reading a JSON value | depth of the value | the parsed JSON value + + @image html callback_events.png "Example when certain parse events are triggered" + + Discarding a value (i.e., returning `false`) has different effects + depending on the context in which function was called: + + - Discarded values in structured types are skipped. That is, the parser + will behave as if the discarded value was never read. + - In case a value outside a structured type is skipped, it is replaced + with `null`. This case happens if the top-level element is skipped. + + @param[in] depth the depth of the recursion during parsing + + @param[in] event an event of type parse_event_t indicating the context in + the callback function has been called + + @param[in,out] parsed the current intermediate parse result; note that + writing to this value has no effect for parse_event_t::key events + + @return Whether the JSON value which called the function during parsing + should be kept (`true`) or not (`false`). In the latter case, it is either + skipped completely or replaced by an empty discarded object. + + @sa @ref parse for examples + + @since version 1.0.0 + */ + using parser_callback_t = typename parser::parser_callback_t; + + + ////////////////// + // constructors // + ////////////////// + + /// @name constructors and destructors + /// Constructors of class @ref basic_json, copy/move constructor, copy + /// assignment, static functions creating objects, and the destructor. + /// @{ + + /*! + @brief create an empty value with a given type + + Create an empty JSON value with a given type. The value will be default + initialized with an empty value which depends on the type: + + Value type | initial value + ----------- | ------------- + null | `null` + boolean | `false` + string | `""` + number | `0` + object | `{}` + array | `[]` + + @param[in] v the type of the value to create + + @complexity Constant. + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. + + @liveexample{The following code shows the constructor for different @ref + value_t values,basic_json__value_t} + + @sa @ref clear() -- restores the postcondition of this constructor + + @since version 1.0.0 + */ + basic_json(const value_t v) + : m_type(v), m_value(v) + { + assert_invariant(); + } + + /*! + @brief create a null object + + Create a `null` JSON value. It either takes a null pointer as parameter + (explicitly creating `null`) or no parameter (implicitly creating `null`). + The passed null pointer itself is not read -- it is only used to choose + the right constructor. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this constructor never throws + exceptions. + + @liveexample{The following code shows the constructor with and without a + null pointer parameter.,basic_json__nullptr_t} + + @since version 1.0.0 + */ + basic_json(std::nullptr_t = nullptr) noexcept + : basic_json(value_t::null) + { + assert_invariant(); + } + + /*! + @brief create a JSON value + + This is a "catch all" constructor for all compatible JSON types; that is, + types for which a `to_json()` method exsits. The constructor forwards the + parameter @a val to that method (to `json_serializer::to_json` method + with `U = uncvref_t`, to be exact). + + Template type @a CompatibleType includes, but is not limited to, the + following types: + - **arrays**: @ref array_t and all kinds of compatible containers such as + `std::vector`, `std::deque`, `std::list`, `std::forward_list`, + `std::array`, `std::valarray`, `std::set`, `std::unordered_set`, + `std::multiset`, and `std::unordered_multiset` with a `value_type` from + which a @ref basic_json value can be constructed. + - **objects**: @ref object_t and all kinds of compatible associative + containers such as `std::map`, `std::unordered_map`, `std::multimap`, + and `std::unordered_multimap` with a `key_type` compatible to + @ref string_t and a `value_type` from which a @ref basic_json value can + be constructed. + - **strings**: @ref string_t, string literals, and all compatible string + containers can be used. + - **numbers**: @ref number_integer_t, @ref number_unsigned_t, + @ref number_float_t, and all convertible number types such as `int`, + `size_t`, `int64_t`, `float` or `double` can be used. + - **boolean**: @ref boolean_t / `bool` can be used. + + See the examples below. + + @tparam CompatibleType a type such that: + - @a CompatibleType is not derived from `std::istream`, + - @a CompatibleType is not @ref basic_json (to avoid hijacking copy/move + constructors), + - @a CompatibleType is not a @ref basic_json nested type (e.g., + @ref json_pointer, @ref iterator, etc ...) + - @ref @ref json_serializer has a + `to_json(basic_json_t&, CompatibleType&&)` method + + @tparam U = `uncvref_t` + + @param[in] val the value to be forwarded to the respective constructor + + @complexity Usually linear in the size of the passed @a val, also + depending on the implementation of the called `to_json()` + method. + + @exceptionsafety Depends on the called constructor. For types directly + supported by the library (i.e., all types for which no `to_json()` function + was provided), strong guarantee holds: if an exception is thrown, there are + no changes to any JSON value. + + @liveexample{The following code shows the constructor with several + compatible types.,basic_json__CompatibleType} + + @since version 2.1.0 + */ + template, + detail::enable_if_t::value and + not std::is_same::value and + not detail::is_basic_json_nested_type< + basic_json_t, U>::value and + detail::has_to_json::value, + int> = 0> + basic_json(CompatibleType && val) noexcept(noexcept(JSONSerializer::to_json( + std::declval(), std::forward(val)))) + { + JSONSerializer::to_json(*this, std::forward(val)); + assert_invariant(); + } + + /*! + @brief create a container (array or object) from an initializer list + + Creates a JSON value of type array or object from the passed initializer + list @a init. In case @a type_deduction is `true` (default), the type of + the JSON value to be created is deducted from the initializer list @a init + according to the following rules: + + 1. If the list is empty, an empty JSON object value `{}` is created. + 2. If the list consists of pairs whose first element is a string, a JSON + object value is created where the first elements of the pairs are + treated as keys and the second elements are as values. + 3. In all other cases, an array is created. + + The rules aim to create the best fit between a C++ initializer list and + JSON values. The rationale is as follows: + + 1. The empty initializer list is written as `{}` which is exactly an empty + JSON object. + 2. C++ has no way of describing mapped types other than to list a list of + pairs. As JSON requires that keys must be of type string, rule 2 is the + weakest constraint one can pose on initializer lists to interpret them + as an object. + 3. In all other cases, the initializer list could not be interpreted as + JSON object type, so interpreting it as JSON array type is safe. + + With the rules described above, the following JSON values cannot be + expressed by an initializer list: + + - the empty array (`[]`): use @ref array(initializer_list_t) + with an empty initializer list in this case + - arrays whose elements satisfy rule 2: use @ref + array(initializer_list_t) with the same initializer list + in this case + + @note When used without parentheses around an empty initializer list, @ref + basic_json() is called instead of this function, yielding the JSON null + value. + + @param[in] init initializer list with JSON values + + @param[in] type_deduction internal parameter; when set to `true`, the type + of the JSON value is deducted from the initializer list @a init; when set + to `false`, the type provided via @a manual_type is forced. This mode is + used by the functions @ref array(initializer_list_t) and + @ref object(initializer_list_t). + + @param[in] manual_type internal parameter; when @a type_deduction is set + to `false`, the created JSON value will use the provided type (only @ref + value_t::array and @ref value_t::object are valid); when @a type_deduction + is set to `true`, this parameter has no effect + + @throw type_error.301 if @a type_deduction is `false`, @a manual_type is + `value_t::object`, but @a init contains an element which is not a pair + whose first element is a string. In this case, the constructor could not + create an object. If @a type_deduction would have be `true`, an array + would have been created. See @ref object(initializer_list_t) + for an example. + + @complexity Linear in the size of the initializer list @a init. + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. + + @liveexample{The example below shows how JSON values are created from + initializer lists.,basic_json__list_init_t} + + @sa @ref array(initializer_list_t) -- create a JSON array + value from an initializer list + @sa @ref object(initializer_list_t) -- create a JSON object + value from an initializer list + + @since version 1.0.0 + */ + basic_json(initializer_list_t init, + bool type_deduction = true, + value_t manual_type = value_t::array) + { + // check if each element is an array with two elements whose first + // element is a string + bool is_an_object = std::all_of(init.begin(), init.end(), + [](const detail::json_ref& element_ref) + { + return (element_ref->is_array() and element_ref->size() == 2 and (*element_ref)[0].is_string()); + }); + + // adjust type if type deduction is not wanted + if (not type_deduction) + { + // if array is wanted, do not create an object though possible + if (manual_type == value_t::array) + { + is_an_object = false; + } + + // if object is wanted but impossible, throw an exception + if (JSON_UNLIKELY(manual_type == value_t::object and not is_an_object)) + { + JSON_THROW(type_error::create(301, "cannot create object from initializer list")); + } + } + + if (is_an_object) + { + // the initializer list is a list of pairs -> create object + m_type = value_t::object; + m_value = value_t::object; + + std::for_each(init.begin(), init.end(), [this](const detail::json_ref& element_ref) + { + auto element = element_ref.moved_or_copied(); + m_value.object->emplace( + std::move(*((*element.m_value.array)[0].m_value.string)), + std::move((*element.m_value.array)[1])); + }); + } + else + { + // the initializer list describes an array -> create array + m_type = value_t::array; + m_value.array = create(init.begin(), init.end()); + } + + assert_invariant(); + } + + /*! + @brief explicitly create an array from an initializer list + + Creates a JSON array value from a given initializer list. That is, given a + list of values `a, b, c`, creates the JSON value `[a, b, c]`. If the + initializer list is empty, the empty array `[]` is created. + + @note This function is only needed to express two edge cases that cannot + be realized with the initializer list constructor (@ref + basic_json(initializer_list_t, bool, value_t)). These cases + are: + 1. creating an array whose elements are all pairs whose first element is a + string -- in this case, the initializer list constructor would create an + object, taking the first elements as keys + 2. creating an empty array -- passing the empty initializer list to the + initializer list constructor yields an empty object + + @param[in] init initializer list with JSON values to create an array from + (optional) + + @return JSON array value + + @complexity Linear in the size of @a init. + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. + + @liveexample{The following code shows an example for the `array` + function.,array} + + @sa @ref basic_json(initializer_list_t, bool, value_t) -- + create a JSON value from an initializer list + @sa @ref object(initializer_list_t) -- create a JSON object + value from an initializer list + + @since version 1.0.0 + */ + static basic_json array(initializer_list_t init = {}) + { + return basic_json(init, false, value_t::array); + } + + /*! + @brief explicitly create an object from an initializer list + + Creates a JSON object value from a given initializer list. The initializer + lists elements must be pairs, and their first elements must be strings. If + the initializer list is empty, the empty object `{}` is created. + + @note This function is only added for symmetry reasons. In contrast to the + related function @ref array(initializer_list_t), there are + no cases which can only be expressed by this function. That is, any + initializer list @a init can also be passed to the initializer list + constructor @ref basic_json(initializer_list_t, bool, value_t). + + @param[in] init initializer list to create an object from (optional) + + @return JSON object value + + @throw type_error.301 if @a init is not a list of pairs whose first + elements are strings. In this case, no object can be created. When such a + value is passed to @ref basic_json(initializer_list_t, bool, value_t), + an array would have been created from the passed initializer list @a init. + See example below. + + @complexity Linear in the size of @a init. + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. + + @liveexample{The following code shows an example for the `object` + function.,object} + + @sa @ref basic_json(initializer_list_t, bool, value_t) -- + create a JSON value from an initializer list + @sa @ref array(initializer_list_t) -- create a JSON array + value from an initializer list + + @since version 1.0.0 + */ + static basic_json object(initializer_list_t init = {}) + { + return basic_json(init, false, value_t::object); + } + + /*! + @brief construct an array with count copies of given value + + Constructs a JSON array value by creating @a cnt copies of a passed value. + In case @a cnt is `0`, an empty array is created. + + @param[in] cnt the number of JSON copies of @a val to create + @param[in] val the JSON value to copy + + @post `std::distance(begin(),end()) == cnt` holds. + + @complexity Linear in @a cnt. + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. + + @liveexample{The following code shows examples for the @ref + basic_json(size_type\, const basic_json&) + constructor.,basic_json__size_type_basic_json} + + @since version 1.0.0 + */ + basic_json(size_type cnt, const basic_json& val) + : m_type(value_t::array) + { + m_value.array = create(cnt, val); + assert_invariant(); + } + + /*! + @brief construct a JSON container given an iterator range + + Constructs the JSON value with the contents of the range `[first, last)`. + The semantics depends on the different types a JSON value can have: + - In case of a null type, invalid_iterator.206 is thrown. + - In case of other primitive types (number, boolean, or string), @a first + must be `begin()` and @a last must be `end()`. In this case, the value is + copied. Otherwise, invalid_iterator.204 is thrown. + - In case of structured types (array, object), the constructor behaves as + similar versions for `std::vector` or `std::map`; that is, a JSON array + or object is constructed from the values in the range. + + @tparam InputIT an input iterator type (@ref iterator or @ref + const_iterator) + + @param[in] first begin of the range to copy from (included) + @param[in] last end of the range to copy from (excluded) + + @pre Iterators @a first and @a last must be initialized. **This + precondition is enforced with an assertion (see warning).** If + assertions are switched off, a violation of this precondition yields + undefined behavior. + + @pre Range `[first, last)` is valid. Usually, this precondition cannot be + checked efficiently. Only certain edge cases are detected; see the + description of the exceptions below. A violation of this precondition + yields undefined behavior. + + @warning A precondition is enforced with a runtime assertion that will + result in calling `std::abort` if this precondition is not met. + Assertions can be disabled by defining `NDEBUG` at compile time. + See http://en.cppreference.com/w/cpp/error/assert for more + information. + + @throw invalid_iterator.201 if iterators @a first and @a last are not + compatible (i.e., do not belong to the same JSON value). In this case, + the range `[first, last)` is undefined. + @throw invalid_iterator.204 if iterators @a first and @a last belong to a + primitive type (number, boolean, or string), but @a first does not point + to the first element any more. In this case, the range `[first, last)` is + undefined. See example code below. + @throw invalid_iterator.206 if iterators @a first and @a last belong to a + null value. In this case, the range `[first, last)` is undefined. + + @complexity Linear in distance between @a first and @a last. + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. + + @liveexample{The example below shows several ways to create JSON values by + specifying a subrange with iterators.,basic_json__InputIt_InputIt} + + @since version 1.0.0 + */ + template::value or + std::is_same::value, int>::type = 0> + basic_json(InputIT first, InputIT last) + { + assert(first.m_object != nullptr); + assert(last.m_object != nullptr); + + // make sure iterator fits the current value + if (JSON_UNLIKELY(first.m_object != last.m_object)) + { + JSON_THROW(invalid_iterator::create(201, "iterators are not compatible")); + } + + // copy type from first iterator + m_type = first.m_object->m_type; + + // check if iterator range is complete for primitive values + switch (m_type) + { + case value_t::boolean: + case value_t::number_float: + case value_t::number_integer: + case value_t::number_unsigned: + case value_t::string: + { + if (JSON_UNLIKELY(not first.m_it.primitive_iterator.is_begin() + or not last.m_it.primitive_iterator.is_end())) + { + JSON_THROW(invalid_iterator::create(204, "iterators out of range")); + } + break; + } + + default: + break; + } + + switch (m_type) + { + case value_t::number_integer: + { + m_value.number_integer = first.m_object->m_value.number_integer; + break; + } + + case value_t::number_unsigned: + { + m_value.number_unsigned = first.m_object->m_value.number_unsigned; + break; + } + + case value_t::number_float: + { + m_value.number_float = first.m_object->m_value.number_float; + break; + } + + case value_t::boolean: + { + m_value.boolean = first.m_object->m_value.boolean; + break; + } + + case value_t::string: + { + m_value = *first.m_object->m_value.string; + break; + } + + case value_t::object: + { + m_value.object = create(first.m_it.object_iterator, + last.m_it.object_iterator); + break; + } + + case value_t::array: + { + m_value.array = create(first.m_it.array_iterator, + last.m_it.array_iterator); + break; + } + + default: + JSON_THROW(invalid_iterator::create(206, "cannot construct with iterators from " + + std::string(first.m_object->type_name()))); + } + + assert_invariant(); + } + + + /////////////////////////////////////// + // other constructors and destructor // + /////////////////////////////////////// + + /// @private + basic_json(const detail::json_ref& ref) + : basic_json(ref.moved_or_copied()) + {} + + /*! + @brief copy constructor + + Creates a copy of a given JSON value. + + @param[in] other the JSON value to copy + + @post `*this == other` + + @complexity Linear in the size of @a other. + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is linear. + - As postcondition, it holds: `other == basic_json(other)`. + + @liveexample{The following code shows an example for the copy + constructor.,basic_json__basic_json} + + @since version 1.0.0 + */ + basic_json(const basic_json& other) + : m_type(other.m_type) + { + // check of passed value is valid + other.assert_invariant(); + + switch (m_type) + { + case value_t::object: + { + m_value = *other.m_value.object; + break; + } + + case value_t::array: + { + m_value = *other.m_value.array; + break; + } + + case value_t::string: + { + m_value = *other.m_value.string; + break; + } + + case value_t::boolean: + { + m_value = other.m_value.boolean; + break; + } + + case value_t::number_integer: + { + m_value = other.m_value.number_integer; + break; + } + + case value_t::number_unsigned: + { + m_value = other.m_value.number_unsigned; + break; + } + + case value_t::number_float: + { + m_value = other.m_value.number_float; + break; + } + + default: + break; + } + + assert_invariant(); + } + + /*! + @brief move constructor + + Move constructor. Constructs a JSON value with the contents of the given + value @a other using move semantics. It "steals" the resources from @a + other and leaves it as JSON null value. + + @param[in,out] other value to move to this object + + @post `*this` has the same value as @a other before the call. + @post @a other is a JSON null value. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this constructor never throws + exceptions. + + @requirement This function helps `basic_json` satisfying the + [MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible) + requirements. + + @liveexample{The code below shows the move constructor explicitly called + via std::move.,basic_json__moveconstructor} + + @since version 1.0.0 + */ + basic_json(basic_json&& other) noexcept + : m_type(std::move(other.m_type)), + m_value(std::move(other.m_value)) + { + // check that passed value is valid + other.assert_invariant(); + + // invalidate payload + other.m_type = value_t::null; + other.m_value = {}; + + assert_invariant(); + } + + /*! + @brief copy assignment + + Copy assignment operator. Copies a JSON value via the "copy and swap" + strategy: It is expressed in terms of the copy constructor, destructor, + and the `swap()` member function. + + @param[in] other value to copy from + + @complexity Linear. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is linear. + + @liveexample{The code below shows and example for the copy assignment. It + creates a copy of value `a` which is then swapped with `b`. Finally\, the + copy of `a` (which is the null value after the swap) is + destroyed.,basic_json__copyassignment} + + @since version 1.0.0 + */ + reference& operator=(basic_json other) noexcept ( + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value and + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value + ) + { + // check that passed value is valid + other.assert_invariant(); + + using std::swap; + swap(m_type, other.m_type); + swap(m_value, other.m_value); + + assert_invariant(); + return *this; + } + + /*! + @brief destructor + + Destroys the JSON value and frees all allocated memory. + + @complexity Linear. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is linear. + - All stored elements are destroyed and all memory is freed. + + @since version 1.0.0 + */ + ~basic_json() + { + assert_invariant(); + m_value.destroy(m_type); + } + + /// @} + + public: + /////////////////////// + // object inspection // + /////////////////////// + + /// @name object inspection + /// Functions to inspect the type of a JSON value. + /// @{ + + /*! + @brief serialization + + Serialization function for JSON values. The function tries to mimic + Python's `json.dumps()` function, and currently supports its @a indent + and @a ensure_ascii parameters. + + @param[in] indent If indent is nonnegative, then array elements and object + members will be pretty-printed with that indent level. An indent level of + `0` will only insert newlines. `-1` (the default) selects the most compact + representation. + @param[in] indent_char The character to use for indentation if @a indent is + greater than `0`. The default is ` ` (space). + @param[in] ensure_ascii If @a ensure_ascii is true, all non-ASCII characters + in the output are escaped with \uXXXX sequences, and the result consists + of ASCII characters only. + + @return string containing the serialization of the JSON value + + @complexity Linear. + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. + + @liveexample{The following example shows the effect of different @a indent\, + @a indent_char\, and @a ensure_ascii parameters to the result of the + serialization.,dump} + + @see https://docs.python.org/2/library/json.html#json.dump + + @since version 1.0.0; indentation character @a indent_char and option + @a ensure_ascii added in version 3.0.0 + */ + string_t dump(const int indent = -1, const char indent_char = ' ', + const bool ensure_ascii = false) const + { + string_t result; + serializer s(detail::output_adapter(result), indent_char); + + if (indent >= 0) + { + s.dump(*this, true, ensure_ascii, static_cast(indent)); + } + else + { + s.dump(*this, false, ensure_ascii, 0); + } + + return result; + } + + /*! + @brief return the type of the JSON value (explicit) + + Return the type of the JSON value as a value from the @ref value_t + enumeration. + + @return the type of the JSON value + Value type | return value + ------------------------- | ------------------------- + null | value_t::null + boolean | value_t::boolean + string | value_t::string + number (integer) | value_t::number_integer + number (unsigned integer) | value_t::number_unsigned + number (foating-point) | value_t::number_float + object | value_t::object + array | value_t::array + discarded | value_t::discarded + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `type()` for all JSON + types.,type} + + @sa @ref operator value_t() -- return the type of the JSON value (implicit) + @sa @ref type_name() -- return the type as string + + @since version 1.0.0 + */ + constexpr value_t type() const noexcept + { + return m_type; + } + + /*! + @brief return whether type is primitive + + This function returns true if and only if the JSON type is primitive + (string, number, boolean, or null). + + @return `true` if type is primitive (string, number, boolean, or null), + `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_primitive()` for all JSON + types.,is_primitive} + + @sa @ref is_structured() -- returns whether JSON value is structured + @sa @ref is_null() -- returns whether JSON value is `null` + @sa @ref is_string() -- returns whether JSON value is a string + @sa @ref is_boolean() -- returns whether JSON value is a boolean + @sa @ref is_number() -- returns whether JSON value is a number + + @since version 1.0.0 + */ + constexpr bool is_primitive() const noexcept + { + return is_null() or is_string() or is_boolean() or is_number(); + } + + /*! + @brief return whether type is structured + + This function returns true if and only if the JSON type is structured + (array or object). + + @return `true` if type is structured (array or object), `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_structured()` for all JSON + types.,is_structured} + + @sa @ref is_primitive() -- returns whether value is primitive + @sa @ref is_array() -- returns whether value is an array + @sa @ref is_object() -- returns whether value is an object + + @since version 1.0.0 + */ + constexpr bool is_structured() const noexcept + { + return is_array() or is_object(); + } + + /*! + @brief return whether value is null + + This function returns true if and only if the JSON value is null. + + @return `true` if type is null, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_null()` for all JSON + types.,is_null} + + @since version 1.0.0 + */ + constexpr bool is_null() const noexcept + { + return (m_type == value_t::null); + } + + /*! + @brief return whether value is a boolean + + This function returns true if and only if the JSON value is a boolean. + + @return `true` if type is boolean, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_boolean()` for all JSON + types.,is_boolean} + + @since version 1.0.0 + */ + constexpr bool is_boolean() const noexcept + { + return (m_type == value_t::boolean); + } + + /*! + @brief return whether value is a number + + This function returns true if and only if the JSON value is a number. This + includes both integer (signed and unsigned) and floating-point values. + + @return `true` if type is number (regardless whether integer, unsigned + integer or floating-type), `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_number()` for all JSON + types.,is_number} + + @sa @ref is_number_integer() -- check if value is an integer or unsigned + integer number + @sa @ref is_number_unsigned() -- check if value is an unsigned integer + number + @sa @ref is_number_float() -- check if value is a floating-point number + + @since version 1.0.0 + */ + constexpr bool is_number() const noexcept + { + return is_number_integer() or is_number_float(); + } + + /*! + @brief return whether value is an integer number + + This function returns true if and only if the JSON value is a signed or + unsigned integer number. This excludes floating-point values. + + @return `true` if type is an integer or unsigned integer number, `false` + otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_number_integer()` for all + JSON types.,is_number_integer} + + @sa @ref is_number() -- check if value is a number + @sa @ref is_number_unsigned() -- check if value is an unsigned integer + number + @sa @ref is_number_float() -- check if value is a floating-point number + + @since version 1.0.0 + */ + constexpr bool is_number_integer() const noexcept + { + return (m_type == value_t::number_integer or m_type == value_t::number_unsigned); + } + + /*! + @brief return whether value is an unsigned integer number + + This function returns true if and only if the JSON value is an unsigned + integer number. This excludes floating-point and signed integer values. + + @return `true` if type is an unsigned integer number, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_number_unsigned()` for all + JSON types.,is_number_unsigned} + + @sa @ref is_number() -- check if value is a number + @sa @ref is_number_integer() -- check if value is an integer or unsigned + integer number + @sa @ref is_number_float() -- check if value is a floating-point number + + @since version 2.0.0 + */ + constexpr bool is_number_unsigned() const noexcept + { + return (m_type == value_t::number_unsigned); + } + + /*! + @brief return whether value is a floating-point number + + This function returns true if and only if the JSON value is a + floating-point number. This excludes signed and unsigned integer values. + + @return `true` if type is a floating-point number, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_number_float()` for all + JSON types.,is_number_float} + + @sa @ref is_number() -- check if value is number + @sa @ref is_number_integer() -- check if value is an integer number + @sa @ref is_number_unsigned() -- check if value is an unsigned integer + number + + @since version 1.0.0 + */ + constexpr bool is_number_float() const noexcept + { + return (m_type == value_t::number_float); + } + + /*! + @brief return whether value is an object + + This function returns true if and only if the JSON value is an object. + + @return `true` if type is object, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_object()` for all JSON + types.,is_object} + + @since version 1.0.0 + */ + constexpr bool is_object() const noexcept + { + return (m_type == value_t::object); + } + + /*! + @brief return whether value is an array + + This function returns true if and only if the JSON value is an array. + + @return `true` if type is array, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_array()` for all JSON + types.,is_array} + + @since version 1.0.0 + */ + constexpr bool is_array() const noexcept + { + return (m_type == value_t::array); + } + + /*! + @brief return whether value is a string + + This function returns true if and only if the JSON value is a string. + + @return `true` if type is string, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_string()` for all JSON + types.,is_string} + + @since version 1.0.0 + */ + constexpr bool is_string() const noexcept + { + return (m_type == value_t::string); + } + + /*! + @brief return whether value is discarded + + This function returns true if and only if the JSON value was discarded + during parsing with a callback function (see @ref parser_callback_t). + + @note This function will always be `false` for JSON values after parsing. + That is, discarded values can only occur during parsing, but will be + removed when inside a structured value or replaced by null in other cases. + + @return `true` if type is discarded, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_discarded()` for all JSON + types.,is_discarded} + + @since version 1.0.0 + */ + constexpr bool is_discarded() const noexcept + { + return (m_type == value_t::discarded); + } + + /*! + @brief return the type of the JSON value (implicit) + + Implicitly return the type of the JSON value as a value from the @ref + value_t enumeration. + + @return the type of the JSON value + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies the @ref value_t operator for + all JSON types.,operator__value_t} + + @sa @ref type() -- return the type of the JSON value (explicit) + @sa @ref type_name() -- return the type as string + + @since version 1.0.0 + */ + constexpr operator value_t() const noexcept + { + return m_type; + } + + /// @} + + private: + ////////////////// + // value access // + ////////////////// + + /// get a boolean (explicit) + boolean_t get_impl(boolean_t* /*unused*/) const + { + if (JSON_LIKELY(is_boolean())) + { + return m_value.boolean; + } + + JSON_THROW(type_error::create(302, "type must be boolean, but is " + std::string(type_name()))); + } + + /// get a pointer to the value (object) + object_t* get_impl_ptr(object_t* /*unused*/) noexcept + { + return is_object() ? m_value.object : nullptr; + } + + /// get a pointer to the value (object) + constexpr const object_t* get_impl_ptr(const object_t* /*unused*/) const noexcept + { + return is_object() ? m_value.object : nullptr; + } + + /// get a pointer to the value (array) + array_t* get_impl_ptr(array_t* /*unused*/) noexcept + { + return is_array() ? m_value.array : nullptr; + } + + /// get a pointer to the value (array) + constexpr const array_t* get_impl_ptr(const array_t* /*unused*/) const noexcept + { + return is_array() ? m_value.array : nullptr; + } + + /// get a pointer to the value (string) + string_t* get_impl_ptr(string_t* /*unused*/) noexcept + { + return is_string() ? m_value.string : nullptr; + } + + /// get a pointer to the value (string) + constexpr const string_t* get_impl_ptr(const string_t* /*unused*/) const noexcept + { + return is_string() ? m_value.string : nullptr; + } + + /// get a pointer to the value (boolean) + boolean_t* get_impl_ptr(boolean_t* /*unused*/) noexcept + { + return is_boolean() ? &m_value.boolean : nullptr; + } + + /// get a pointer to the value (boolean) + constexpr const boolean_t* get_impl_ptr(const boolean_t* /*unused*/) const noexcept + { + return is_boolean() ? &m_value.boolean : nullptr; + } + + /// get a pointer to the value (integer number) + number_integer_t* get_impl_ptr(number_integer_t* /*unused*/) noexcept + { + return is_number_integer() ? &m_value.number_integer : nullptr; + } + + /// get a pointer to the value (integer number) + constexpr const number_integer_t* get_impl_ptr(const number_integer_t* /*unused*/) const noexcept + { + return is_number_integer() ? &m_value.number_integer : nullptr; + } + + /// get a pointer to the value (unsigned number) + number_unsigned_t* get_impl_ptr(number_unsigned_t* /*unused*/) noexcept + { + return is_number_unsigned() ? &m_value.number_unsigned : nullptr; + } + + /// get a pointer to the value (unsigned number) + constexpr const number_unsigned_t* get_impl_ptr(const number_unsigned_t* /*unused*/) const noexcept + { + return is_number_unsigned() ? &m_value.number_unsigned : nullptr; + } + + /// get a pointer to the value (floating-point number) + number_float_t* get_impl_ptr(number_float_t* /*unused*/) noexcept + { + return is_number_float() ? &m_value.number_float : nullptr; + } + + /// get a pointer to the value (floating-point number) + constexpr const number_float_t* get_impl_ptr(const number_float_t* /*unused*/) const noexcept + { + return is_number_float() ? &m_value.number_float : nullptr; + } + + /*! + @brief helper function to implement get_ref() + + This function helps to implement get_ref() without code duplication for + const and non-const overloads + + @tparam ThisType will be deduced as `basic_json` or `const basic_json` + + @throw type_error.303 if ReferenceType does not match underlying value + type of the current JSON + */ + template + static ReferenceType get_ref_impl(ThisType& obj) + { + // delegate the call to get_ptr<>() + auto ptr = obj.template get_ptr::type>(); + + if (JSON_LIKELY(ptr != nullptr)) + { + return *ptr; + } + + JSON_THROW(type_error::create(303, "incompatible ReferenceType for get_ref, actual type is " + std::string(obj.type_name()))); + } + + public: + /// @name value access + /// Direct access to the stored value of a JSON value. + /// @{ + + /*! + @brief get special-case overload + + This overloads avoids a lot of template boilerplate, it can be seen as the + identity method + + @tparam BasicJsonType == @ref basic_json + + @return a copy of *this + + @complexity Constant. + + @since version 2.1.0 + */ + template < + typename BasicJsonType, + detail::enable_if_t::type, + basic_json_t>::value, + int> = 0 > + basic_json get() const + { + return *this; + } + + /*! + @brief get a value (explicit) + + Explicit type conversion between the JSON value and a compatible value + which is [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible) + and [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible). + The value is converted by calling the @ref json_serializer + `from_json()` method. + + The function is equivalent to executing + @code {.cpp} + ValueType ret; + JSONSerializer::from_json(*this, ret); + return ret; + @endcode + + This overloads is chosen if: + - @a ValueType is not @ref basic_json, + - @ref json_serializer has a `from_json()` method of the form + `void from_json(const basic_json&, ValueType&)`, and + - @ref json_serializer does not have a `from_json()` method of + the form `ValueType from_json(const basic_json&)` + + @tparam ValueTypeCV the provided value type + @tparam ValueType the returned value type + + @return copy of the JSON value, converted to @a ValueType + + @throw what @ref json_serializer `from_json()` method throws + + @liveexample{The example below shows several conversions from JSON values + to other types. There a few things to note: (1) Floating-point numbers can + be converted to integers\, (2) A JSON array can be converted to a standard + `std::vector`\, (3) A JSON object can be converted to C++ + associative containers such as `std::unordered_map`.,get__ValueType_const} + + @since version 2.1.0 + */ + template < + typename ValueTypeCV, + typename ValueType = detail::uncvref_t, + detail::enable_if_t < + not std::is_same::value and + detail::has_from_json::value and + not detail::has_non_default_from_json::value, + int > = 0 > + ValueType get() const noexcept(noexcept( + JSONSerializer::from_json(std::declval(), std::declval()))) + { + // we cannot static_assert on ValueTypeCV being non-const, because + // there is support for get(), which is why we + // still need the uncvref + static_assert(not std::is_reference::value, + "get() cannot be used with reference types, you might want to use get_ref()"); + static_assert(std::is_default_constructible::value, + "types must be DefaultConstructible when used with get()"); + + ValueType ret; + JSONSerializer::from_json(*this, ret); + return ret; + } + + /*! + @brief get a value (explicit); special case + + Explicit type conversion between the JSON value and a compatible value + which is **not** [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible) + and **not** [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible). + The value is converted by calling the @ref json_serializer + `from_json()` method. + + The function is equivalent to executing + @code {.cpp} + return JSONSerializer::from_json(*this); + @endcode + + This overloads is chosen if: + - @a ValueType is not @ref basic_json and + - @ref json_serializer has a `from_json()` method of the form + `ValueType from_json(const basic_json&)` + + @note If @ref json_serializer has both overloads of + `from_json()`, this one is chosen. + + @tparam ValueTypeCV the provided value type + @tparam ValueType the returned value type + + @return copy of the JSON value, converted to @a ValueType + + @throw what @ref json_serializer `from_json()` method throws + + @since version 2.1.0 + */ + template < + typename ValueTypeCV, + typename ValueType = detail::uncvref_t, + detail::enable_if_t::value and + detail::has_non_default_from_json::value, int> = 0 > + ValueType get() const noexcept(noexcept( + JSONSerializer::from_json(std::declval()))) + { + static_assert(not std::is_reference::value, + "get() cannot be used with reference types, you might want to use get_ref()"); + return JSONSerializer::from_json(*this); + } + + /*! + @brief get a pointer value (explicit) + + Explicit pointer access to the internally stored JSON value. No copies are + made. + + @warning The pointer becomes invalid if the underlying JSON object + changes. + + @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref + object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, + @ref number_unsigned_t, or @ref number_float_t. + + @return pointer to the internally stored JSON value if the requested + pointer type @a PointerType fits to the JSON value; `nullptr` otherwise + + @complexity Constant. + + @liveexample{The example below shows how pointers to internal values of a + JSON value can be requested. Note that no type conversions are made and a + `nullptr` is returned if the value and the requested pointer type does not + match.,get__PointerType} + + @sa @ref get_ptr() for explicit pointer-member access + + @since version 1.0.0 + */ + template::value, int>::type = 0> + PointerType get() noexcept + { + // delegate the call to get_ptr + return get_ptr(); + } + + /*! + @brief get a pointer value (explicit) + @copydoc get() + */ + template::value, int>::type = 0> + constexpr const PointerType get() const noexcept + { + // delegate the call to get_ptr + return get_ptr(); + } + + /*! + @brief get a pointer value (implicit) + + Implicit pointer access to the internally stored JSON value. No copies are + made. + + @warning Writing data to the pointee of the result yields an undefined + state. + + @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref + object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, + @ref number_unsigned_t, or @ref number_float_t. Enforced by a static + assertion. + + @return pointer to the internally stored JSON value if the requested + pointer type @a PointerType fits to the JSON value; `nullptr` otherwise + + @complexity Constant. + + @liveexample{The example below shows how pointers to internal values of a + JSON value can be requested. Note that no type conversions are made and a + `nullptr` is returned if the value and the requested pointer type does not + match.,get_ptr} + + @since version 1.0.0 + */ + template::value, int>::type = 0> + PointerType get_ptr() noexcept + { + // get the type of the PointerType (remove pointer and const) + using pointee_t = typename std::remove_const::type>::type>::type; + // make sure the type matches the allowed types + static_assert( + std::is_same::value + or std::is_same::value + or std::is_same::value + or std::is_same::value + or std::is_same::value + or std::is_same::value + or std::is_same::value + , "incompatible pointer type"); + + // delegate the call to get_impl_ptr<>() + return get_impl_ptr(static_cast(nullptr)); + } + + /*! + @brief get a pointer value (implicit) + @copydoc get_ptr() + */ + template::value and + std::is_const::type>::value, int>::type = 0> + constexpr const PointerType get_ptr() const noexcept + { + // get the type of the PointerType (remove pointer and const) + using pointee_t = typename std::remove_const::type>::type>::type; + // make sure the type matches the allowed types + static_assert( + std::is_same::value + or std::is_same::value + or std::is_same::value + or std::is_same::value + or std::is_same::value + or std::is_same::value + or std::is_same::value + , "incompatible pointer type"); + + // delegate the call to get_impl_ptr<>() const + return get_impl_ptr(static_cast(nullptr)); + } + + /*! + @brief get a reference value (implicit) + + Implicit reference access to the internally stored JSON value. No copies + are made. + + @warning Writing data to the referee of the result yields an undefined + state. + + @tparam ReferenceType reference type; must be a reference to @ref array_t, + @ref object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or + @ref number_float_t. Enforced by static assertion. + + @return reference to the internally stored JSON value if the requested + reference type @a ReferenceType fits to the JSON value; throws + type_error.303 otherwise + + @throw type_error.303 in case passed type @a ReferenceType is incompatible + with the stored JSON value; see example below + + @complexity Constant. + + @liveexample{The example shows several calls to `get_ref()`.,get_ref} + + @since version 1.1.0 + */ + template::value, int>::type = 0> + ReferenceType get_ref() + { + // delegate call to get_ref_impl + return get_ref_impl(*this); + } + + /*! + @brief get a reference value (implicit) + @copydoc get_ref() + */ + template::value and + std::is_const::type>::value, int>::type = 0> + ReferenceType get_ref() const + { + // delegate call to get_ref_impl + return get_ref_impl(*this); + } + + /*! + @brief get a value (implicit) + + Implicit type conversion between the JSON value and a compatible value. + The call is realized by calling @ref get() const. + + @tparam ValueType non-pointer type compatible to the JSON value, for + instance `int` for JSON integer numbers, `bool` for JSON booleans, or + `std::vector` types for JSON arrays. The character type of @ref string_t + as well as an initializer list of this type is excluded to avoid + ambiguities as these types implicitly convert to `std::string`. + + @return copy of the JSON value, converted to type @a ValueType + + @throw type_error.302 in case passed type @a ValueType is incompatible + to the JSON value type (e.g., the JSON value is of type boolean, but a + string is requested); see example below + + @complexity Linear in the size of the JSON value. + + @liveexample{The example below shows several conversions from JSON values + to other types. There a few things to note: (1) Floating-point numbers can + be converted to integers\, (2) A JSON array can be converted to a standard + `std::vector`\, (3) A JSON object can be converted to C++ + associative containers such as `std::unordered_map`.,operator__ValueType} + + @since version 1.0.0 + */ + template < typename ValueType, typename std::enable_if < + not std::is_pointer::value and + not std::is_same>::value and + not std::is_same::value +#ifndef _MSC_VER // fix for issue #167 operator<< ambiguity under VS2015 + and not std::is_same>::value +#endif +#if defined(JSON_HAS_CPP_17) + and not std::is_same::value +#endif + , int >::type = 0 > + operator ValueType() const + { + // delegate the call to get<>() const + return get(); + } + + /// @} + + + //////////////////// + // element access // + //////////////////// + + /// @name element access + /// Access to the JSON value. + /// @{ + + /*! + @brief access specified array element with bounds checking + + Returns a reference to the element at specified location @a idx, with + bounds checking. + + @param[in] idx index of the element to access + + @return reference to the element at index @a idx + + @throw type_error.304 if the JSON value is not an array; in this case, + calling `at` with an index makes no sense. See example below. + @throw out_of_range.401 if the index @a idx is out of range of the array; + that is, `idx >= size()`. See example below. + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. + + @complexity Constant. + + @since version 1.0.0 + + @liveexample{The example below shows how array elements can be read and + written using `at()`. It also demonstrates the different exceptions that + can be thrown.,at__size_type} + */ + reference at(size_type idx) + { + // at only works for arrays + if (JSON_LIKELY(is_array())) + { + JSON_TRY + { + return m_value.array->at(idx); + } + JSON_CATCH (std::out_of_range&) + { + // create better exception explanation + JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range")); + } + } + else + { + JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name()))); + } + } + + /*! + @brief access specified array element with bounds checking + + Returns a const reference to the element at specified location @a idx, + with bounds checking. + + @param[in] idx index of the element to access + + @return const reference to the element at index @a idx + + @throw type_error.304 if the JSON value is not an array; in this case, + calling `at` with an index makes no sense. See example below. + @throw out_of_range.401 if the index @a idx is out of range of the array; + that is, `idx >= size()`. See example below. + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. + + @complexity Constant. + + @since version 1.0.0 + + @liveexample{The example below shows how array elements can be read using + `at()`. It also demonstrates the different exceptions that can be thrown., + at__size_type_const} + */ + const_reference at(size_type idx) const + { + // at only works for arrays + if (JSON_LIKELY(is_array())) + { + JSON_TRY + { + return m_value.array->at(idx); + } + JSON_CATCH (std::out_of_range&) + { + // create better exception explanation + JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range")); + } + } + else + { + JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name()))); + } + } + + /*! + @brief access specified object element with bounds checking + + Returns a reference to the element at with specified key @a key, with + bounds checking. + + @param[in] key key of the element to access + + @return reference to the element at key @a key + + @throw type_error.304 if the JSON value is not an object; in this case, + calling `at` with a key makes no sense. See example below. + @throw out_of_range.403 if the key @a key is is not stored in the object; + that is, `find(key) == end()`. See example below. + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. + + @complexity Logarithmic in the size of the container. + + @sa @ref operator[](const typename object_t::key_type&) for unchecked + access by reference + @sa @ref value() for access by value with a default value + + @since version 1.0.0 + + @liveexample{The example below shows how object elements can be read and + written using `at()`. It also demonstrates the different exceptions that + can be thrown.,at__object_t_key_type} + */ + reference at(const typename object_t::key_type& key) + { + // at only works for objects + if (JSON_LIKELY(is_object())) + { + JSON_TRY + { + return m_value.object->at(key); + } + JSON_CATCH (std::out_of_range&) + { + // create better exception explanation + JSON_THROW(out_of_range::create(403, "key '" + key + "' not found")); + } + } + else + { + JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name()))); + } + } + + /*! + @brief access specified object element with bounds checking + + Returns a const reference to the element at with specified key @a key, + with bounds checking. + + @param[in] key key of the element to access + + @return const reference to the element at key @a key + + @throw type_error.304 if the JSON value is not an object; in this case, + calling `at` with a key makes no sense. See example below. + @throw out_of_range.403 if the key @a key is is not stored in the object; + that is, `find(key) == end()`. See example below. + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. + + @complexity Logarithmic in the size of the container. + + @sa @ref operator[](const typename object_t::key_type&) for unchecked + access by reference + @sa @ref value() for access by value with a default value + + @since version 1.0.0 + + @liveexample{The example below shows how object elements can be read using + `at()`. It also demonstrates the different exceptions that can be thrown., + at__object_t_key_type_const} + */ + const_reference at(const typename object_t::key_type& key) const + { + // at only works for objects + if (JSON_LIKELY(is_object())) + { + JSON_TRY + { + return m_value.object->at(key); + } + JSON_CATCH (std::out_of_range&) + { + // create better exception explanation + JSON_THROW(out_of_range::create(403, "key '" + key + "' not found")); + } + } + else + { + JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name()))); + } + } + + /*! + @brief access specified array element + + Returns a reference to the element at specified location @a idx. + + @note If @a idx is beyond the range of the array (i.e., `idx >= size()`), + then the array is silently filled up with `null` values to make `idx` a + valid reference to the last stored element. + + @param[in] idx index of the element to access + + @return reference to the element at index @a idx + + @throw type_error.305 if the JSON value is not an array or null; in that + cases, using the [] operator with an index makes no sense. + + @complexity Constant if @a idx is in the range of the array. Otherwise + linear in `idx - size()`. + + @liveexample{The example below shows how array elements can be read and + written using `[]` operator. Note the addition of `null` + values.,operatorarray__size_type} + + @since version 1.0.0 + */ + reference operator[](size_type idx) + { + // implicitly convert null value to an empty array + if (is_null()) + { + m_type = value_t::array; + m_value.array = create(); + assert_invariant(); + } + + // operator[] only works for arrays + if (JSON_LIKELY(is_array())) + { + // fill up array with null values if given idx is outside range + if (idx >= m_value.array->size()) + { + m_value.array->insert(m_value.array->end(), + idx - m_value.array->size() + 1, + basic_json()); + } + + return m_value.array->operator[](idx); + } + + JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name()))); + } + + /*! + @brief access specified array element + + Returns a const reference to the element at specified location @a idx. + + @param[in] idx index of the element to access + + @return const reference to the element at index @a idx + + @throw type_error.305 if the JSON value is not an array; in that cases, + using the [] operator with an index makes no sense. + + @complexity Constant. + + @liveexample{The example below shows how array elements can be read using + the `[]` operator.,operatorarray__size_type_const} + + @since version 1.0.0 + */ + const_reference operator[](size_type idx) const + { + // const operator[] only works for arrays + if (JSON_LIKELY(is_array())) + { + return m_value.array->operator[](idx); + } + + JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name()))); + } + + /*! + @brief access specified object element + + Returns a reference to the element at with specified key @a key. + + @note If @a key is not found in the object, then it is silently added to + the object and filled with a `null` value to make `key` a valid reference. + In case the value was `null` before, it is converted to an object. + + @param[in] key key of the element to access + + @return reference to the element at key @a key + + @throw type_error.305 if the JSON value is not an object or null; in that + cases, using the [] operator with a key makes no sense. + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be read and + written using the `[]` operator.,operatorarray__key_type} + + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref value() for access by value with a default value + + @since version 1.0.0 + */ + reference operator[](const typename object_t::key_type& key) + { + // implicitly convert null value to an empty object + if (is_null()) + { + m_type = value_t::object; + m_value.object = create(); + assert_invariant(); + } + + // operator[] only works for objects + if (JSON_LIKELY(is_object())) + { + return m_value.object->operator[](key); + } + + JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name()))); + } + + /*! + @brief read-only access specified object element + + Returns a const reference to the element at with specified key @a key. No + bounds checking is performed. + + @warning If the element with key @a key does not exist, the behavior is + undefined. + + @param[in] key key of the element to access + + @return const reference to the element at key @a key + + @pre The element with key @a key must exist. **This precondition is + enforced with an assertion.** + + @throw type_error.305 if the JSON value is not an object; in that cases, + using the [] operator with a key makes no sense. + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be read using + the `[]` operator.,operatorarray__key_type_const} + + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref value() for access by value with a default value + + @since version 1.0.0 + */ + const_reference operator[](const typename object_t::key_type& key) const + { + // const operator[] only works for objects + if (JSON_LIKELY(is_object())) + { + assert(m_value.object->find(key) != m_value.object->end()); + return m_value.object->find(key)->second; + } + + JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name()))); + } + + /*! + @brief access specified object element + + Returns a reference to the element at with specified key @a key. + + @note If @a key is not found in the object, then it is silently added to + the object and filled with a `null` value to make `key` a valid reference. + In case the value was `null` before, it is converted to an object. + + @param[in] key key of the element to access + + @return reference to the element at key @a key + + @throw type_error.305 if the JSON value is not an object or null; in that + cases, using the [] operator with a key makes no sense. + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be read and + written using the `[]` operator.,operatorarray__key_type} + + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref value() for access by value with a default value + + @since version 1.1.0 + */ + template + reference operator[](T* key) + { + // implicitly convert null to object + if (is_null()) + { + m_type = value_t::object; + m_value = value_t::object; + assert_invariant(); + } + + // at only works for objects + if (JSON_LIKELY(is_object())) + { + return m_value.object->operator[](key); + } + + JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name()))); + } + + /*! + @brief read-only access specified object element + + Returns a const reference to the element at with specified key @a key. No + bounds checking is performed. + + @warning If the element with key @a key does not exist, the behavior is + undefined. + + @param[in] key key of the element to access + + @return const reference to the element at key @a key + + @pre The element with key @a key must exist. **This precondition is + enforced with an assertion.** + + @throw type_error.305 if the JSON value is not an object; in that cases, + using the [] operator with a key makes no sense. + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be read using + the `[]` operator.,operatorarray__key_type_const} + + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref value() for access by value with a default value + + @since version 1.1.0 + */ + template + const_reference operator[](T* key) const + { + // at only works for objects + if (JSON_LIKELY(is_object())) + { + assert(m_value.object->find(key) != m_value.object->end()); + return m_value.object->find(key)->second; + } + + JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name()))); + } + + /*! + @brief access specified object element with default value + + Returns either a copy of an object's element at the specified key @a key + or a given default value if no element with key @a key exists. + + The function is basically equivalent to executing + @code {.cpp} + try { + return at(key); + } catch(out_of_range) { + return default_value; + } + @endcode + + @note Unlike @ref at(const typename object_t::key_type&), this function + does not throw if the given key @a key was not found. + + @note Unlike @ref operator[](const typename object_t::key_type& key), this + function does not implicitly add an element to the position defined by @a + key. This function is furthermore also applicable to const objects. + + @param[in] key key of the element to access + @param[in] default_value the value to return if @a key is not found + + @tparam ValueType type compatible to JSON values, for instance `int` for + JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for + JSON arrays. Note the type of the expected value at @a key and the default + value @a default_value must be compatible. + + @return copy of the element at key @a key or @a default_value if @a key + is not found + + @throw type_error.306 if the JSON value is not an objec; in that cases, + using `value()` with a key makes no sense. + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be queried + with a default value.,basic_json__value} + + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref operator[](const typename object_t::key_type&) for unchecked + access by reference + + @since version 1.0.0 + */ + template::value, int>::type = 0> + ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const + { + // at only works for objects + if (JSON_LIKELY(is_object())) + { + // if key is found, return value and given default value otherwise + const auto it = find(key); + if (it != end()) + { + return *it; + } + + return default_value; + } + + JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name()))); + } + + /*! + @brief overload for a default value of type const char* + @copydoc basic_json::value(const typename object_t::key_type&, ValueType) const + */ + string_t value(const typename object_t::key_type& key, const char* default_value) const + { + return value(key, string_t(default_value)); + } + + /*! + @brief access specified object element via JSON Pointer with default value + + Returns either a copy of an object's element at the specified key @a key + or a given default value if no element with key @a key exists. + + The function is basically equivalent to executing + @code {.cpp} + try { + return at(ptr); + } catch(out_of_range) { + return default_value; + } + @endcode + + @note Unlike @ref at(const json_pointer&), this function does not throw + if the given key @a key was not found. + + @param[in] ptr a JSON pointer to the element to access + @param[in] default_value the value to return if @a ptr found no value + + @tparam ValueType type compatible to JSON values, for instance `int` for + JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for + JSON arrays. Note the type of the expected value at @a key and the default + value @a default_value must be compatible. + + @return copy of the element at key @a key or @a default_value if @a key + is not found + + @throw type_error.306 if the JSON value is not an objec; in that cases, + using `value()` with a key makes no sense. + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be queried + with a default value.,basic_json__value_ptr} + + @sa @ref operator[](const json_pointer&) for unchecked access by reference + + @since version 2.0.2 + */ + template::value, int>::type = 0> + ValueType value(const json_pointer& ptr, const ValueType& default_value) const + { + // at only works for objects + if (JSON_LIKELY(is_object())) + { + // if pointer resolves a value, return it or use default value + JSON_TRY + { + return ptr.get_checked(this); + } + JSON_CATCH (out_of_range&) + { + return default_value; + } + } + + JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name()))); + } + + /*! + @brief overload for a default value of type const char* + @copydoc basic_json::value(const json_pointer&, ValueType) const + */ + string_t value(const json_pointer& ptr, const char* default_value) const + { + return value(ptr, string_t(default_value)); + } + + /*! + @brief access the first element + + Returns a reference to the first element in the container. For a JSON + container `c`, the expression `c.front()` is equivalent to `*c.begin()`. + + @return In case of a structured type (array or object), a reference to the + first element is returned. In case of number, string, or boolean values, a + reference to the value is returned. + + @complexity Constant. + + @pre The JSON value must not be `null` (would throw `std::out_of_range`) + or an empty array or object (undefined behavior, **guarded by + assertions**). + @post The JSON value remains unchanged. + + @throw invalid_iterator.214 when called on `null` value + + @liveexample{The following code shows an example for `front()`.,front} + + @sa @ref back() -- access the last element + + @since version 1.0.0 + */ + reference front() + { + return *begin(); + } + + /*! + @copydoc basic_json::front() + */ + const_reference front() const + { + return *cbegin(); + } + + /*! + @brief access the last element + + Returns a reference to the last element in the container. For a JSON + container `c`, the expression `c.back()` is equivalent to + @code {.cpp} + auto tmp = c.end(); + --tmp; + return *tmp; + @endcode + + @return In case of a structured type (array or object), a reference to the + last element is returned. In case of number, string, or boolean values, a + reference to the value is returned. + + @complexity Constant. + + @pre The JSON value must not be `null` (would throw `std::out_of_range`) + or an empty array or object (undefined behavior, **guarded by + assertions**). + @post The JSON value remains unchanged. + + @throw invalid_iterator.214 when called on a `null` value. See example + below. + + @liveexample{The following code shows an example for `back()`.,back} + + @sa @ref front() -- access the first element + + @since version 1.0.0 + */ + reference back() + { + auto tmp = end(); + --tmp; + return *tmp; + } + + /*! + @copydoc basic_json::back() + */ + const_reference back() const + { + auto tmp = cend(); + --tmp; + return *tmp; + } + + /*! + @brief remove element given an iterator + + Removes the element specified by iterator @a pos. The iterator @a pos must + be valid and dereferenceable. Thus the `end()` iterator (which is valid, + but is not dereferenceable) cannot be used as a value for @a pos. + + If called on a primitive type other than `null`, the resulting JSON value + will be `null`. + + @param[in] pos iterator to the element to remove + @return Iterator following the last removed element. If the iterator @a + pos refers to the last element, the `end()` iterator is returned. + + @tparam IteratorType an @ref iterator or @ref const_iterator + + @post Invalidates iterators and references at or after the point of the + erase, including the `end()` iterator. + + @throw type_error.307 if called on a `null` value; example: `"cannot use + erase() with null"` + @throw invalid_iterator.202 if called on an iterator which does not belong + to the current JSON value; example: `"iterator does not fit current + value"` + @throw invalid_iterator.205 if called on a primitive type with invalid + iterator (i.e., any iterator which is not `begin()`); example: `"iterator + out of range"` + + @complexity The complexity depends on the type: + - objects: amortized constant + - arrays: linear in distance between @a pos and the end of the container + - strings: linear in the length of the string + - other types: constant + + @liveexample{The example shows the result of `erase()` for different JSON + types.,erase__IteratorType} + + @sa @ref erase(IteratorType, IteratorType) -- removes the elements in + the given range + @sa @ref erase(const typename object_t::key_type&) -- removes the element + from an object at the given key + @sa @ref erase(const size_type) -- removes the element from an array at + the given index + + @since version 1.0.0 + */ + template::value or + std::is_same::value, int>::type + = 0> + IteratorType erase(IteratorType pos) + { + // make sure iterator fits the current value + if (JSON_UNLIKELY(this != pos.m_object)) + { + JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); + } + + IteratorType result = end(); + + switch (m_type) + { + case value_t::boolean: + case value_t::number_float: + case value_t::number_integer: + case value_t::number_unsigned: + case value_t::string: + { + if (JSON_UNLIKELY(not pos.m_it.primitive_iterator.is_begin())) + { + JSON_THROW(invalid_iterator::create(205, "iterator out of range")); + } + + if (is_string()) + { + AllocatorType alloc; + alloc.destroy(m_value.string); + alloc.deallocate(m_value.string, 1); + m_value.string = nullptr; + } + + m_type = value_t::null; + assert_invariant(); + break; + } + + case value_t::object: + { + result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator); + break; + } + + case value_t::array: + { + result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator); + break; + } + + default: + JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name()))); + } + + return result; + } + + /*! + @brief remove elements given an iterator range + + Removes the element specified by the range `[first; last)`. The iterator + @a first does not need to be dereferenceable if `first == last`: erasing + an empty range is a no-op. + + If called on a primitive type other than `null`, the resulting JSON value + will be `null`. + + @param[in] first iterator to the beginning of the range to remove + @param[in] last iterator past the end of the range to remove + @return Iterator following the last removed element. If the iterator @a + second refers to the last element, the `end()` iterator is returned. + + @tparam IteratorType an @ref iterator or @ref const_iterator + + @post Invalidates iterators and references at or after the point of the + erase, including the `end()` iterator. + + @throw type_error.307 if called on a `null` value; example: `"cannot use + erase() with null"` + @throw invalid_iterator.203 if called on iterators which does not belong + to the current JSON value; example: `"iterators do not fit current value"` + @throw invalid_iterator.204 if called on a primitive type with invalid + iterators (i.e., if `first != begin()` and `last != end()`); example: + `"iterators out of range"` + + @complexity The complexity depends on the type: + - objects: `log(size()) + std::distance(first, last)` + - arrays: linear in the distance between @a first and @a last, plus linear + in the distance between @a last and end of the container + - strings: linear in the length of the string + - other types: constant + + @liveexample{The example shows the result of `erase()` for different JSON + types.,erase__IteratorType_IteratorType} + + @sa @ref erase(IteratorType) -- removes the element at a given position + @sa @ref erase(const typename object_t::key_type&) -- removes the element + from an object at the given key + @sa @ref erase(const size_type) -- removes the element from an array at + the given index + + @since version 1.0.0 + */ + template::value or + std::is_same::value, int>::type + = 0> + IteratorType erase(IteratorType first, IteratorType last) + { + // make sure iterator fits the current value + if (JSON_UNLIKELY(this != first.m_object or this != last.m_object)) + { + JSON_THROW(invalid_iterator::create(203, "iterators do not fit current value")); + } + + IteratorType result = end(); + + switch (m_type) + { + case value_t::boolean: + case value_t::number_float: + case value_t::number_integer: + case value_t::number_unsigned: + case value_t::string: + { + if (JSON_LIKELY(not first.m_it.primitive_iterator.is_begin() + or not last.m_it.primitive_iterator.is_end())) + { + JSON_THROW(invalid_iterator::create(204, "iterators out of range")); + } + + if (is_string()) + { + AllocatorType alloc; + alloc.destroy(m_value.string); + alloc.deallocate(m_value.string, 1); + m_value.string = nullptr; + } + + m_type = value_t::null; + assert_invariant(); + break; + } + + case value_t::object: + { + result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator, + last.m_it.object_iterator); + break; + } + + case value_t::array: + { + result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator, + last.m_it.array_iterator); + break; + } + + default: + JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name()))); + } + + return result; + } + + /*! + @brief remove element from a JSON object given a key + + Removes elements from a JSON object with the key value @a key. + + @param[in] key value of the elements to remove + + @return Number of elements removed. If @a ObjectType is the default + `std::map` type, the return value will always be `0` (@a key was not + found) or `1` (@a key was found). + + @post References and iterators to the erased elements are invalidated. + Other references and iterators are not affected. + + @throw type_error.307 when called on a type other than JSON object; + example: `"cannot use erase() with null"` + + @complexity `log(size()) + count(key)` + + @liveexample{The example shows the effect of `erase()`.,erase__key_type} + + @sa @ref erase(IteratorType) -- removes the element at a given position + @sa @ref erase(IteratorType, IteratorType) -- removes the elements in + the given range + @sa @ref erase(const size_type) -- removes the element from an array at + the given index + + @since version 1.0.0 + */ + size_type erase(const typename object_t::key_type& key) + { + // this erase only works for objects + if (JSON_LIKELY(is_object())) + { + return m_value.object->erase(key); + } + + JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name()))); + } + + /*! + @brief remove element from a JSON array given an index + + Removes element from a JSON array at the index @a idx. + + @param[in] idx index of the element to remove + + @throw type_error.307 when called on a type other than JSON object; + example: `"cannot use erase() with null"` + @throw out_of_range.401 when `idx >= size()`; example: `"array index 17 + is out of range"` + + @complexity Linear in distance between @a idx and the end of the container. + + @liveexample{The example shows the effect of `erase()`.,erase__size_type} + + @sa @ref erase(IteratorType) -- removes the element at a given position + @sa @ref erase(IteratorType, IteratorType) -- removes the elements in + the given range + @sa @ref erase(const typename object_t::key_type&) -- removes the element + from an object at the given key + + @since version 1.0.0 + */ + void erase(const size_type idx) + { + // this erase only works for arrays + if (JSON_LIKELY(is_array())) + { + if (JSON_UNLIKELY(idx >= size())) + { + JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range")); + } + + m_value.array->erase(m_value.array->begin() + static_cast(idx)); + } + else + { + JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name()))); + } + } + + /// @} + + + //////////// + // lookup // + //////////// + + /// @name lookup + /// @{ + + /*! + @brief find an element in a JSON object + + Finds an element in a JSON object with key equivalent to @a key. If the + element is not found or the JSON value is not an object, end() is + returned. + + @note This method always returns @ref end() when executed on a JSON type + that is not an object. + + @param[in] key key value of the element to search for. + + @return Iterator to an element with key equivalent to @a key. If no such + element is found or the JSON value is not an object, past-the-end (see + @ref end()) iterator is returned. + + @complexity Logarithmic in the size of the JSON object. + + @liveexample{The example shows how `find()` is used.,find__key_type} + + @since version 1.0.0 + */ + template + iterator find(KeyT&& key) + { + auto result = end(); + + if (is_object()) + { + result.m_it.object_iterator = m_value.object->find(std::forward(key)); + } + + return result; + } + + /*! + @brief find an element in a JSON object + @copydoc find(KeyT&&) + */ + template + const_iterator find(KeyT&& key) const + { + auto result = cend(); + + if (is_object()) + { + result.m_it.object_iterator = m_value.object->find(std::forward(key)); + } + + return result; + } + + /*! + @brief returns the number of occurrences of a key in a JSON object + + Returns the number of elements with key @a key. If ObjectType is the + default `std::map` type, the return value will always be `0` (@a key was + not found) or `1` (@a key was found). + + @note This method always returns `0` when executed on a JSON type that is + not an object. + + @param[in] key key value of the element to count + + @return Number of elements with key @a key. If the JSON value is not an + object, the return value will be `0`. + + @complexity Logarithmic in the size of the JSON object. + + @liveexample{The example shows how `count()` is used.,count} + + @since version 1.0.0 + */ + template + size_type count(KeyT&& key) const + { + // return 0 for all nonobject types + return is_object() ? m_value.object->count(std::forward(key)) : 0; + } + + /// @} + + + /////////////// + // iterators // + /////////////// + + /// @name iterators + /// @{ + + /*! + @brief returns an iterator to the first element + + Returns an iterator to the first element. + + @image html range-begin-end.svg "Illustration from cppreference.com" + + @return iterator to the first element + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + + @liveexample{The following code shows an example for `begin()`.,begin} + + @sa @ref cbegin() -- returns a const iterator to the beginning + @sa @ref end() -- returns an iterator to the end + @sa @ref cend() -- returns a const iterator to the end + + @since version 1.0.0 + */ + iterator begin() noexcept + { + iterator result(this); + result.set_begin(); + return result; + } + + /*! + @copydoc basic_json::cbegin() + */ + const_iterator begin() const noexcept + { + return cbegin(); + } + + /*! + @brief returns a const iterator to the first element + + Returns a const iterator to the first element. + + @image html range-begin-end.svg "Illustration from cppreference.com" + + @return const iterator to the first element + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + - Has the semantics of `const_cast(*this).begin()`. + + @liveexample{The following code shows an example for `cbegin()`.,cbegin} + + @sa @ref begin() -- returns an iterator to the beginning + @sa @ref end() -- returns an iterator to the end + @sa @ref cend() -- returns a const iterator to the end + + @since version 1.0.0 + */ + const_iterator cbegin() const noexcept + { + const_iterator result(this); + result.set_begin(); + return result; + } + + /*! + @brief returns an iterator to one past the last element + + Returns an iterator to one past the last element. + + @image html range-begin-end.svg "Illustration from cppreference.com" + + @return iterator one past the last element + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + + @liveexample{The following code shows an example for `end()`.,end} + + @sa @ref cend() -- returns a const iterator to the end + @sa @ref begin() -- returns an iterator to the beginning + @sa @ref cbegin() -- returns a const iterator to the beginning + + @since version 1.0.0 + */ + iterator end() noexcept + { + iterator result(this); + result.set_end(); + return result; + } + + /*! + @copydoc basic_json::cend() + */ + const_iterator end() const noexcept + { + return cend(); + } + + /*! + @brief returns a const iterator to one past the last element + + Returns a const iterator to one past the last element. + + @image html range-begin-end.svg "Illustration from cppreference.com" + + @return const iterator one past the last element + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + - Has the semantics of `const_cast(*this).end()`. + + @liveexample{The following code shows an example for `cend()`.,cend} + + @sa @ref end() -- returns an iterator to the end + @sa @ref begin() -- returns an iterator to the beginning + @sa @ref cbegin() -- returns a const iterator to the beginning + + @since version 1.0.0 + */ + const_iterator cend() const noexcept + { + const_iterator result(this); + result.set_end(); + return result; + } + + /*! + @brief returns an iterator to the reverse-beginning + + Returns an iterator to the reverse-beginning; that is, the last element. + + @image html range-rbegin-rend.svg "Illustration from cppreference.com" + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) + requirements: + - The complexity is constant. + - Has the semantics of `reverse_iterator(end())`. + + @liveexample{The following code shows an example for `rbegin()`.,rbegin} + + @sa @ref crbegin() -- returns a const reverse iterator to the beginning + @sa @ref rend() -- returns a reverse iterator to the end + @sa @ref crend() -- returns a const reverse iterator to the end + + @since version 1.0.0 + */ + reverse_iterator rbegin() noexcept + { + return reverse_iterator(end()); + } + + /*! + @copydoc basic_json::crbegin() + */ + const_reverse_iterator rbegin() const noexcept + { + return crbegin(); + } + + /*! + @brief returns an iterator to the reverse-end + + Returns an iterator to the reverse-end; that is, one before the first + element. + + @image html range-rbegin-rend.svg "Illustration from cppreference.com" + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) + requirements: + - The complexity is constant. + - Has the semantics of `reverse_iterator(begin())`. + + @liveexample{The following code shows an example for `rend()`.,rend} + + @sa @ref crend() -- returns a const reverse iterator to the end + @sa @ref rbegin() -- returns a reverse iterator to the beginning + @sa @ref crbegin() -- returns a const reverse iterator to the beginning + + @since version 1.0.0 + */ + reverse_iterator rend() noexcept + { + return reverse_iterator(begin()); + } + + /*! + @copydoc basic_json::crend() + */ + const_reverse_iterator rend() const noexcept + { + return crend(); + } + + /*! + @brief returns a const reverse iterator to the last element + + Returns a const iterator to the reverse-beginning; that is, the last + element. + + @image html range-rbegin-rend.svg "Illustration from cppreference.com" + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) + requirements: + - The complexity is constant. + - Has the semantics of `const_cast(*this).rbegin()`. + + @liveexample{The following code shows an example for `crbegin()`.,crbegin} + + @sa @ref rbegin() -- returns a reverse iterator to the beginning + @sa @ref rend() -- returns a reverse iterator to the end + @sa @ref crend() -- returns a const reverse iterator to the end + + @since version 1.0.0 + */ + const_reverse_iterator crbegin() const noexcept + { + return const_reverse_iterator(cend()); + } + + /*! + @brief returns a const reverse iterator to one before the first + + Returns a const reverse iterator to the reverse-end; that is, one before + the first element. + + @image html range-rbegin-rend.svg "Illustration from cppreference.com" + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) + requirements: + - The complexity is constant. + - Has the semantics of `const_cast(*this).rend()`. + + @liveexample{The following code shows an example for `crend()`.,crend} + + @sa @ref rend() -- returns a reverse iterator to the end + @sa @ref rbegin() -- returns a reverse iterator to the beginning + @sa @ref crbegin() -- returns a const reverse iterator to the beginning + + @since version 1.0.0 + */ + const_reverse_iterator crend() const noexcept + { + return const_reverse_iterator(cbegin()); + } + + public: + /*! + @brief wrapper to access iterator member functions in range-based for + + This function allows to access @ref iterator::key() and @ref + iterator::value() during range-based for loops. In these loops, a + reference to the JSON values is returned, so there is no access to the + underlying iterator. + + @liveexample{The following code shows how the wrapper is used,iterator_wrapper} + + @note The name of this function is not yet final and may change in the + future. + */ + static iteration_proxy iterator_wrapper(reference cont) + { + return iteration_proxy(cont); + } + + /*! + @copydoc iterator_wrapper(reference) + */ + static iteration_proxy iterator_wrapper(const_reference cont) + { + return iteration_proxy(cont); + } + + /// @} + + + ////////////// + // capacity // + ////////////// + + /// @name capacity + /// @{ + + /*! + @brief checks whether the container is empty. + + Checks if a JSON value has no elements (i.e. whether its @ref size is `0`). + + @return The return value depends on the different types and is + defined as follows: + Value type | return value + ----------- | ------------- + null | `true` + boolean | `false` + string | `false` + number | `false` + object | result of function `object_t::empty()` + array | result of function `array_t::empty()` + + @liveexample{The following code uses `empty()` to check if a JSON + object contains any elements.,empty} + + @complexity Constant, as long as @ref array_t and @ref object_t satisfy + the Container concept; that is, their `empty()` functions have constant + complexity. + + @iterators No changes. + + @exceptionsafety No-throw guarantee: this function never throws exceptions. + + @note This function does not return whether a string stored as JSON value + is empty - it returns whether the JSON container itself is empty which is + false in the case of a string. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + - Has the semantics of `begin() == end()`. + + @sa @ref size() -- returns the number of elements + + @since version 1.0.0 + */ + bool empty() const noexcept + { + switch (m_type) + { + case value_t::null: + { + // null values are empty + return true; + } + + case value_t::array: + { + // delegate call to array_t::empty() + return m_value.array->empty(); + } + + case value_t::object: + { + // delegate call to object_t::empty() + return m_value.object->empty(); + } + + default: + { + // all other types are nonempty + return false; + } + } + } + + /*! + @brief returns the number of elements + + Returns the number of elements in a JSON value. + + @return The return value depends on the different types and is + defined as follows: + Value type | return value + ----------- | ------------- + null | `0` + boolean | `1` + string | `1` + number | `1` + object | result of function object_t::size() + array | result of function array_t::size() + + @liveexample{The following code calls `size()` on the different value + types.,size} + + @complexity Constant, as long as @ref array_t and @ref object_t satisfy + the Container concept; that is, their size() functions have constant + complexity. + + @iterators No changes. + + @exceptionsafety No-throw guarantee: this function never throws exceptions. + + @note This function does not return the length of a string stored as JSON + value - it returns the number of elements in the JSON value which is 1 in + the case of a string. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + - Has the semantics of `std::distance(begin(), end())`. + + @sa @ref empty() -- checks whether the container is empty + @sa @ref max_size() -- returns the maximal number of elements + + @since version 1.0.0 + */ + size_type size() const noexcept + { + switch (m_type) + { + case value_t::null: + { + // null values are empty + return 0; + } + + case value_t::array: + { + // delegate call to array_t::size() + return m_value.array->size(); + } + + case value_t::object: + { + // delegate call to object_t::size() + return m_value.object->size(); + } + + default: + { + // all other types have size 1 + return 1; + } + } + } + + /*! + @brief returns the maximum possible number of elements + + Returns the maximum number of elements a JSON value is able to hold due to + system or library implementation limitations, i.e. `std::distance(begin(), + end())` for the JSON value. + + @return The return value depends on the different types and is + defined as follows: + Value type | return value + ----------- | ------------- + null | `0` (same as `size()`) + boolean | `1` (same as `size()`) + string | `1` (same as `size()`) + number | `1` (same as `size()`) + object | result of function `object_t::max_size()` + array | result of function `array_t::max_size()` + + @liveexample{The following code calls `max_size()` on the different value + types. Note the output is implementation specific.,max_size} + + @complexity Constant, as long as @ref array_t and @ref object_t satisfy + the Container concept; that is, their `max_size()` functions have constant + complexity. + + @iterators No changes. + + @exceptionsafety No-throw guarantee: this function never throws exceptions. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + - Has the semantics of returning `b.size()` where `b` is the largest + possible JSON value. + + @sa @ref size() -- returns the number of elements + + @since version 1.0.0 + */ + size_type max_size() const noexcept + { + switch (m_type) + { + case value_t::array: + { + // delegate call to array_t::max_size() + return m_value.array->max_size(); + } + + case value_t::object: + { + // delegate call to object_t::max_size() + return m_value.object->max_size(); + } + + default: + { + // all other types have max_size() == size() + return size(); + } + } + } + + /// @} + + + /////////////// + // modifiers // + /////////////// + + /// @name modifiers + /// @{ + + /*! + @brief clears the contents + + Clears the content of a JSON value and resets it to the default value as + if @ref basic_json(value_t) would have been called with the current value + type from @ref type(): + + Value type | initial value + ----------- | ------------- + null | `null` + boolean | `false` + string | `""` + number | `0` + object | `{}` + array | `[]` + + @post Has the same effect as calling + @code {.cpp} + *this = basic_json(type()); + @endcode + + @liveexample{The example below shows the effect of `clear()` to different + JSON types.,clear} + + @complexity Linear in the size of the JSON value. + + @iterators All iterators, pointers and references related to this container + are invalidated. + + @exceptionsafety No-throw guarantee: this function never throws exceptions. + + @sa @ref basic_json(value_t) -- constructor that creates an object with the + same value than calling `clear()` + + @since version 1.0.0 + */ + void clear() noexcept + { + switch (m_type) + { + case value_t::number_integer: + { + m_value.number_integer = 0; + break; + } + + case value_t::number_unsigned: + { + m_value.number_unsigned = 0; + break; + } + + case value_t::number_float: + { + m_value.number_float = 0.0; + break; + } + + case value_t::boolean: + { + m_value.boolean = false; + break; + } + + case value_t::string: + { + m_value.string->clear(); + break; + } + + case value_t::array: + { + m_value.array->clear(); + break; + } + + case value_t::object: + { + m_value.object->clear(); + break; + } + + default: + break; + } + } + + /*! + @brief add an object to an array + + Appends the given element @a val to the end of the JSON value. If the + function is called on a JSON null value, an empty array is created before + appending @a val. + + @param[in] val the value to add to the JSON array + + @throw type_error.308 when called on a type other than JSON array or + null; example: `"cannot use push_back() with number"` + + @complexity Amortized constant. + + @liveexample{The example shows how `push_back()` and `+=` can be used to + add elements to a JSON array. Note how the `null` value was silently + converted to a JSON array.,push_back} + + @since version 1.0.0 + */ + void push_back(basic_json&& val) + { + // push_back only works for null objects or arrays + if (JSON_UNLIKELY(not(is_null() or is_array()))) + { + JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name()))); + } + + // transform null object into an array + if (is_null()) + { + m_type = value_t::array; + m_value = value_t::array; + assert_invariant(); + } + + // add element to array (move semantics) + m_value.array->push_back(std::move(val)); + // invalidate object + val.m_type = value_t::null; + } + + /*! + @brief add an object to an array + @copydoc push_back(basic_json&&) + */ + reference operator+=(basic_json&& val) + { + push_back(std::move(val)); + return *this; + } + + /*! + @brief add an object to an array + @copydoc push_back(basic_json&&) + */ + void push_back(const basic_json& val) + { + // push_back only works for null objects or arrays + if (JSON_UNLIKELY(not(is_null() or is_array()))) + { + JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name()))); + } + + // transform null object into an array + if (is_null()) + { + m_type = value_t::array; + m_value = value_t::array; + assert_invariant(); + } + + // add element to array + m_value.array->push_back(val); + } + + /*! + @brief add an object to an array + @copydoc push_back(basic_json&&) + */ + reference operator+=(const basic_json& val) + { + push_back(val); + return *this; + } + + /*! + @brief add an object to an object + + Inserts the given element @a val to the JSON object. If the function is + called on a JSON null value, an empty object is created before inserting + @a val. + + @param[in] val the value to add to the JSON object + + @throw type_error.308 when called on a type other than JSON object or + null; example: `"cannot use push_back() with number"` + + @complexity Logarithmic in the size of the container, O(log(`size()`)). + + @liveexample{The example shows how `push_back()` and `+=` can be used to + add elements to a JSON object. Note how the `null` value was silently + converted to a JSON object.,push_back__object_t__value} + + @since version 1.0.0 + */ + void push_back(const typename object_t::value_type& val) + { + // push_back only works for null objects or objects + if (JSON_UNLIKELY(not(is_null() or is_object()))) + { + JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name()))); + } + + // transform null object into an object + if (is_null()) + { + m_type = value_t::object; + m_value = value_t::object; + assert_invariant(); + } + + // add element to array + m_value.object->insert(val); + } + + /*! + @brief add an object to an object + @copydoc push_back(const typename object_t::value_type&) + */ + reference operator+=(const typename object_t::value_type& val) + { + push_back(val); + return *this; + } + + /*! + @brief add an object to an object + + This function allows to use `push_back` with an initializer list. In case + + 1. the current value is an object, + 2. the initializer list @a init contains only two elements, and + 3. the first element of @a init is a string, + + @a init is converted into an object element and added using + @ref push_back(const typename object_t::value_type&). Otherwise, @a init + is converted to a JSON value and added using @ref push_back(basic_json&&). + + @param[in] init an initializer list + + @complexity Linear in the size of the initializer list @a init. + + @note This function is required to resolve an ambiguous overload error, + because pairs like `{"key", "value"}` can be both interpreted as + `object_t::value_type` or `std::initializer_list`, see + https://github.com/nlohmann/json/issues/235 for more information. + + @liveexample{The example shows how initializer lists are treated as + objects when possible.,push_back__initializer_list} + */ + void push_back(initializer_list_t init) + { + if (is_object() and init.size() == 2 and (*init.begin())->is_string()) + { + basic_json&& key = init.begin()->moved_or_copied(); + push_back(typename object_t::value_type( + std::move(key.get_ref()), (init.begin() + 1)->moved_or_copied())); + } + else + { + push_back(basic_json(init)); + } + } + + /*! + @brief add an object to an object + @copydoc push_back(initializer_list_t) + */ + reference operator+=(initializer_list_t init) + { + push_back(init); + return *this; + } + + /*! + @brief add an object to an array + + Creates a JSON value from the passed parameters @a args to the end of the + JSON value. If the function is called on a JSON null value, an empty array + is created before appending the value created from @a args. + + @param[in] args arguments to forward to a constructor of @ref basic_json + @tparam Args compatible types to create a @ref basic_json object + + @throw type_error.311 when called on a type other than JSON array or + null; example: `"cannot use emplace_back() with number"` + + @complexity Amortized constant. + + @liveexample{The example shows how `push_back()` can be used to add + elements to a JSON array. Note how the `null` value was silently converted + to a JSON array.,emplace_back} + + @since version 2.0.8 + */ + template + void emplace_back(Args&& ... args) + { + // emplace_back only works for null objects or arrays + if (JSON_UNLIKELY(not(is_null() or is_array()))) + { + JSON_THROW(type_error::create(311, "cannot use emplace_back() with " + std::string(type_name()))); + } + + // transform null object into an array + if (is_null()) + { + m_type = value_t::array; + m_value = value_t::array; + assert_invariant(); + } + + // add element to array (perfect forwarding) + m_value.array->emplace_back(std::forward(args)...); + } + + /*! + @brief add an object to an object if key does not exist + + Inserts a new element into a JSON object constructed in-place with the + given @a args if there is no element with the key in the container. If the + function is called on a JSON null value, an empty object is created before + appending the value created from @a args. + + @param[in] args arguments to forward to a constructor of @ref basic_json + @tparam Args compatible types to create a @ref basic_json object + + @return a pair consisting of an iterator to the inserted element, or the + already-existing element if no insertion happened, and a bool + denoting whether the insertion took place. + + @throw type_error.311 when called on a type other than JSON object or + null; example: `"cannot use emplace() with number"` + + @complexity Logarithmic in the size of the container, O(log(`size()`)). + + @liveexample{The example shows how `emplace()` can be used to add elements + to a JSON object. Note how the `null` value was silently converted to a + JSON object. Further note how no value is added if there was already one + value stored with the same key.,emplace} + + @since version 2.0.8 + */ + template + std::pair emplace(Args&& ... args) + { + // emplace only works for null objects or arrays + if (JSON_UNLIKELY(not(is_null() or is_object()))) + { + JSON_THROW(type_error::create(311, "cannot use emplace() with " + std::string(type_name()))); + } + + // transform null object into an object + if (is_null()) + { + m_type = value_t::object; + m_value = value_t::object; + assert_invariant(); + } + + // add element to array (perfect forwarding) + auto res = m_value.object->emplace(std::forward(args)...); + // create result iterator and set iterator to the result of emplace + auto it = begin(); + it.m_it.object_iterator = res.first; + + // return pair of iterator and boolean + return {it, res.second}; + } + + /*! + @brief inserts element + + Inserts element @a val before iterator @a pos. + + @param[in] pos iterator before which the content will be inserted; may be + the end() iterator + @param[in] val element to insert + @return iterator pointing to the inserted @a val. + + @throw type_error.309 if called on JSON values other than arrays; + example: `"cannot use insert() with string"` + @throw invalid_iterator.202 if @a pos is not an iterator of *this; + example: `"iterator does not fit current value"` + + @complexity Constant plus linear in the distance between @a pos and end of + the container. + + @liveexample{The example shows how `insert()` is used.,insert} + + @since version 1.0.0 + */ + iterator insert(const_iterator pos, const basic_json& val) + { + // insert only works for arrays + if (JSON_LIKELY(is_array())) + { + // check if iterator pos fits to this JSON value + if (JSON_UNLIKELY(pos.m_object != this)) + { + JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); + } + + // insert to array and return iterator + iterator result(this); + result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, val); + return result; + } + + JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name()))); + } + + /*! + @brief inserts element + @copydoc insert(const_iterator, const basic_json&) + */ + iterator insert(const_iterator pos, basic_json&& val) + { + return insert(pos, val); + } + + /*! + @brief inserts elements + + Inserts @a cnt copies of @a val before iterator @a pos. + + @param[in] pos iterator before which the content will be inserted; may be + the end() iterator + @param[in] cnt number of copies of @a val to insert + @param[in] val element to insert + @return iterator pointing to the first element inserted, or @a pos if + `cnt==0` + + @throw type_error.309 if called on JSON values other than arrays; example: + `"cannot use insert() with string"` + @throw invalid_iterator.202 if @a pos is not an iterator of *this; + example: `"iterator does not fit current value"` + + @complexity Linear in @a cnt plus linear in the distance between @a pos + and end of the container. + + @liveexample{The example shows how `insert()` is used.,insert__count} + + @since version 1.0.0 + */ + iterator insert(const_iterator pos, size_type cnt, const basic_json& val) + { + // insert only works for arrays + if (JSON_LIKELY(is_array())) + { + // check if iterator pos fits to this JSON value + if (JSON_UNLIKELY(pos.m_object != this)) + { + JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); + } + + // insert to array and return iterator + iterator result(this); + result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val); + return result; + } + + JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name()))); + } + + /*! + @brief inserts elements + + Inserts elements from range `[first, last)` before iterator @a pos. + + @param[in] pos iterator before which the content will be inserted; may be + the end() iterator + @param[in] first begin of the range of elements to insert + @param[in] last end of the range of elements to insert + + @throw type_error.309 if called on JSON values other than arrays; example: + `"cannot use insert() with string"` + @throw invalid_iterator.202 if @a pos is not an iterator of *this; + example: `"iterator does not fit current value"` + @throw invalid_iterator.210 if @a first and @a last do not belong to the + same JSON value; example: `"iterators do not fit"` + @throw invalid_iterator.211 if @a first or @a last are iterators into + container for which insert is called; example: `"passed iterators may not + belong to container"` + + @return iterator pointing to the first element inserted, or @a pos if + `first==last` + + @complexity Linear in `std::distance(first, last)` plus linear in the + distance between @a pos and end of the container. + + @liveexample{The example shows how `insert()` is used.,insert__range} + + @since version 1.0.0 + */ + iterator insert(const_iterator pos, const_iterator first, const_iterator last) + { + // insert only works for arrays + if (JSON_UNLIKELY(not is_array())) + { + JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name()))); + } + + // check if iterator pos fits to this JSON value + if (JSON_UNLIKELY(pos.m_object != this)) + { + JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); + } + + // check if range iterators belong to the same JSON object + if (JSON_UNLIKELY(first.m_object != last.m_object)) + { + JSON_THROW(invalid_iterator::create(210, "iterators do not fit")); + } + + if (JSON_UNLIKELY(first.m_object == this)) + { + JSON_THROW(invalid_iterator::create(211, "passed iterators may not belong to container")); + } + + // insert to array and return iterator + iterator result(this); + result.m_it.array_iterator = m_value.array->insert( + pos.m_it.array_iterator, + first.m_it.array_iterator, + last.m_it.array_iterator); + return result; + } + + /*! + @brief inserts elements + + Inserts elements from initializer list @a ilist before iterator @a pos. + + @param[in] pos iterator before which the content will be inserted; may be + the end() iterator + @param[in] ilist initializer list to insert the values from + + @throw type_error.309 if called on JSON values other than arrays; example: + `"cannot use insert() with string"` + @throw invalid_iterator.202 if @a pos is not an iterator of *this; + example: `"iterator does not fit current value"` + + @return iterator pointing to the first element inserted, or @a pos if + `ilist` is empty + + @complexity Linear in `ilist.size()` plus linear in the distance between + @a pos and end of the container. + + @liveexample{The example shows how `insert()` is used.,insert__ilist} + + @since version 1.0.0 + */ + iterator insert(const_iterator pos, initializer_list_t ilist) + { + // insert only works for arrays + if (JSON_UNLIKELY(not is_array())) + { + JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name()))); + } + + // check if iterator pos fits to this JSON value + if (JSON_UNLIKELY(pos.m_object != this)) + { + JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); + } + + // insert to array and return iterator + iterator result(this); + result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, ilist.begin(), ilist.end()); + return result; + } + + /*! + @brief inserts elements + + Inserts elements from range `[first, last)`. + + @param[in] first begin of the range of elements to insert + @param[in] last end of the range of elements to insert + + @throw type_error.309 if called on JSON values other than objects; example: + `"cannot use insert() with string"` + @throw invalid_iterator.202 if iterator @a first or @a last does does not + point to an object; example: `"iterators first and last must point to + objects"` + @throw invalid_iterator.210 if @a first and @a last do not belong to the + same JSON value; example: `"iterators do not fit"` + + @complexity Logarithmic: `O(N*log(size() + N))`, where `N` is the number + of elements to insert. + + @liveexample{The example shows how `insert()` is used.,insert__range_object} + + @since version 3.0.0 + */ + void insert(const_iterator first, const_iterator last) + { + // insert only works for objects + if (JSON_UNLIKELY(not is_object())) + { + JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name()))); + } + + // check if range iterators belong to the same JSON object + if (JSON_UNLIKELY(first.m_object != last.m_object)) + { + JSON_THROW(invalid_iterator::create(210, "iterators do not fit")); + } + + // passed iterators must belong to objects + if (JSON_UNLIKELY(not first.m_object->is_object())) + { + JSON_THROW(invalid_iterator::create(202, "iterators first and last must point to objects")); + } + + m_value.object->insert(first.m_it.object_iterator, last.m_it.object_iterator); + } + + /*! + @brief updates a JSON object from another object, overwriting existing keys + + Inserts all values from JSON object @a j and overwrites existing keys. + + @param[in] j JSON object to read values from + + @throw type_error.312 if called on JSON values other than objects; example: + `"cannot use update() with string"` + + @complexity O(N*log(size() + N)), where N is the number of elements to + insert. + + @liveexample{The example shows how `update()` is used.,update} + + @sa https://docs.python.org/3.6/library/stdtypes.html#dict.update + + @since version 3.0.0 + */ + void update(const_reference j) + { + // implicitly convert null value to an empty object + if (is_null()) + { + m_type = value_t::object; + m_value.object = create(); + assert_invariant(); + } + + if (JSON_UNLIKELY(not is_object())) + { + JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(type_name()))); + } + if (JSON_UNLIKELY(not j.is_object())) + { + JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(j.type_name()))); + } + + for (auto it = j.begin(); it != j.end(); ++it) + { + m_value.object->operator[](it.key()) = it.value(); + } + } + + /*! + @brief updates a JSON object from another object, overwriting existing keys + + Inserts all values from from range `[first, last)` and overwrites existing + keys. + + @param[in] first begin of the range of elements to insert + @param[in] last end of the range of elements to insert + + @throw type_error.312 if called on JSON values other than objects; example: + `"cannot use update() with string"` + @throw invalid_iterator.202 if iterator @a first or @a last does does not + point to an object; example: `"iterators first and last must point to + objects"` + @throw invalid_iterator.210 if @a first and @a last do not belong to the + same JSON value; example: `"iterators do not fit"` + + @complexity O(N*log(size() + N)), where N is the number of elements to + insert. + + @liveexample{The example shows how `update()` is used__range.,update} + + @sa https://docs.python.org/3.6/library/stdtypes.html#dict.update + + @since version 3.0.0 + */ + void update(const_iterator first, const_iterator last) + { + // implicitly convert null value to an empty object + if (is_null()) + { + m_type = value_t::object; + m_value.object = create(); + assert_invariant(); + } + + if (JSON_UNLIKELY(not is_object())) + { + JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(type_name()))); + } + + // check if range iterators belong to the same JSON object + if (JSON_UNLIKELY(first.m_object != last.m_object)) + { + JSON_THROW(invalid_iterator::create(210, "iterators do not fit")); + } + + // passed iterators must belong to objects + if (JSON_UNLIKELY(not first.m_object->is_object() + or not first.m_object->is_object())) + { + JSON_THROW(invalid_iterator::create(202, "iterators first and last must point to objects")); + } + + for (auto it = first; it != last; ++it) + { + m_value.object->operator[](it.key()) = it.value(); + } + } + + /*! + @brief exchanges the values + + Exchanges the contents of the JSON value with those of @a other. Does not + invoke any move, copy, or swap operations on individual elements. All + iterators and references remain valid. The past-the-end iterator is + invalidated. + + @param[in,out] other JSON value to exchange the contents with + + @complexity Constant. + + @liveexample{The example below shows how JSON values can be swapped with + `swap()`.,swap__reference} + + @since version 1.0.0 + */ + void swap(reference other) noexcept ( + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value and + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value + ) + { + std::swap(m_type, other.m_type); + std::swap(m_value, other.m_value); + assert_invariant(); + } + + /*! + @brief exchanges the values + + Exchanges the contents of a JSON array with those of @a other. Does not + invoke any move, copy, or swap operations on individual elements. All + iterators and references remain valid. The past-the-end iterator is + invalidated. + + @param[in,out] other array to exchange the contents with + + @throw type_error.310 when JSON value is not an array; example: `"cannot + use swap() with string"` + + @complexity Constant. + + @liveexample{The example below shows how arrays can be swapped with + `swap()`.,swap__array_t} + + @since version 1.0.0 + */ + void swap(array_t& other) + { + // swap only works for arrays + if (JSON_LIKELY(is_array())) + { + std::swap(*(m_value.array), other); + } + else + { + JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name()))); + } + } + + /*! + @brief exchanges the values + + Exchanges the contents of a JSON object with those of @a other. Does not + invoke any move, copy, or swap operations on individual elements. All + iterators and references remain valid. The past-the-end iterator is + invalidated. + + @param[in,out] other object to exchange the contents with + + @throw type_error.310 when JSON value is not an object; example: + `"cannot use swap() with string"` + + @complexity Constant. + + @liveexample{The example below shows how objects can be swapped with + `swap()`.,swap__object_t} + + @since version 1.0.0 + */ + void swap(object_t& other) + { + // swap only works for objects + if (JSON_LIKELY(is_object())) + { + std::swap(*(m_value.object), other); + } + else + { + JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name()))); + } + } + + /*! + @brief exchanges the values + + Exchanges the contents of a JSON string with those of @a other. Does not + invoke any move, copy, or swap operations on individual elements. All + iterators and references remain valid. The past-the-end iterator is + invalidated. + + @param[in,out] other string to exchange the contents with + + @throw type_error.310 when JSON value is not a string; example: `"cannot + use swap() with boolean"` + + @complexity Constant. + + @liveexample{The example below shows how strings can be swapped with + `swap()`.,swap__string_t} + + @since version 1.0.0 + */ + void swap(string_t& other) + { + // swap only works for strings + if (JSON_LIKELY(is_string())) + { + std::swap(*(m_value.string), other); + } + else + { + JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name()))); + } + } + + /// @} + + public: + ////////////////////////////////////////// + // lexicographical comparison operators // + ////////////////////////////////////////// + + /// @name lexicographical comparison operators + /// @{ + + /*! + @brief comparison: equal + + Compares two JSON values for equality according to the following rules: + - Two JSON values are equal if (1) they are from the same type and (2) + their stored values are the same according to their respective + `operator==`. + - Integer and floating-point numbers are automatically converted before + comparison. Note than two NaN values are always treated as unequal. + - Two JSON null values are equal. + + @note Floating-point inside JSON values numbers are compared with + `json::number_float_t::operator==` which is `double::operator==` by + default. To compare floating-point while respecting an epsilon, an alternative + [comparison function](https://github.com/mariokonrad/marnav/blob/master/src/marnav/math/floatingpoint.hpp#L34-#L39) + could be used, for instance + @code {.cpp} + template ::value, T>::type> + inline bool is_same(T a, T b, T epsilon = std::numeric_limits::epsilon()) noexcept + { + return std::abs(a - b) <= epsilon; + } + @endcode + + @note NaN values never compare equal to themselves or to other NaN values. + + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether the values @a lhs and @a rhs are equal + + @exceptionsafety No-throw guarantee: this function never throws exceptions. + + @complexity Linear. + + @liveexample{The example demonstrates comparing several JSON + types.,operator__equal} + + @since version 1.0.0 + */ + friend bool operator==(const_reference lhs, const_reference rhs) noexcept + { + const auto lhs_type = lhs.type(); + const auto rhs_type = rhs.type(); + + if (lhs_type == rhs_type) + { + switch (lhs_type) + { + case value_t::array: + return (*lhs.m_value.array == *rhs.m_value.array); + + case value_t::object: + return (*lhs.m_value.object == *rhs.m_value.object); + + case value_t::null: + return true; + + case value_t::string: + return (*lhs.m_value.string == *rhs.m_value.string); + + case value_t::boolean: + return (lhs.m_value.boolean == rhs.m_value.boolean); + + case value_t::number_integer: + return (lhs.m_value.number_integer == rhs.m_value.number_integer); + + case value_t::number_unsigned: + return (lhs.m_value.number_unsigned == rhs.m_value.number_unsigned); + + case value_t::number_float: + return (lhs.m_value.number_float == rhs.m_value.number_float); + + default: + return false; + } + } + else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float) + { + return (static_cast(lhs.m_value.number_integer) == rhs.m_value.number_float); + } + else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer) + { + return (lhs.m_value.number_float == static_cast(rhs.m_value.number_integer)); + } + else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_float) + { + return (static_cast(lhs.m_value.number_unsigned) == rhs.m_value.number_float); + } + else if (lhs_type == value_t::number_float and rhs_type == value_t::number_unsigned) + { + return (lhs.m_value.number_float == static_cast(rhs.m_value.number_unsigned)); + } + else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_integer) + { + return (static_cast(lhs.m_value.number_unsigned) == rhs.m_value.number_integer); + } + else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_unsigned) + { + return (lhs.m_value.number_integer == static_cast(rhs.m_value.number_unsigned)); + } + + return false; + } + + /*! + @brief comparison: equal + @copydoc operator==(const_reference, const_reference) + */ + template::value, int>::type = 0> + friend bool operator==(const_reference lhs, const ScalarType rhs) noexcept + { + return (lhs == basic_json(rhs)); + } + + /*! + @brief comparison: equal + @copydoc operator==(const_reference, const_reference) + */ + template::value, int>::type = 0> + friend bool operator==(const ScalarType lhs, const_reference rhs) noexcept + { + return (basic_json(lhs) == rhs); + } + + /*! + @brief comparison: not equal + + Compares two JSON values for inequality by calculating `not (lhs == rhs)`. + + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether the values @a lhs and @a rhs are not equal + + @complexity Linear. + + @exceptionsafety No-throw guarantee: this function never throws exceptions. + + @liveexample{The example demonstrates comparing several JSON + types.,operator__notequal} + + @since version 1.0.0 + */ + friend bool operator!=(const_reference lhs, const_reference rhs) noexcept + { + return not (lhs == rhs); + } + + /*! + @brief comparison: not equal + @copydoc operator!=(const_reference, const_reference) + */ + template::value, int>::type = 0> + friend bool operator!=(const_reference lhs, const ScalarType rhs) noexcept + { + return (lhs != basic_json(rhs)); + } + + /*! + @brief comparison: not equal + @copydoc operator!=(const_reference, const_reference) + */ + template::value, int>::type = 0> + friend bool operator!=(const ScalarType lhs, const_reference rhs) noexcept + { + return (basic_json(lhs) != rhs); + } + + /*! + @brief comparison: less than + + Compares whether one JSON value @a lhs is less than another JSON value @a + rhs according to the following rules: + - If @a lhs and @a rhs have the same type, the values are compared using + the default `<` operator. + - Integer and floating-point numbers are automatically converted before + comparison + - In case @a lhs and @a rhs have different types, the values are ignored + and the order of the types is considered, see + @ref operator<(const value_t, const value_t). + + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether @a lhs is less than @a rhs + + @complexity Linear. + + @exceptionsafety No-throw guarantee: this function never throws exceptions. + + @liveexample{The example demonstrates comparing several JSON + types.,operator__less} + + @since version 1.0.0 + */ + friend bool operator<(const_reference lhs, const_reference rhs) noexcept + { + const auto lhs_type = lhs.type(); + const auto rhs_type = rhs.type(); + + if (lhs_type == rhs_type) + { + switch (lhs_type) + { + case value_t::array: + return (*lhs.m_value.array) < (*rhs.m_value.array); + + case value_t::object: + return *lhs.m_value.object < *rhs.m_value.object; + + case value_t::null: + return false; + + case value_t::string: + return *lhs.m_value.string < *rhs.m_value.string; + + case value_t::boolean: + return lhs.m_value.boolean < rhs.m_value.boolean; + + case value_t::number_integer: + return lhs.m_value.number_integer < rhs.m_value.number_integer; + + case value_t::number_unsigned: + return lhs.m_value.number_unsigned < rhs.m_value.number_unsigned; + + case value_t::number_float: + return lhs.m_value.number_float < rhs.m_value.number_float; + + default: + return false; + } + } + else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float) + { + return static_cast(lhs.m_value.number_integer) < rhs.m_value.number_float; + } + else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer) + { + return lhs.m_value.number_float < static_cast(rhs.m_value.number_integer); + } + else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_float) + { + return static_cast(lhs.m_value.number_unsigned) < rhs.m_value.number_float; + } + else if (lhs_type == value_t::number_float and rhs_type == value_t::number_unsigned) + { + return lhs.m_value.number_float < static_cast(rhs.m_value.number_unsigned); + } + else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_unsigned) + { + return lhs.m_value.number_integer < static_cast(rhs.m_value.number_unsigned); + } + else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_integer) + { + return static_cast(lhs.m_value.number_unsigned) < rhs.m_value.number_integer; + } + + // We only reach this line if we cannot compare values. In that case, + // we compare types. Note we have to call the operator explicitly, + // because MSVC has problems otherwise. + return operator<(lhs_type, rhs_type); + } + + /*! + @brief comparison: less than + @copydoc operator<(const_reference, const_reference) + */ + template::value, int>::type = 0> + friend bool operator<(const_reference lhs, const ScalarType rhs) noexcept + { + return (lhs < basic_json(rhs)); + } + + /*! + @brief comparison: less than + @copydoc operator<(const_reference, const_reference) + */ + template::value, int>::type = 0> + friend bool operator<(const ScalarType lhs, const_reference rhs) noexcept + { + return (basic_json(lhs) < rhs); + } + + /*! + @brief comparison: less than or equal + + Compares whether one JSON value @a lhs is less than or equal to another + JSON value by calculating `not (rhs < lhs)`. + + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether @a lhs is less than or equal to @a rhs + + @complexity Linear. + + @exceptionsafety No-throw guarantee: this function never throws exceptions. + + @liveexample{The example demonstrates comparing several JSON + types.,operator__greater} + + @since version 1.0.0 + */ + friend bool operator<=(const_reference lhs, const_reference rhs) noexcept + { + return not (rhs < lhs); + } + + /*! + @brief comparison: less than or equal + @copydoc operator<=(const_reference, const_reference) + */ + template::value, int>::type = 0> + friend bool operator<=(const_reference lhs, const ScalarType rhs) noexcept + { + return (lhs <= basic_json(rhs)); + } + + /*! + @brief comparison: less than or equal + @copydoc operator<=(const_reference, const_reference) + */ + template::value, int>::type = 0> + friend bool operator<=(const ScalarType lhs, const_reference rhs) noexcept + { + return (basic_json(lhs) <= rhs); + } + + /*! + @brief comparison: greater than + + Compares whether one JSON value @a lhs is greater than another + JSON value by calculating `not (lhs <= rhs)`. + + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether @a lhs is greater than to @a rhs + + @complexity Linear. + + @exceptionsafety No-throw guarantee: this function never throws exceptions. + + @liveexample{The example demonstrates comparing several JSON + types.,operator__lessequal} + + @since version 1.0.0 + */ + friend bool operator>(const_reference lhs, const_reference rhs) noexcept + { + return not (lhs <= rhs); + } + + /*! + @brief comparison: greater than + @copydoc operator>(const_reference, const_reference) + */ + template::value, int>::type = 0> + friend bool operator>(const_reference lhs, const ScalarType rhs) noexcept + { + return (lhs > basic_json(rhs)); + } + + /*! + @brief comparison: greater than + @copydoc operator>(const_reference, const_reference) + */ + template::value, int>::type = 0> + friend bool operator>(const ScalarType lhs, const_reference rhs) noexcept + { + return (basic_json(lhs) > rhs); + } + + /*! + @brief comparison: greater than or equal + + Compares whether one JSON value @a lhs is greater than or equal to another + JSON value by calculating `not (lhs < rhs)`. + + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether @a lhs is greater than or equal to @a rhs + + @complexity Linear. + + @exceptionsafety No-throw guarantee: this function never throws exceptions. + + @liveexample{The example demonstrates comparing several JSON + types.,operator__greaterequal} + + @since version 1.0.0 + */ + friend bool operator>=(const_reference lhs, const_reference rhs) noexcept + { + return not (lhs < rhs); + } + + /*! + @brief comparison: greater than or equal + @copydoc operator>=(const_reference, const_reference) + */ + template::value, int>::type = 0> + friend bool operator>=(const_reference lhs, const ScalarType rhs) noexcept + { + return (lhs >= basic_json(rhs)); + } + + /*! + @brief comparison: greater than or equal + @copydoc operator>=(const_reference, const_reference) + */ + template::value, int>::type = 0> + friend bool operator>=(const ScalarType lhs, const_reference rhs) noexcept + { + return (basic_json(lhs) >= rhs); + } + + /// @} + + /////////////////// + // serialization // + /////////////////// + + /// @name serialization + /// @{ + + /*! + @brief serialize to stream + + Serialize the given JSON value @a j to the output stream @a o. The JSON + value will be serialized using the @ref dump member function. + + - The indentation of the output can be controlled with the member variable + `width` of the output stream @a o. For instance, using the manipulator + `std::setw(4)` on @a o sets the indentation level to `4` and the + serialization result is the same as calling `dump(4)`. + + - The indentation characrer can be controlled with the member variable + `fill` of the output stream @a o. For instance, the manipulator + `std::setfill('\\t')` sets indentation to use a tab character rather than + the default space character. + + @param[in,out] o stream to serialize to + @param[in] j JSON value to serialize + + @return the stream @a o + + @complexity Linear. + + @liveexample{The example below shows the serialization with different + parameters to `width` to adjust the indentation level.,operator_serialize} + + @since version 1.0.0; indentaction character added in version 3.0.0 + */ + friend std::ostream& operator<<(std::ostream& o, const basic_json& j) + { + // read width member and use it as indentation parameter if nonzero + const bool pretty_print = (o.width() > 0); + const auto indentation = (pretty_print ? o.width() : 0); + + // reset width to 0 for subsequent calls to this stream + o.width(0); + + // do the actual serialization + serializer s(detail::output_adapter(o), o.fill()); + s.dump(j, pretty_print, false, static_cast(indentation)); + return o; + } + + /*! + @brief serialize to stream + @deprecated This stream operator is deprecated and will be removed in a + future version of the library. Please use + @ref operator<<(std::ostream&, const basic_json&) + instead; that is, replace calls like `j >> o;` with `o << j;`. + @since version 1.0.0; deprecated since version 3.0.0 + */ + JSON_DEPRECATED + friend std::ostream& operator>>(const basic_json& j, std::ostream& o) + { + return o << j; + } + + /// @} + + + ///////////////////// + // deserialization // + ///////////////////// + + /// @name deserialization + /// @{ + + /*! + @brief deserialize from a compatible input + + This function reads from a compatible input. Examples are: + - an array of 1-byte values + - strings with character/literal type with size of 1 byte + - input streams + - container with contiguous storage of 1-byte values. Compatible container + types include `std::vector`, `std::string`, `std::array`, + `std::valarray`, and `std::initializer_list`. Furthermore, C-style + arrays can be used with `std::begin()`/`std::end()`. User-defined + containers can be used as long as they implement random-access iterators + and a contiguous storage. + + @pre Each element of the container has a size of 1 byte. Violating this + precondition yields undefined behavior. **This precondition is enforced + with a static assertion.** + + @pre The container storage is contiguous. Violating this precondition + yields undefined behavior. **This precondition is enforced with an + assertion.** + @pre Each element of the container has a size of 1 byte. Violating this + precondition yields undefined behavior. **This precondition is enforced + with a static assertion.** + + @warning There is no way to enforce all preconditions at compile-time. If + the function is called with a noncompliant container and with + assertions switched off, the behavior is undefined and will most + likely yield segmentation violation. + + @param[in] i input to read from + @param[in] cb a parser callback function of type @ref parser_callback_t + which is used to control the deserialization by filtering unwanted values + (optional) + + @return result of the deserialization + + @throw parse_error.101 if a parse error occurs; example: `""unexpected end + of input; expected string literal""` + @throw parse_error.102 if to_unicode fails or surrogate error + @throw parse_error.103 if to_unicode fails + + @complexity Linear in the length of the input. The parser is a predictive + LL(1) parser. The complexity can be higher if the parser callback function + @a cb has a super-linear complexity. + + @note A UTF-8 byte order mark is silently ignored. + + @liveexample{The example below demonstrates the `parse()` function reading + from an array.,parse__array__parser_callback_t} + + @liveexample{The example below demonstrates the `parse()` function with + and without callback function.,parse__string__parser_callback_t} + + @liveexample{The example below demonstrates the `parse()` function with + and without callback function.,parse__istream__parser_callback_t} + + @liveexample{The example below demonstrates the `parse()` function reading + from a contiguous container.,parse__contiguouscontainer__parser_callback_t} + + @since version 2.0.3 (contiguous containers) + */ + static basic_json parse(detail::input_adapter i, + const parser_callback_t cb = nullptr, + const bool allow_exceptions = true) + { + basic_json result; + parser(i, cb, allow_exceptions).parse(true, result); + return result; + } + + /*! + @copydoc basic_json parse(detail::input_adapter, const parser_callback_t) + */ + static basic_json parse(detail::input_adapter& i, + const parser_callback_t cb = nullptr, + const bool allow_exceptions = true) + { + basic_json result; + parser(i, cb, allow_exceptions).parse(true, result); + return result; + } + + static bool accept(detail::input_adapter i) + { + return parser(i).accept(true); + } + + static bool accept(detail::input_adapter& i) + { + return parser(i).accept(true); + } + + /*! + @brief deserialize from an iterator range with contiguous storage + + This function reads from an iterator range of a container with contiguous + storage of 1-byte values. Compatible container types include + `std::vector`, `std::string`, `std::array`, `std::valarray`, and + `std::initializer_list`. Furthermore, C-style arrays can be used with + `std::begin()`/`std::end()`. User-defined containers can be used as long + as they implement random-access iterators and a contiguous storage. + + @pre The iterator range is contiguous. Violating this precondition yields + undefined behavior. **This precondition is enforced with an assertion.** + @pre Each element in the range has a size of 1 byte. Violating this + precondition yields undefined behavior. **This precondition is enforced + with a static assertion.** + + @warning There is no way to enforce all preconditions at compile-time. If + the function is called with noncompliant iterators and with + assertions switched off, the behavior is undefined and will most + likely yield segmentation violation. + + @tparam IteratorType iterator of container with contiguous storage + @param[in] first begin of the range to parse (included) + @param[in] last end of the range to parse (excluded) + @param[in] cb a parser callback function of type @ref parser_callback_t + which is used to control the deserialization by filtering unwanted values + (optional) + @param[in] allow_exceptions whether to throw exceptions in case of a + parse error (optional, true by default) + + @return result of the deserialization + + @throw parse_error.101 in case of an unexpected token + @throw parse_error.102 if to_unicode fails or surrogate error + @throw parse_error.103 if to_unicode fails + + @complexity Linear in the length of the input. The parser is a predictive + LL(1) parser. The complexity can be higher if the parser callback function + @a cb has a super-linear complexity. + + @note A UTF-8 byte order mark is silently ignored. + + @liveexample{The example below demonstrates the `parse()` function reading + from an iterator range.,parse__iteratortype__parser_callback_t} + + @since version 2.0.3 + */ + template::iterator_category>::value, int>::type = 0> + static basic_json parse(IteratorType first, IteratorType last, + const parser_callback_t cb = nullptr, + const bool allow_exceptions = true) + { + basic_json result; + parser(detail::input_adapter(first, last), cb, allow_exceptions).parse(true, result); + return result; + } + + template::iterator_category>::value, int>::type = 0> + static bool accept(IteratorType first, IteratorType last) + { + return parser(detail::input_adapter(first, last)).accept(true); + } + + /*! + @brief deserialize from stream + @deprecated This stream operator is deprecated and will be removed in a + future version of the library. Please use + @ref operator>>(std::istream&, basic_json&) + instead; that is, replace calls like `j << i;` with `i >> j;`. + @since version 1.0.0; deprecated since version 3.0.0 + */ + JSON_DEPRECATED + friend std::istream& operator<<(basic_json& j, std::istream& i) + { + return operator>>(i, j); + } + + /*! + @brief deserialize from stream + + Deserializes an input stream to a JSON value. + + @param[in,out] i input stream to read a serialized JSON value from + @param[in,out] j JSON value to write the deserialized input to + + @throw parse_error.101 in case of an unexpected token + @throw parse_error.102 if to_unicode fails or surrogate error + @throw parse_error.103 if to_unicode fails + + @complexity Linear in the length of the input. The parser is a predictive + LL(1) parser. + + @note A UTF-8 byte order mark is silently ignored. + + @liveexample{The example below shows how a JSON value is constructed by + reading a serialization from a stream.,operator_deserialize} + + @sa parse(std::istream&, const parser_callback_t) for a variant with a + parser callback function to filter values while parsing + + @since version 1.0.0 + */ + friend std::istream& operator>>(std::istream& i, basic_json& j) + { + parser(detail::input_adapter(i)).parse(false, j); + return i; + } + + /// @} + + /////////////////////////// + // convenience functions // + /////////////////////////// + + /*! + @brief return the type as string + + Returns the type name as string to be used in error messages - usually to + indicate that a function was called on a wrong JSON type. + + @return a string representation of a the @a m_type member: + Value type | return value + ----------- | ------------- + null | `"null"` + boolean | `"boolean"` + string | `"string"` + number | `"number"` (for all number types) + object | `"object"` + array | `"array"` + discarded | `"discarded"` + + @exceptionsafety No-throw guarantee: this function never throws exceptions. + + @complexity Constant. + + @liveexample{The following code exemplifies `type_name()` for all JSON + types.,type_name} + + @sa @ref type() -- return the type of the JSON value + @sa @ref operator value_t() -- return the type of the JSON value (implicit) + + @since version 1.0.0, public since 2.1.0, `const char*` and `noexcept` + since 3.0.0 + */ + const char* type_name() const noexcept + { + { + switch (m_type) + { + case value_t::null: + return "null"; + case value_t::object: + return "object"; + case value_t::array: + return "array"; + case value_t::string: + return "string"; + case value_t::boolean: + return "boolean"; + case value_t::discarded: + return "discarded"; + default: + return "number"; + } + } + } + + + private: + ////////////////////// + // member variables // + ////////////////////// + + /// the type of the current element + value_t m_type = value_t::null; + + /// the value of the current element + json_value m_value = {}; + + ////////////////////////////////////////// + // binary serialization/deserialization // + ////////////////////////////////////////// + + /// @name binary serialization/deserialization support + /// @{ + + public: + /*! + @brief create a CBOR serialization of a given JSON value + + Serializes a given JSON value @a j to a byte vector using the CBOR (Concise + Binary Object Representation) serialization format. CBOR is a binary + serialization format which aims to be more compact than JSON itself, yet + more efficient to parse. + + The library uses the following mapping from JSON values types to + CBOR types according to the CBOR specification (RFC 7049): + + JSON value type | value/range | CBOR type | first byte + --------------- | ------------------------------------------ | ---------------------------------- | --------------- + null | `null` | Null | 0xf6 + boolean | `true` | True | 0xf5 + boolean | `false` | False | 0xf4 + number_integer | -9223372036854775808..-2147483649 | Negative integer (8 bytes follow) | 0x3b + number_integer | -2147483648..-32769 | Negative integer (4 bytes follow) | 0x3a + number_integer | -32768..-129 | Negative integer (2 bytes follow) | 0x39 + number_integer | -128..-25 | Negative integer (1 byte follow) | 0x38 + number_integer | -24..-1 | Negative integer | 0x20..0x37 + number_integer | 0..23 | Integer | 0x00..0x17 + number_integer | 24..255 | Unsigned integer (1 byte follow) | 0x18 + number_integer | 256..65535 | Unsigned integer (2 bytes follow) | 0x19 + number_integer | 65536..4294967295 | Unsigned integer (4 bytes follow) | 0x1a + number_integer | 4294967296..18446744073709551615 | Unsigned integer (8 bytes follow) | 0x1b + number_unsigned | 0..23 | Integer | 0x00..0x17 + number_unsigned | 24..255 | Unsigned integer (1 byte follow) | 0x18 + number_unsigned | 256..65535 | Unsigned integer (2 bytes follow) | 0x19 + number_unsigned | 65536..4294967295 | Unsigned integer (4 bytes follow) | 0x1a + number_unsigned | 4294967296..18446744073709551615 | Unsigned integer (8 bytes follow) | 0x1b + number_float | *any value* | Double-Precision Float | 0xfb + string | *length*: 0..23 | UTF-8 string | 0x60..0x77 + string | *length*: 23..255 | UTF-8 string (1 byte follow) | 0x78 + string | *length*: 256..65535 | UTF-8 string (2 bytes follow) | 0x79 + string | *length*: 65536..4294967295 | UTF-8 string (4 bytes follow) | 0x7a + string | *length*: 4294967296..18446744073709551615 | UTF-8 string (8 bytes follow) | 0x7b + array | *size*: 0..23 | array | 0x80..0x97 + array | *size*: 23..255 | array (1 byte follow) | 0x98 + array | *size*: 256..65535 | array (2 bytes follow) | 0x99 + array | *size*: 65536..4294967295 | array (4 bytes follow) | 0x9a + array | *size*: 4294967296..18446744073709551615 | array (8 bytes follow) | 0x9b + object | *size*: 0..23 | map | 0xa0..0xb7 + object | *size*: 23..255 | map (1 byte follow) | 0xb8 + object | *size*: 256..65535 | map (2 bytes follow) | 0xb9 + object | *size*: 65536..4294967295 | map (4 bytes follow) | 0xba + object | *size*: 4294967296..18446744073709551615 | map (8 bytes follow) | 0xbb + + @note The mapping is **complete** in the sense that any JSON value type + can be converted to a CBOR value. + + @note If NaN or Infinity are stored inside a JSON number, they are + serialized properly. This behavior differs from the @ref dump() + function which serializes NaN or Infinity to `null`. + + @note The following CBOR types are not used in the conversion: + - byte strings (0x40..0x5f) + - UTF-8 strings terminated by "break" (0x7f) + - arrays terminated by "break" (0x9f) + - maps terminated by "break" (0xbf) + - date/time (0xc0..0xc1) + - bignum (0xc2..0xc3) + - decimal fraction (0xc4) + - bigfloat (0xc5) + - tagged items (0xc6..0xd4, 0xd8..0xdb) + - expected conversions (0xd5..0xd7) + - simple values (0xe0..0xf3, 0xf8) + - undefined (0xf7) + - half and single-precision floats (0xf9-0xfa) + - break (0xff) + + @param[in] j JSON value to serialize + @return MessagePack serialization as byte vector + + @complexity Linear in the size of the JSON value @a j. + + @liveexample{The example shows the serialization of a JSON value to a byte + vector in CBOR format.,to_cbor} + + @sa http://cbor.io + @sa @ref from_cbor(const std::vector&, const size_t) for the + analogous deserialization + @sa @ref to_msgpack(const basic_json&) for the related MessagePack format + + @since version 2.0.9 + */ + static std::vector to_cbor(const basic_json& j) + { + std::vector result; + to_cbor(j, result); + return result; + } + + static void to_cbor(const basic_json& j, detail::output_adapter o) + { + binary_writer(o).write_cbor(j); + } + + static void to_cbor(const basic_json& j, detail::output_adapter o) + { + binary_writer(o).write_cbor(j); + } + + /*! + @brief create a MessagePack serialization of a given JSON value + + Serializes a given JSON value @a j to a byte vector using the MessagePack + serialization format. MessagePack is a binary serialization format which + aims to be more compact than JSON itself, yet more efficient to parse. + + The library uses the following mapping from JSON values types to + MessagePack types according to the MessagePack specification: + + JSON value type | value/range | MessagePack type | first byte + --------------- | --------------------------------- | ---------------- | ---------- + null | `null` | nil | 0xc0 + boolean | `true` | true | 0xc3 + boolean | `false` | false | 0xc2 + number_integer | -9223372036854775808..-2147483649 | int64 | 0xd3 + number_integer | -2147483648..-32769 | int32 | 0xd2 + number_integer | -32768..-129 | int16 | 0xd1 + number_integer | -128..-33 | int8 | 0xd0 + number_integer | -32..-1 | negative fixint | 0xe0..0xff + number_integer | 0..127 | positive fixint | 0x00..0x7f + number_integer | 128..255 | uint 8 | 0xcc + number_integer | 256..65535 | uint 16 | 0xcd + number_integer | 65536..4294967295 | uint 32 | 0xce + number_integer | 4294967296..18446744073709551615 | uint 64 | 0xcf + number_unsigned | 0..127 | positive fixint | 0x00..0x7f + number_unsigned | 128..255 | uint 8 | 0xcc + number_unsigned | 256..65535 | uint 16 | 0xcd + number_unsigned | 65536..4294967295 | uint 32 | 0xce + number_unsigned | 4294967296..18446744073709551615 | uint 64 | 0xcf + number_float | *any value* | float 64 | 0xcb + string | *length*: 0..31 | fixstr | 0xa0..0xbf + string | *length*: 32..255 | str 8 | 0xd9 + string | *length*: 256..65535 | str 16 | 0xda + string | *length*: 65536..4294967295 | str 32 | 0xdb + array | *size*: 0..15 | fixarray | 0x90..0x9f + array | *size*: 16..65535 | array 16 | 0xdc + array | *size*: 65536..4294967295 | array 32 | 0xdd + object | *size*: 0..15 | fix map | 0x80..0x8f + object | *size*: 16..65535 | map 16 | 0xde + object | *size*: 65536..4294967295 | map 32 | 0xdf + + @note The mapping is **complete** in the sense that any JSON value type + can be converted to a MessagePack value. + + @note The following values can **not** be converted to a MessagePack value: + - strings with more than 4294967295 bytes + - arrays with more than 4294967295 elements + - objects with more than 4294967295 elements + + @note The following MessagePack types are not used in the conversion: + - bin 8 - bin 32 (0xc4..0xc6) + - ext 8 - ext 32 (0xc7..0xc9) + - float 32 (0xca) + - fixext 1 - fixext 16 (0xd4..0xd8) + + @note Any MessagePack output created @ref to_msgpack can be successfully + parsed by @ref from_msgpack. + + @note If NaN or Infinity are stored inside a JSON number, they are + serialized properly. This behavior differs from the @ref dump() + function which serializes NaN or Infinity to `null`. + + @param[in] j JSON value to serialize + @return MessagePack serialization as byte vector + + @complexity Linear in the size of the JSON value @a j. + + @liveexample{The example shows the serialization of a JSON value to a byte + vector in MessagePack format.,to_msgpack} + + @sa http://msgpack.org + @sa @ref from_msgpack(const std::vector&, const size_t) for the + analogous deserialization + @sa @ref to_cbor(const basic_json& for the related CBOR format + + @since version 2.0.9 + */ + static std::vector to_msgpack(const basic_json& j) + { + std::vector result; + to_msgpack(j, result); + return result; + } + + static void to_msgpack(const basic_json& j, detail::output_adapter o) + { + binary_writer(o).write_msgpack(j); + } + + static void to_msgpack(const basic_json& j, detail::output_adapter o) + { + binary_writer(o).write_msgpack(j); + } + + /*! + @brief create a JSON value from an input in CBOR format + + Deserializes a given input @a i to a JSON value using the CBOR (Concise + Binary Object Representation) serialization format. + + The library maps CBOR types to JSON value types as follows: + + CBOR type | JSON value type | first byte + ---------------------- | --------------- | ---------- + Integer | number_unsigned | 0x00..0x17 + Unsigned integer | number_unsigned | 0x18 + Unsigned integer | number_unsigned | 0x19 + Unsigned integer | number_unsigned | 0x1a + Unsigned integer | number_unsigned | 0x1b + Negative integer | number_integer | 0x20..0x37 + Negative integer | number_integer | 0x38 + Negative integer | number_integer | 0x39 + Negative integer | number_integer | 0x3a + Negative integer | number_integer | 0x3b + Negative integer | number_integer | 0x40..0x57 + UTF-8 string | string | 0x60..0x77 + UTF-8 string | string | 0x78 + UTF-8 string | string | 0x79 + UTF-8 string | string | 0x7a + UTF-8 string | string | 0x7b + UTF-8 string | string | 0x7f + array | array | 0x80..0x97 + array | array | 0x98 + array | array | 0x99 + array | array | 0x9a + array | array | 0x9b + array | array | 0x9f + map | object | 0xa0..0xb7 + map | object | 0xb8 + map | object | 0xb9 + map | object | 0xba + map | object | 0xbb + map | object | 0xbf + False | `false` | 0xf4 + True | `true` | 0xf5 + Nill | `null` | 0xf6 + Half-Precision Float | number_float | 0xf9 + Single-Precision Float | number_float | 0xfa + Double-Precision Float | number_float | 0xfb + + @warning The mapping is **incomplete** in the sense that not all CBOR + types can be converted to a JSON value. The following CBOR types + are not supported and will yield parse errors (parse_error.112): + - byte strings (0x40..0x5f) + - date/time (0xc0..0xc1) + - bignum (0xc2..0xc3) + - decimal fraction (0xc4) + - bigfloat (0xc5) + - tagged items (0xc6..0xd4, 0xd8..0xdb) + - expected conversions (0xd5..0xd7) + - simple values (0xe0..0xf3, 0xf8) + - undefined (0xf7) + + @warning CBOR allows map keys of any type, whereas JSON only allows + strings as keys in object values. Therefore, CBOR maps with keys + other than UTF-8 strings are rejected (parse_error.113). + + @note Any CBOR output created @ref to_cbor can be successfully parsed by + @ref from_cbor. + + @param[in] i an input in CBOR format convertible to an input adapter + @param[in] strict whether to expect the input to be consumed until EOF + (true by default) + @return deserialized JSON value + + @throw parse_error.110 if the given input ends prematurely or the end of + file was not reached when @a strict was set to true + @throw parse_error.112 if unsupported features from CBOR were + used in the given input @a v or if the input is not valid CBOR + @throw parse_error.113 if a string was expected as map key, but not found + + @complexity Linear in the size of the input @a i. + + @liveexample{The example shows the deserialization of a byte vector in CBOR + format to a JSON value.,from_cbor} + + @sa http://cbor.io + @sa @ref to_cbor(const basic_json&) for the analogous serialization + @sa @ref from_msgpack(detail::input_adapter, const bool) for the + related MessagePack format + + @since version 2.0.9; parameter @a start_index since 2.1.1; changed to + consume input adapters, removed start_index parameter, and added + @a strict parameter since 3.0.0 + */ + static basic_json from_cbor(detail::input_adapter i, + const bool strict = true) + { + return binary_reader(i).parse_cbor(strict); + } + + /*! + @copydoc from_cbor(detail::input_adapter, const bool) + */ + template::value, int> = 0> + static basic_json from_cbor(A1 && a1, A2 && a2, const bool strict = true) + { + return binary_reader(detail::input_adapter(std::forward(a1), std::forward(a2))).parse_cbor(strict); + } + + /*! + @brief create a JSON value from an input in MessagePack format + + Deserializes a given input @a i to a JSON value using the MessagePack + serialization format. + + The library maps MessagePack types to JSON value types as follows: + + MessagePack type | JSON value type | first byte + ---------------- | --------------- | ---------- + positive fixint | number_unsigned | 0x00..0x7f + fixmap | object | 0x80..0x8f + fixarray | array | 0x90..0x9f + fixstr | string | 0xa0..0xbf + nil | `null` | 0xc0 + false | `false` | 0xc2 + true | `true` | 0xc3 + float 32 | number_float | 0xca + float 64 | number_float | 0xcb + uint 8 | number_unsigned | 0xcc + uint 16 | number_unsigned | 0xcd + uint 32 | number_unsigned | 0xce + uint 64 | number_unsigned | 0xcf + int 8 | number_integer | 0xd0 + int 16 | number_integer | 0xd1 + int 32 | number_integer | 0xd2 + int 64 | number_integer | 0xd3 + str 8 | string | 0xd9 + str 16 | string | 0xda + str 32 | string | 0xdb + array 16 | array | 0xdc + array 32 | array | 0xdd + map 16 | object | 0xde + map 32 | object | 0xdf + negative fixint | number_integer | 0xe0-0xff + + @warning The mapping is **incomplete** in the sense that not all + MessagePack types can be converted to a JSON value. The following + MessagePack types are not supported and will yield parse errors: + - bin 8 - bin 32 (0xc4..0xc6) + - ext 8 - ext 32 (0xc7..0xc9) + - fixext 1 - fixext 16 (0xd4..0xd8) + + @note Any MessagePack output created @ref to_msgpack can be successfully + parsed by @ref from_msgpack. + + @param[in] i an input in MessagePack format convertible to an input + adapter + @param[in] strict whether to expect the input to be consumed until EOF + (true by default) + + @throw parse_error.110 if the given input ends prematurely or the end of + file was not reached when @a strict was set to true + @throw parse_error.112 if unsupported features from MessagePack were + used in the given input @a i or if the input is not valid MessagePack + @throw parse_error.113 if a string was expected as map key, but not found + + @complexity Linear in the size of the input @a i. + + @liveexample{The example shows the deserialization of a byte vector in + MessagePack format to a JSON value.,from_msgpack} + + @sa http://msgpack.org + @sa @ref to_msgpack(const basic_json&) for the analogous serialization + @sa @ref from_cbor(detail::input_adapter, const bool) for the related CBOR + format + + @since version 2.0.9; parameter @a start_index since 2.1.1; changed to + consume input adapters, removed start_index parameter, and added + @a strict parameter since 3.0.0 + */ + static basic_json from_msgpack(detail::input_adapter i, + const bool strict = true) + { + return binary_reader(i).parse_msgpack(strict); + } + + /*! + @copydoc from_msgpack(detail::input_adapter, const bool) + */ + template::value, int> = 0> + static basic_json from_msgpack(A1 && a1, A2 && a2, const bool strict = true) + { + return binary_reader(detail::input_adapter(std::forward(a1), std::forward(a2))).parse_msgpack(strict); + } + + /// @} + + ////////////////////////// + // JSON Pointer support // + ////////////////////////// + + /// @name JSON Pointer functions + /// @{ + + /*! + @brief access specified element via JSON Pointer + + Uses a JSON pointer to retrieve a reference to the respective JSON value. + No bound checking is performed. Similar to @ref operator[](const typename + object_t::key_type&), `null` values are created in arrays and objects if + necessary. + + In particular: + - If the JSON pointer points to an object key that does not exist, it + is created an filled with a `null` value before a reference to it + is returned. + - If the JSON pointer points to an array index that does not exist, it + is created an filled with a `null` value before a reference to it + is returned. All indices between the current maximum and the given + index are also filled with `null`. + - The special value `-` is treated as a synonym for the index past the + end. + + @param[in] ptr a JSON pointer + + @return reference to the element pointed to by @a ptr + + @complexity Constant. + + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index was not a number + @throw out_of_range.404 if the JSON pointer can not be resolved + + @liveexample{The behavior is shown in the example.,operatorjson_pointer} + + @since version 2.0.0 + */ + reference operator[](const json_pointer& ptr) + { + return ptr.get_unchecked(this); + } + + /*! + @brief access specified element via JSON Pointer + + Uses a JSON pointer to retrieve a reference to the respective JSON value. + No bound checking is performed. The function does not change the JSON + value; no `null` values are created. In particular, the the special value + `-` yields an exception. + + @param[in] ptr JSON pointer to the desired element + + @return const reference to the element pointed to by @a ptr + + @complexity Constant. + + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index was not a number + @throw out_of_range.402 if the array index '-' is used + @throw out_of_range.404 if the JSON pointer can not be resolved + + @liveexample{The behavior is shown in the example.,operatorjson_pointer_const} + + @since version 2.0.0 + */ + const_reference operator[](const json_pointer& ptr) const + { + return ptr.get_unchecked(this); + } + + /*! + @brief access specified element via JSON Pointer + + Returns a reference to the element at with specified JSON pointer @a ptr, + with bounds checking. + + @param[in] ptr JSON pointer to the desired element + + @return reference to the element pointed to by @a ptr + + @throw parse_error.106 if an array index in the passed JSON pointer @a ptr + begins with '0'. See example below. + + @throw parse_error.109 if an array index in the passed JSON pointer @a ptr + is not a number. See example below. + + @throw out_of_range.401 if an array index in the passed JSON pointer @a ptr + is out of range. See example below. + + @throw out_of_range.402 if the array index '-' is used in the passed JSON + pointer @a ptr. As `at` provides checked access (and no elements are + implicitly inserted), the index '-' is always invalid. See example below. + + @throw out_of_range.404 if the JSON pointer @a ptr can not be resolved. + See example below. + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. + + @complexity Constant. + + @since version 2.0.0 + + @liveexample{The behavior is shown in the example.,at_json_pointer} + */ + reference at(const json_pointer& ptr) + { + return ptr.get_checked(this); + } + + /*! + @brief access specified element via JSON Pointer + + Returns a const reference to the element at with specified JSON pointer @a + ptr, with bounds checking. + + @param[in] ptr JSON pointer to the desired element + + @return reference to the element pointed to by @a ptr + + @throw parse_error.106 if an array index in the passed JSON pointer @a ptr + begins with '0'. See example below. + + @throw parse_error.109 if an array index in the passed JSON pointer @a ptr + is not a number. See example below. + + @throw out_of_range.401 if an array index in the passed JSON pointer @a ptr + is out of range. See example below. + + @throw out_of_range.402 if the array index '-' is used in the passed JSON + pointer @a ptr. As `at` provides checked access (and no elements are + implicitly inserted), the index '-' is always invalid. See example below. + + @throw out_of_range.404 if the JSON pointer @a ptr can not be resolved. + See example below. + + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. + + @complexity Constant. + + @since version 2.0.0 + + @liveexample{The behavior is shown in the example.,at_json_pointer_const} + */ + const_reference at(const json_pointer& ptr) const + { + return ptr.get_checked(this); + } + + /*! + @brief return flattened JSON value + + The function creates a JSON object whose keys are JSON pointers (see [RFC + 6901](https://tools.ietf.org/html/rfc6901)) and whose values are all + primitive. The original JSON value can be restored using the @ref + unflatten() function. + + @return an object that maps JSON pointers to primitive values + + @note Empty objects and arrays are flattened to `null` and will not be + reconstructed correctly by the @ref unflatten() function. + + @complexity Linear in the size the JSON value. + + @liveexample{The following code shows how a JSON object is flattened to an + object whose keys consist of JSON pointers.,flatten} + + @sa @ref unflatten() for the reverse function + + @since version 2.0.0 + */ + basic_json flatten() const + { + basic_json result(value_t::object); + json_pointer::flatten("", *this, result); + return result; + } + + /*! + @brief unflatten a previously flattened JSON value + + The function restores the arbitrary nesting of a JSON value that has been + flattened before using the @ref flatten() function. The JSON value must + meet certain constraints: + 1. The value must be an object. + 2. The keys must be JSON pointers (see + [RFC 6901](https://tools.ietf.org/html/rfc6901)) + 3. The mapped values must be primitive JSON types. + + @return the original JSON from a flattened version + + @note Empty objects and arrays are flattened by @ref flatten() to `null` + values and can not unflattened to their original type. Apart from + this example, for a JSON value `j`, the following is always true: + `j == j.flatten().unflatten()`. + + @complexity Linear in the size the JSON value. + + @throw type_error.314 if value is not an object + @throw type_error.315 if object values are not primitive + + @liveexample{The following code shows how a flattened JSON object is + unflattened into the original nested JSON object.,unflatten} + + @sa @ref flatten() for the reverse function + + @since version 2.0.0 + */ + basic_json unflatten() const + { + return json_pointer::unflatten(*this); + } + + /// @} + + ////////////////////////// + // JSON Patch functions // + ////////////////////////// + + /// @name JSON Patch functions + /// @{ + + /*! + @brief applies a JSON patch + + [JSON Patch](http://jsonpatch.com) defines a JSON document structure for + expressing a sequence of operations to apply to a JSON) document. With + this function, a JSON Patch is applied to the current JSON value by + executing all operations from the patch. + + @param[in] json_patch JSON patch document + @return patched document + + @note The application of a patch is atomic: Either all operations succeed + and the patched document is returned or an exception is thrown. In + any case, the original value is not changed: the patch is applied + to a copy of the value. + + @throw parse_error.104 if the JSON patch does not consist of an array of + objects + + @throw parse_error.105 if the JSON patch is malformed (e.g., mandatory + attributes are missing); example: `"operation add must have member path"` + + @throw out_of_range.401 if an array index is out of range. + + @throw out_of_range.403 if a JSON pointer inside the patch could not be + resolved successfully in the current JSON value; example: `"key baz not + found"` + + @throw out_of_range.405 if JSON pointer has no parent ("add", "remove", + "move") + + @throw other_error.501 if "test" operation was unsuccessful + + @complexity Linear in the size of the JSON value and the length of the + JSON patch. As usually only a fraction of the JSON value is affected by + the patch, the complexity can usually be neglected. + + @liveexample{The following code shows how a JSON patch is applied to a + value.,patch} + + @sa @ref diff -- create a JSON patch by comparing two JSON values + + @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902) + @sa [RFC 6901 (JSON Pointer)](https://tools.ietf.org/html/rfc6901) + + @since version 2.0.0 + */ + basic_json patch(const basic_json& json_patch) const + { + // make a working copy to apply the patch to + basic_json result = *this; + + // the valid JSON Patch operations + enum class patch_operations {add, remove, replace, move, copy, test, invalid}; + + const auto get_op = [](const std::string & op) + { + if (op == "add") + { + return patch_operations::add; + } + if (op == "remove") + { + return patch_operations::remove; + } + if (op == "replace") + { + return patch_operations::replace; + } + if (op == "move") + { + return patch_operations::move; + } + if (op == "copy") + { + return patch_operations::copy; + } + if (op == "test") + { + return patch_operations::test; + } + + return patch_operations::invalid; + }; + + // wrapper for "add" operation; add value at ptr + const auto operation_add = [&result](json_pointer & ptr, basic_json val) + { + // adding to the root of the target document means replacing it + if (ptr.is_root()) + { + result = val; + } + else + { + // make sure the top element of the pointer exists + json_pointer top_pointer = ptr.top(); + if (top_pointer != ptr) + { + result.at(top_pointer); + } + + // get reference to parent of JSON pointer ptr + const auto last_path = ptr.pop_back(); + basic_json& parent = result[ptr]; + + switch (parent.m_type) + { + case value_t::null: + case value_t::object: + { + // use operator[] to add value + parent[last_path] = val; + break; + } + + case value_t::array: + { + if (last_path == "-") + { + // special case: append to back + parent.push_back(val); + } + else + { + const auto idx = std::stoi(last_path); + if (JSON_UNLIKELY(static_cast(idx) > parent.size())) + { + // avoid undefined behavior + JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range")); + } + else + { + // default case: insert add offset + parent.insert(parent.begin() + static_cast(idx), val); + } + } + break; + } + + default: + { + // if there exists a parent it cannot be primitive + assert(false); // LCOV_EXCL_LINE + } + } + } + }; + + // wrapper for "remove" operation; remove value at ptr + const auto operation_remove = [&result](json_pointer & ptr) + { + // get reference to parent of JSON pointer ptr + const auto last_path = ptr.pop_back(); + basic_json& parent = result.at(ptr); + + // remove child + if (parent.is_object()) + { + // perform range check + auto it = parent.find(last_path); + if (JSON_LIKELY(it != parent.end())) + { + parent.erase(it); + } + else + { + JSON_THROW(out_of_range::create(403, "key '" + last_path + "' not found")); + } + } + else if (parent.is_array()) + { + // note erase performs range check + parent.erase(static_cast(std::stoi(last_path))); + } + }; + + // type check: top level value must be an array + if (JSON_UNLIKELY(not json_patch.is_array())) + { + JSON_THROW(parse_error::create(104, 0, "JSON patch must be an array of objects")); + } + + // iterate and apply the operations + for (const auto& val : json_patch) + { + // wrapper to get a value for an operation + const auto get_value = [&val](const std::string & op, + const std::string & member, + bool string_type) -> basic_json& + { + // find value + auto it = val.m_value.object->find(member); + + // context-sensitive error message + const auto error_msg = (op == "op") ? "operation" : "operation '" + op + "'"; + + // check if desired value is present + if (JSON_UNLIKELY(it == val.m_value.object->end())) + { + JSON_THROW(parse_error::create(105, 0, error_msg + " must have member '" + member + "'")); + } + + // check if result is of type string + if (JSON_UNLIKELY(string_type and not it->second.is_string())) + { + JSON_THROW(parse_error::create(105, 0, error_msg + " must have string member '" + member + "'")); + } + + // no error: return value + return it->second; + }; + + // type check: every element of the array must be an object + if (JSON_UNLIKELY(not val.is_object())) + { + JSON_THROW(parse_error::create(104, 0, "JSON patch must be an array of objects")); + } + + // collect mandatory members + const std::string op = get_value("op", "op", true); + const std::string path = get_value(op, "path", true); + json_pointer ptr(path); + + switch (get_op(op)) + { + case patch_operations::add: + { + operation_add(ptr, get_value("add", "value", false)); + break; + } + + case patch_operations::remove: + { + operation_remove(ptr); + break; + } + + case patch_operations::replace: + { + // the "path" location must exist - use at() + result.at(ptr) = get_value("replace", "value", false); + break; + } + + case patch_operations::move: + { + const std::string from_path = get_value("move", "from", true); + json_pointer from_ptr(from_path); + + // the "from" location must exist - use at() + basic_json v = result.at(from_ptr); + + // The move operation is functionally identical to a + // "remove" operation on the "from" location, followed + // immediately by an "add" operation at the target + // location with the value that was just removed. + operation_remove(from_ptr); + operation_add(ptr, v); + break; + } + + case patch_operations::copy: + { + const std::string from_path = get_value("copy", "from", true); + const json_pointer from_ptr(from_path); + + // the "from" location must exist - use at() + result[ptr] = result.at(from_ptr); + break; + } + + case patch_operations::test: + { + bool success = false; + JSON_TRY + { + // check if "value" matches the one at "path" + // the "path" location must exist - use at() + success = (result.at(ptr) == get_value("test", "value", false)); + } + JSON_CATCH (out_of_range&) + { + // ignore out of range errors: success remains false + } + + // throw an exception if test fails + if (JSON_UNLIKELY(not success)) + { + JSON_THROW(other_error::create(501, "unsuccessful: " + val.dump())); + } + + break; + } + + case patch_operations::invalid: + { + // op must be "add", "remove", "replace", "move", "copy", or + // "test" + JSON_THROW(parse_error::create(105, 0, "operation value '" + op + "' is invalid")); + } + } + } + + return result; + } + + /*! + @brief creates a diff as a JSON patch + + Creates a [JSON Patch](http://jsonpatch.com) so that value @a source can + be changed into the value @a target by calling @ref patch function. + + @invariant For two JSON values @a source and @a target, the following code + yields always `true`: + @code {.cpp} + source.patch(diff(source, target)) == target; + @endcode + + @note Currently, only `remove`, `add`, and `replace` operations are + generated. + + @param[in] source JSON value to compare from + @param[in] target JSON value to compare against + @param[in] path helper value to create JSON pointers + + @return a JSON patch to convert the @a source to @a target + + @complexity Linear in the lengths of @a source and @a target. + + @liveexample{The following code shows how a JSON patch is created as a + diff for two JSON values.,diff} + + @sa @ref patch -- apply a JSON patch + + @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902) + + @since version 2.0.0 + */ + static basic_json diff(const basic_json& source, const basic_json& target, + const std::string& path = "") + { + // the patch + basic_json result(value_t::array); + + // if the values are the same, return empty patch + if (source == target) + { + return result; + } + + if (source.type() != target.type()) + { + // different types: replace value + result.push_back( + { + {"op", "replace"}, {"path", path}, {"value", target} + }); + } + else + { + switch (source.type()) + { + case value_t::array: + { + // first pass: traverse common elements + std::size_t i = 0; + while (i < source.size() and i < target.size()) + { + // recursive call to compare array values at index i + auto temp_diff = diff(source[i], target[i], path + "/" + std::to_string(i)); + result.insert(result.end(), temp_diff.begin(), temp_diff.end()); + ++i; + } + + // i now reached the end of at least one array + // in a second pass, traverse the remaining elements + + // remove my remaining elements + const auto end_index = static_cast(result.size()); + while (i < source.size()) + { + // add operations in reverse order to avoid invalid + // indices + result.insert(result.begin() + end_index, object( + { + {"op", "remove"}, + {"path", path + "/" + std::to_string(i)} + })); + ++i; + } + + // add other remaining elements + while (i < target.size()) + { + result.push_back( + { + {"op", "add"}, + {"path", path + "/" + std::to_string(i)}, + {"value", target[i]} + }); + ++i; + } + + break; + } + + case value_t::object: + { + // first pass: traverse this object's elements + for (auto it = source.begin(); it != source.end(); ++it) + { + // escape the key name to be used in a JSON patch + const auto key = json_pointer::escape(it.key()); + + if (target.find(it.key()) != target.end()) + { + // recursive call to compare object values at key it + auto temp_diff = diff(it.value(), target[it.key()], path + "/" + key); + result.insert(result.end(), temp_diff.begin(), temp_diff.end()); + } + else + { + // found a key that is not in o -> remove it + result.push_back(object( + { + {"op", "remove"}, {"path", path + "/" + key} + })); + } + } + + // second pass: traverse other object's elements + for (auto it = target.begin(); it != target.end(); ++it) + { + if (source.find(it.key()) == source.end()) + { + // found a key that is not in this -> add it + const auto key = json_pointer::escape(it.key()); + result.push_back( + { + {"op", "add"}, {"path", path + "/" + key}, + {"value", it.value()} + }); + } + } + + break; + } + + default: + { + // both primitive type: replace value + result.push_back( + { + {"op", "replace"}, {"path", path}, {"value", target} + }); + break; + } + } + } + + return result; + } + + /// @} +}; + +///////////// +// presets // +///////////// + +/*! +@brief default JSON class + +This type is the default specialization of the @ref basic_json class which +uses the standard template types. + +@since version 1.0.0 +*/ +using json = basic_json<>; + +////////////////// +// json_pointer // +////////////////// + +NLOHMANN_BASIC_JSON_TPL_DECLARATION +NLOHMANN_BASIC_JSON_TPL& +json_pointer::get_and_create(NLOHMANN_BASIC_JSON_TPL& j) const +{ + using size_type = typename NLOHMANN_BASIC_JSON_TPL::size_type; + auto result = &j; + + // in case no reference tokens exist, return a reference to the JSON value + // j which will be overwritten by a primitive value + for (const auto& reference_token : reference_tokens) + { + switch (result->m_type) + { + case detail::value_t::null: + { + if (reference_token == "0") + { + // start a new array if reference token is 0 + result = &result->operator[](0); + } + else + { + // start a new object otherwise + result = &result->operator[](reference_token); + } + break; + } + + case detail::value_t::object: + { + // create an entry in the object + result = &result->operator[](reference_token); + break; + } + + case detail::value_t::array: + { + // create an entry in the array + JSON_TRY + { + result = &result->operator[](static_cast(std::stoi(reference_token))); + } + JSON_CATCH(std::invalid_argument&) + { + JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number")); + } + break; + } + + /* + The following code is only reached if there exists a reference + token _and_ the current value is primitive. In this case, we have + an error situation, because primitive values may only occur as + single value; that is, with an empty list of reference tokens. + */ + default: + JSON_THROW(detail::type_error::create(313, "invalid value to unflatten")); + } + } + + return *result; +} + +NLOHMANN_BASIC_JSON_TPL_DECLARATION +NLOHMANN_BASIC_JSON_TPL& +json_pointer::get_unchecked(NLOHMANN_BASIC_JSON_TPL* ptr) const +{ + using size_type = typename NLOHMANN_BASIC_JSON_TPL::size_type; + for (const auto& reference_token : reference_tokens) + { + // convert null values to arrays or objects before continuing + if (ptr->m_type == detail::value_t::null) + { + // check if reference token is a number + const bool nums = + std::all_of(reference_token.begin(), reference_token.end(), + [](const char x) + { + return (x >= '0' and x <= '9'); + }); + + // change value to array for numbers or "-" or to object otherwise + *ptr = (nums or reference_token == "-") + ? detail::value_t::array + : detail::value_t::object; + } + + switch (ptr->m_type) + { + case detail::value_t::object: + { + // use unchecked object access + ptr = &ptr->operator[](reference_token); + break; + } + + case detail::value_t::array: + { + // error condition (cf. RFC 6901, Sect. 4) + if (JSON_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0')) + { + JSON_THROW(detail::parse_error::create(106, 0, + "array index '" + reference_token + + "' must not begin with '0'")); + } + + if (reference_token == "-") + { + // explicitly treat "-" as index beyond the end + ptr = &ptr->operator[](ptr->m_value.array->size()); + } + else + { + // convert array index to number; unchecked access + JSON_TRY + { + ptr = &ptr->operator[]( + static_cast(std::stoi(reference_token))); + } + JSON_CATCH(std::invalid_argument&) + { + JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number")); + } + } + break; + } + + default: + JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'")); + } + } + + return *ptr; +} + +NLOHMANN_BASIC_JSON_TPL_DECLARATION +NLOHMANN_BASIC_JSON_TPL& +json_pointer::get_checked(NLOHMANN_BASIC_JSON_TPL* ptr) const +{ + using size_type = typename NLOHMANN_BASIC_JSON_TPL::size_type; + for (const auto& reference_token : reference_tokens) + { + switch (ptr->m_type) + { + case detail::value_t::object: + { + // note: at performs range check + ptr = &ptr->at(reference_token); + break; + } + + case detail::value_t::array: + { + if (JSON_UNLIKELY(reference_token == "-")) + { + // "-" always fails the range check + JSON_THROW(detail::out_of_range::create(402, + "array index '-' (" + std::to_string(ptr->m_value.array->size()) + + ") is out of range")); + } + + // error condition (cf. RFC 6901, Sect. 4) + if (JSON_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0')) + { + JSON_THROW(detail::parse_error::create(106, 0, + "array index '" + reference_token + + "' must not begin with '0'")); + } + + // note: at performs range check + JSON_TRY + { + ptr = &ptr->at(static_cast(std::stoi(reference_token))); + } + JSON_CATCH(std::invalid_argument&) + { + JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number")); + } + break; + } + + default: + JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'")); + } + } + + return *ptr; +} + +NLOHMANN_BASIC_JSON_TPL_DECLARATION +const NLOHMANN_BASIC_JSON_TPL& +json_pointer::get_unchecked(const NLOHMANN_BASIC_JSON_TPL* ptr) const +{ + using size_type = typename NLOHMANN_BASIC_JSON_TPL::size_type; + for (const auto& reference_token : reference_tokens) + { + switch (ptr->m_type) + { + case detail::value_t::object: + { + // use unchecked object access + ptr = &ptr->operator[](reference_token); + break; + } + + case detail::value_t::array: + { + if (JSON_UNLIKELY(reference_token == "-")) + { + // "-" cannot be used for const access + JSON_THROW(detail::out_of_range::create(402, + "array index '-' (" + std::to_string(ptr->m_value.array->size()) + + ") is out of range")); + } + + // error condition (cf. RFC 6901, Sect. 4) + if (JSON_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0')) + { + JSON_THROW(detail::parse_error::create(106, 0, + "array index '" + reference_token + + "' must not begin with '0'")); + } + + // use unchecked array access + JSON_TRY + { + ptr = &ptr->operator[]( + static_cast(std::stoi(reference_token))); + } + JSON_CATCH(std::invalid_argument&) + { + JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number")); + } + break; + } + + default: + JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'")); + } + } + + return *ptr; +} + +NLOHMANN_BASIC_JSON_TPL_DECLARATION +const NLOHMANN_BASIC_JSON_TPL& +json_pointer::get_checked(const NLOHMANN_BASIC_JSON_TPL* ptr) const +{ + using size_type = typename NLOHMANN_BASIC_JSON_TPL::size_type; + for (const auto& reference_token : reference_tokens) + { + switch (ptr->m_type) + { + case detail::value_t::object: + { + // note: at performs range check + ptr = &ptr->at(reference_token); + break; + } + + case detail::value_t::array: + { + if (JSON_UNLIKELY(reference_token == "-")) + { + // "-" always fails the range check + JSON_THROW(detail::out_of_range::create(402, + "array index '-' (" + std::to_string(ptr->m_value.array->size()) + + ") is out of range")); + } + + // error condition (cf. RFC 6901, Sect. 4) + if (JSON_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0')) + { + JSON_THROW(detail::parse_error::create(106, 0, + "array index '" + reference_token + + "' must not begin with '0'")); + } + + // note: at performs range check + JSON_TRY + { + ptr = &ptr->at(static_cast(std::stoi(reference_token))); + } + JSON_CATCH(std::invalid_argument&) + { + JSON_THROW(detail::parse_error::create(109, 0, "array index '" + reference_token + "' is not a number")); + } + break; + } + + default: + JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'")); + } + } + + return *ptr; +} + +NLOHMANN_BASIC_JSON_TPL_DECLARATION +void json_pointer::flatten(const std::string& reference_string, + const NLOHMANN_BASIC_JSON_TPL& value, + NLOHMANN_BASIC_JSON_TPL& result) +{ + switch (value.m_type) + { + case detail::value_t::array: + { + if (value.m_value.array->empty()) + { + // flatten empty array as null + result[reference_string] = nullptr; + } + else + { + // iterate array and use index as reference string + for (std::size_t i = 0; i < value.m_value.array->size(); ++i) + { + flatten(reference_string + "/" + std::to_string(i), + value.m_value.array->operator[](i), result); + } + } + break; + } + + case detail::value_t::object: + { + if (value.m_value.object->empty()) + { + // flatten empty object as null + result[reference_string] = nullptr; + } + else + { + // iterate object and use keys as reference string + for (const auto& element : *value.m_value.object) + { + flatten(reference_string + "/" + escape(element.first), element.second, result); + } + } + break; + } + + default: + { + // add primitive value with its reference string + result[reference_string] = value; + break; + } + } +} + +NLOHMANN_BASIC_JSON_TPL_DECLARATION +NLOHMANN_BASIC_JSON_TPL +json_pointer::unflatten(const NLOHMANN_BASIC_JSON_TPL& value) +{ + if (JSON_UNLIKELY(not value.is_object())) + { + JSON_THROW(detail::type_error::create(314, "only objects can be unflattened")); + } + + NLOHMANN_BASIC_JSON_TPL result; + + // iterate the JSON object values + for (const auto& element : *value.m_value.object) + { + if (JSON_UNLIKELY(not element.second.is_primitive())) + { + JSON_THROW(detail::type_error::create(315, "values in object must be primitive")); + } + + // assign value to reference pointed to by JSON pointer; Note that if + // the JSON pointer is "" (i.e., points to the whole value), function + // get_and_create returns a reference to result itself. An assignment + // will then create a primitive value. + json_pointer(element.first).get_and_create(result) = element.second; + } + + return result; +} + +inline bool operator==(json_pointer const& lhs, json_pointer const& rhs) noexcept +{ + return (lhs.reference_tokens == rhs.reference_tokens); +} + +inline bool operator!=(json_pointer const& lhs, json_pointer const& rhs) noexcept +{ + return not (lhs == rhs); +} +} // namespace nlohmann + + +/////////////////////// +// nonmember support // +/////////////////////// + +// specialization of std::swap, and std::hash +namespace std +{ +/*! +@brief exchanges the values of two JSON objects + +@since version 1.0.0 +*/ +template<> +inline void swap(nlohmann::json& j1, + nlohmann::json& j2) noexcept( + is_nothrow_move_constructible::value and + is_nothrow_move_assignable::value + ) +{ + j1.swap(j2); +} + +/// hash value for JSON objects +template<> +struct hash +{ + /*! + @brief return a hash value for a JSON object + + @since version 1.0.0 + */ + std::size_t operator()(const nlohmann::json& j) const + { + // a naive hashing via the string representation + const auto& h = hash(); + return h(j.dump()); + } +}; + +/// specialization for std::less +/// @note: do not remove the space after '<', +/// see https://github.com/nlohmann/json/pull/679 +template<> +struct less< ::nlohmann::detail::value_t> +{ + /*! + @brief compare two value_t enum values + @since version 3.0.0 + */ + bool operator()(nlohmann::detail::value_t lhs, + nlohmann::detail::value_t rhs) const noexcept + { + return nlohmann::detail::operator<(lhs, rhs); + } +}; + +} // namespace std + +/*! +@brief user-defined string literal for JSON values + +This operator implements a user-defined string literal for JSON objects. It +can be used by adding `"_json"` to a string literal and returns a JSON object +if no parse error occurred. + +@param[in] s a string representation of a JSON object +@param[in] n the length of string @a s +@return a JSON object + +@since version 1.0.0 +*/ +inline nlohmann::json operator "" _json(const char* s, std::size_t n) +{ + return nlohmann::json::parse(s, s + n); +} + +/*! +@brief user-defined string literal for JSON pointer + +This operator implements a user-defined string literal for JSON Pointers. It +can be used by adding `"_json_pointer"` to a string literal and returns a JSON pointer +object if no parse error occurred. + +@param[in] s a string representation of a JSON Pointer +@param[in] n the length of string @a s +@return a JSON pointer object + +@since version 2.0.0 +*/ +inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t n) +{ + return nlohmann::json::json_pointer(std::string(s, n)); +} + +// restore GCC/clang diagnostic settings +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) + #pragma GCC diagnostic pop +#endif +#if defined(__clang__) + #pragma GCC diagnostic pop +#endif + +// clean up +#undef JSON_CATCH +#undef JSON_THROW +#undef JSON_TRY +#undef JSON_LIKELY +#undef JSON_UNLIKELY +#undef JSON_DEPRECATED +#undef NLOHMANN_BASIC_JSON_TPL_DECLARATION +#undef NLOHMANN_BASIC_JSON_TPL + +#endif diff --git a/PlottWareControl/obj/Debug/PlottWareControlApp.o b/PlottWareControl/obj/Debug/PlottWareControlApp.o new file mode 100644 index 0000000..26ac7dc Binary files /dev/null and b/PlottWareControl/obj/Debug/PlottWareControlApp.o differ diff --git a/PlottWareControl/obj/Debug/PlottWareControlMain.o b/PlottWareControl/obj/Debug/PlottWareControlMain.o new file mode 100644 index 0000000..5956229 Binary files /dev/null and b/PlottWareControl/obj/Debug/PlottWareControlMain.o differ diff --git a/PlottWareControl/obj/Debug/SettingDialog.o b/PlottWareControl/obj/Debug/SettingDialog.o new file mode 100644 index 0000000..1dd6d97 Binary files /dev/null and b/PlottWareControl/obj/Debug/SettingDialog.o differ diff --git a/PlottWareControl/obj/Debug/image.o b/PlottWareControl/obj/Debug/image.o new file mode 100644 index 0000000..eaeea8e Binary files /dev/null and b/PlottWareControl/obj/Debug/image.o differ diff --git a/PlottWareControl/obj/Debug/point.o b/PlottWareControl/obj/Debug/point.o new file mode 100644 index 0000000..af8717c Binary files /dev/null and b/PlottWareControl/obj/Debug/point.o differ diff --git a/PlottWareControl/obj/Debug/printer.o b/PlottWareControl/obj/Debug/printer.o new file mode 100644 index 0000000..95e623c Binary files /dev/null and b/PlottWareControl/obj/Debug/printer.o differ diff --git a/PlottWareControl/obj/Debug/project.o b/PlottWareControl/obj/Debug/project.o new file mode 100644 index 0000000..d5f3e93 Binary files /dev/null and b/PlottWareControl/obj/Debug/project.o differ diff --git a/PlottWareControl/obj/Debug/resource.res b/PlottWareControl/obj/Debug/resource.res new file mode 100644 index 0000000..9678b97 Binary files /dev/null and b/PlottWareControl/obj/Debug/resource.res differ diff --git a/PlottWareControl/obj/Debug/serial.o b/PlottWareControl/obj/Debug/serial.o new file mode 100644 index 0000000..0c31df1 Binary files /dev/null and b/PlottWareControl/obj/Debug/serial.o differ diff --git a/PlottWareControl/obj/Debug/settings.o b/PlottWareControl/obj/Debug/settings.o new file mode 100644 index 0000000..c26a860 Binary files /dev/null and b/PlottWareControl/obj/Debug/settings.o differ diff --git a/PlottWareControl/obj/Release/GcodeEditorDialog.o b/PlottWareControl/obj/Release/GcodeEditorDialog.o new file mode 100644 index 0000000..b0625f6 Binary files /dev/null and b/PlottWareControl/obj/Release/GcodeEditorDialog.o differ diff --git a/PlottWareControl/obj/Release/PlottWareControlApp.o b/PlottWareControl/obj/Release/PlottWareControlApp.o new file mode 100644 index 0000000..5e3e24f Binary files /dev/null and b/PlottWareControl/obj/Release/PlottWareControlApp.o differ diff --git a/PlottWareControl/obj/Release/PlottWareControlMain.o b/PlottWareControl/obj/Release/PlottWareControlMain.o new file mode 100644 index 0000000..18a9c04 Binary files /dev/null and b/PlottWareControl/obj/Release/PlottWareControlMain.o differ diff --git a/PlottWareControl/obj/Release/SettingDialog.o b/PlottWareControl/obj/Release/SettingDialog.o new file mode 100644 index 0000000..b65d23b Binary files /dev/null and b/PlottWareControl/obj/Release/SettingDialog.o differ diff --git a/PlottWareControl/obj/Release/image.o b/PlottWareControl/obj/Release/image.o new file mode 100644 index 0000000..be3eeca Binary files /dev/null and b/PlottWareControl/obj/Release/image.o differ diff --git a/PlottWareControl/obj/Release/imageViewer.o b/PlottWareControl/obj/Release/imageViewer.o new file mode 100644 index 0000000..c272beb Binary files /dev/null and b/PlottWareControl/obj/Release/imageViewer.o differ diff --git a/PlottWareControl/obj/Release/point.o b/PlottWareControl/obj/Release/point.o new file mode 100644 index 0000000..af8717c Binary files /dev/null and b/PlottWareControl/obj/Release/point.o differ diff --git a/PlottWareControl/obj/Release/printer.o b/PlottWareControl/obj/Release/printer.o new file mode 100644 index 0000000..8b3588b Binary files /dev/null and b/PlottWareControl/obj/Release/printer.o differ diff --git a/PlottWareControl/obj/Release/project.o b/PlottWareControl/obj/Release/project.o new file mode 100644 index 0000000..464b29e Binary files /dev/null and b/PlottWareControl/obj/Release/project.o differ diff --git a/PlottWareControl/obj/Release/resource.res b/PlottWareControl/obj/Release/resource.res new file mode 100644 index 0000000..9678b97 Binary files /dev/null and b/PlottWareControl/obj/Release/resource.res differ diff --git a/PlottWareControl/obj/Release/serial.o b/PlottWareControl/obj/Release/serial.o new file mode 100644 index 0000000..36b28aa Binary files /dev/null and b/PlottWareControl/obj/Release/serial.o differ diff --git a/PlottWareControl/obj/Release/settings.o b/PlottWareControl/obj/Release/settings.o new file mode 100644 index 0000000..f56ca15 Binary files /dev/null and b/PlottWareControl/obj/Release/settings.o differ diff --git a/PlottWareControl/point.cpp b/PlottWareControl/point.cpp new file mode 100644 index 0000000..44f15f3 --- /dev/null +++ b/PlottWareControl/point.cpp @@ -0,0 +1,27 @@ +#include "point.h" + +Point::Point(){ + x=0; + y=0; +} + +Point::Point(float _x, float _y){ + x=_x; + y=_y; +} + +float Point::getX(){ + return x; +} + +float Point::getY(){ + return y; +} + +void Point::setX(float _x){ + x=_x; +} + +void Point::setY(float _y){ + y=_y; +} diff --git a/PlottWareControl/point.h b/PlottWareControl/point.h new file mode 100644 index 0000000..82652f2 --- /dev/null +++ b/PlottWareControl/point.h @@ -0,0 +1,16 @@ +#ifndef POINT_H_INCLUDED +#define POINT_H_INCLUDED + +class Point{ + float x; + float y; +public: + Point(); + Point(float _x, float _y); + float getX(); + float getY(); + void setX(float _x); + void setY(float _y); +}; + +#endif // POINT_H_INCLUDED diff --git a/PlottWareControl/printer.cpp b/PlottWareControl/printer.cpp new file mode 100644 index 0000000..afdf548 --- /dev/null +++ b/PlottWareControl/printer.cpp @@ -0,0 +1,143 @@ +#include "printer.h" + +Printer::Printer(){ + position=Point(-1, -1); + length=0; + width=0; + pencount=0; + port=0; +} + +Printer::Printer(long int _length, long int _width, int _pencount, std::map _pens, int _port, long int _baudrate){ + length=_length; + width=_width; + pencount=_pencount; + pens=_pens; + port=_port; + baudrate=_baudrate; + com=Serial(); +} + +Point Printer::getPosition(){ + //get head position + send("M114\n"); + std::string r=recv(); + position=Point(std::stoi(r.substr(r.find("X:")+2, r.find(" ", r.find("X:")))), std::stoi(r.substr(r.find("Y:")+2, r.find(" ", r.find("Y:"))))); + return position; +} + +long int Printer::getLength(){ + return length; +} + +long int Printer::getWidth(){ + return width; +} + +int Printer::getPenCount(){ + return pencount; +} + +std::map Printer::getPens(){ + return pens; +} + +bool Printer::getPowerState(){ + return power; +} + +std::string Printer::getPort(){ + return "COM"+std::to_string(port); +} + +int Printer::getPortInt(){ + return port; +} + +long int Printer::getBaudRate(){ + return baudrate; +} + +bool Printer::setSettings(long int _length, long int _width, int _pencount, std::map _pens, int _port, long int _baudrate){ + length=_length; + width=_width; + pencount=_pencount; + pens=_pens; + port=_port; + baudrate=_baudrate; +} + +bool Printer::setComParameters(int _port, long int _baudrate){ + port=_port; + baudrate=_baudrate; +} + +bool Printer::connect(){ + std::string p="\\\\.\\COM"+std::to_string(port); + if(!com.conn(p.c_str(), baudrate)){ + return false; + } + + //get pwr state + send("M115\n"); + std::string r=recv(); + try{ + nlohmann::json j=nlohmann::json::parse(r); + power=j["power"]; + } + catch(nlohmann::json::parse_error &e){ + fprintf(stderr, "ERROR> Can not parse JSON response from printer for M115. Message: %s; position: %i. At: Printer::autoDetect() (file: %s, line: %i)\n", e.what(), e.byte, __FILE__, __LINE__); + return false; + } + + //get head position + getPosition(); + + return true; +} + +void Printer::disconnect(){ + com.disconn(); +} + +bool Printer::isConnected(){ + return com.IsConnected(); +} + +bool Printer::send(std::string s){ + if(!isConnected()){ + return false; + } + com.WriteData(s.c_str(), s.size()); + return true; +} + +std::string Printer::recv(){ + char buff[501]; + com.ReadData(buff, 500); + return std::string(buff); +} + +bool Printer::autoDetect(){ + if(isConnected()){ + send("M115\n"); //get info from the firmware + std::string r=recv(); + try{ + nlohmann::json j=nlohmann::json::parse(r); + length=j["length"]; + width=j["width"]; + pencount=j["pencount"]; + pens.clear(); + for(int i=0; i Can not parse JSON response from printer for M115. Message: %s; position: %i. At: Printer::autoDetect() (file: %s, line: %i)\n", e.what(), e.byte, __FILE__, __LINE__); + return false; + } + + return true; + } + return false; +} diff --git a/PlottWareControl/printer.h b/PlottWareControl/printer.h new file mode 100644 index 0000000..1b5d4a4 --- /dev/null +++ b/PlottWareControl/printer.h @@ -0,0 +1,45 @@ +#ifndef PRINTER_H_INCLUDED +#define PRINTER_H_INCLUDED + +#include +#include +#include "serial.h" +#include "json.hpp" +#include "point.h" + +class Printer{ + Point position; + long int length; + long int width; + int pencount; + std::map pens; + bool power; + int port; + long int baudrate; + Serial com; +public: + Printer(); + Printer(long int _length, long int _width, int _pencount, std::map _pens, int _port, long int _baudrate); + + Point getPosition(); + long int getLength(); + long int getWidth(); + int getPenCount(); + std::map getPens(); + bool getPowerState(); + std::string getPort(); + int getPortInt(); + long int getBaudRate(); + + bool setSettings(long int _length, long int _width, int _pencount, std::map _pens, int _port, long int _baudrate); + bool setComParameters(int _port, long int _baudrate); + + bool connect(); + void disconnect(); + bool isConnected(); + bool send(std::string s); + std::string recv(); + bool autoDetect(); +}; + +#endif // PRINTER_H_INCLUDED diff --git a/PlottWareControl/project.cpp b/PlottWareControl/project.cpp new file mode 100644 index 0000000..7f5b9ef --- /dev/null +++ b/PlottWareControl/project.cpp @@ -0,0 +1,317 @@ +#include "project.h" + +Project::Project(Settings* _settings){ + settings=_settings; + filename=""; + retrmode=CV_RETR_LIST; + cannythresh=100; + gcode=""; + ivcombined=ImageViewer(&combined, "Images"); + ivprocessed=ImageViewer(&processed, "Processing"); +} + +Project::Project(Settings* _settings, std::string _filename){ + settings=_settings; + filename=_filename; + retrmode=CV_RETR_LIST; + cannythresh=100; + gcode=""; + ivcombined=ImageViewer(&combined, "Images"); + ivprocessed=ImageViewer(&processed, "Processing"); +} + +std::vector* Project::getImages(){ + return &images; +} + +int Project::getRetrMode(){ + return retrmode; +} + +int Project::getCannyThresh(){ + return cannythresh; +} + +std::map* Project::getColoring(){ + return &coloring; +} + +std::string* Project::getGcode(){ + return &gcode; +} + +void Project::setFileName(std::string _filename){ + filename=_filename; +} + +void Project::setRetrMode(int _retrmode){ + retrmode=_retrmode; +} + +void Project::setCannyThresh(int _cannythresh){ + cannythresh=_cannythresh; +} + +bool Project::newProj(){ + //create files, save def, etc + FILE* f=fopen(filename.c_str(), "w"); + if(!f){ + fprintf(stderr, "Error> Creating file for project. At: Project::newProj() (file: %s, line: %i)\n", __FILE__, __LINE__); + return false; + } + fprintf(f,""); + fclose(f); + return true; +} + +void Project::loadProj(){ + //load stuff, deserialize +} + +void Project::save(){ + //serialize, save to file +} + +void Project::close(){ + //close project, free up resources; + cv::destroyAllWindows(); +} + +bool Project::combine(){ + //get col and row count + int colmax=0, rowmax=0; + for(std::vector::iterator it=images.begin(); itgetMat(); + + //get resized mat + cv::Mat resz; + cv::resize(cur, resz, cv::Size(cur.cols*it->getScale(), cur.rows*it->getScale())); + + //get cropped mat + cv::Mat crop=resz(cv::Rect(it->getCrop1().getX(), it->getCrop1().getY(), (it->getCrop2().getX()-it->getCrop1().getX())*it->getScale(), (it->getCrop2().getY()-it->getCrop1().getY())*it->getScale())); + + //crop debug + if(settings->isDebug()){ + ImageViewer* iv=new ImageViewer(crop, "DEBUG:combine> "+it->getFilename()); + iv->show(); + } + + if(it->getPosition().getX()+crop.cols > colmax){ + colmax=it->getPosition().getX()+crop.cols; + } + if(it->getPosition().getY()+crop.rows > rowmax){ + rowmax=it->getPosition().getY()+crop.rows; + } + + //cleanup + resz.release(); + crop.release(); + } + + if(settings->isDebug()){ + printf("DEBUG:combine> colmax=%i, rowmax=%i\n", colmax, rowmax); + } + + //create new mat + combined=cv::Mat::zeros(rowmax, colmax, CV_8UC3); + + //add layers + for(std::vector::iterator it=images.begin(); itgetMat(); + + //get resized mat + cv::Mat resz; + cv::resize(cur, resz, cv::Size(cur.cols*it->getScale(), cur.rows*it->getScale())); + + //get cropped mat + cv::Mat crop=resz(cv::Rect(it->getCrop1().getX()*it->getScale(), it->getCrop1().getY()*it->getScale(), (it->getCrop2().getX()-it->getCrop1().getX())*it->getScale(), (it->getCrop2().getY()-it->getCrop1().getY())*it->getScale())); + + //add layer + crop.copyTo(combined(cv::Rect(it->getPosition().getX(), it->getPosition().getY(), crop.cols, crop.rows))); + + //cleanup + resz.release(); + crop.release(); + } + + //show results + ivcombined.refresh(); + + //everything alright + return true; +} + +bool Project::process(){ + if(combined.empty()){ + return false; + } + + //convert mat to gray + cv::Mat graymat; + cv::cvtColor(combined, graymat, CV_BGR2GRAY); + if(settings->isDebug()){ + ImageViewer* iv=new ImageViewer(graymat, "DEBUG:process> cvtColor"); + iv->show(); + } + + //blur edges + cv::blur(graymat, graymat, cv::Size(3, 3)); + if(settings->isDebug()){ + ImageViewer* iv=new ImageViewer(graymat, "DEBUG:process> blur"); + iv->show(); + } + + //canny edge detection + cv::Mat canny; + cv::Canny(graymat, canny, cannythresh, cannythresh*2, 3); + if(settings->isDebug()){ + ImageViewer* iv=new ImageViewer(canny, "DEBUG:process> Canny"); + iv->show(); + } + + //find contours + cv::findContours(canny, contours, hierarchy, retrmode, CV_CHAIN_APPROX_SIMPLE, cv::Point(0, 0)); + + //build color map if not ready + if(coloring.size()!=contours.size()){ + coloring.clear(); + for(int i=0; i maxX){ + maxX=contours[i][0].x/10.0; + } + if(contours[i][0].y/10.0 > maxY){ + maxY=contours[i][0].y/10.0; + } + + //move pen down + gcode+="M300 S10\n"; + lines+=4; + + //iterate through points + for(int o=1; o maxX){ + maxX=contours[i][o].x/10.0; + } + if(contours[i][o].y/10.0 > maxY){ + maxY=contours[i][o].y/10.0; + } + lines++; + } + + //lift up pen + gcode+="M300 S50\n"; + lines+=1; + } + + //end + gcode+="T1000 ;deselect tool\n"; + gcode+="M18 ;disable steppers\n"; + gcode+="M2 ;program end\n"; + lines+=3; + + //print "final thoughts" + lines+=7; + gcode+="\n\n\n;Line count: "+std::to_string(lines)+"\n;Max X: "+std::to_string(maxX)+"\n;Max Y: "+std::to_string(maxY)+"\n;ENJOY!"; +} + +bool Project::exportGcode(std::string file){ + FILE* f=fopen(file.c_str(), "w"); + if(!f){ + fprintf(stderr, "Error> Can't create file for gcode export. At: Project::exportGcode(std::string file) (file: %s, line: %i)\n", __FILE__, __LINE__); + return false; + } + + fprintf(f, "%s", gcode.c_str()); + fclose(f); + return true; +} diff --git a/PlottWareControl/project.h b/PlottWareControl/project.h new file mode 100644 index 0000000..531cc70 --- /dev/null +++ b/PlottWareControl/project.h @@ -0,0 +1,63 @@ +#ifndef PROJECT_H_INCLUDED +#define PROJECT_H_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include "image.h" +#include "settings.h" +#include "imageViewer.h" + +class Project{ + Settings* settings; + std::string filename; + std::vector images; + cv::Mat combined; + cv::Mat processed; + int retrmode; + int cannythresh; + std::vector< std::vector > contours; + std::vector hierarchy; + std::map coloring; + std::string gcode; + + //image viewers: + ImageViewer ivcombined; + ImageViewer ivprocessed; +public: + Project(Settings* _settings); + Project(Settings* _settings, std::string _filename); + std::vector* getImages(); + int getRetrMode(); + int getCannyThresh(); + std::map* getColoring(); + std::string* getGcode(); + void setFileName(std::string _filename); + void setRetrMode(int _retrmode); + void setCannyThresh(int _cannythresh); + + //project operations + bool newProj(); + void loadProj(); + void save(); + void close(); + + //processing operations + bool combine(); + bool process(); + bool printEdge(int n); + + //gcode operations + bool generateGcode(); + bool exportGcode(std::string file); + + //print status + unsigned long int printStatus; + bool printStop; +}; + +#endif // PROJECT_H_INCLUDED diff --git a/PlottWareControl/res/gCode.txt b/PlottWareControl/res/gCode.txt new file mode 100644 index 0000000..f76c085 --- /dev/null +++ b/PlottWareControl/res/gCode.txt @@ -0,0 +1,24 @@ +commands: +G0 Xx Yy - Rapid move to (z,y) coordinates +G1 Xx Yy - Move to (x,y) coordinates +G4 Pn - Wait n ms +G28 - Home +G90 - Set to absolute positioning +G91 - Set to relative positioning +Tn - change to nth tool +M2 - Program end +M17 - Enable steppers +M18 - Disable steppers +M80 - ATX power on +M81 - ATX power off +M112 - Emergency stop +M114 - Get current position +M115 - Get info from printer firmware +M118 OK - Response to host when line done +; - line comment +(...) - block comment + + +M114 response: X:x Y:y +M115 response: {"software":"PlottWareFirmware v1.0","power":true/false,"length":L,"width":W,"pencount":PC,"pens":["C1","C2","C3"]} +Deselect tool: T0 ot T1000 \ No newline at end of file diff --git a/PlottWareControl/res/icon.bmp b/PlottWareControl/res/icon.bmp new file mode 100644 index 0000000..e83a7dd Binary files /dev/null and b/PlottWareControl/res/icon.bmp differ diff --git a/PlottWareControl/resource.rc b/PlottWareControl/resource.rc new file mode 100644 index 0000000..553c482 --- /dev/null +++ b/PlottWareControl/resource.rc @@ -0,0 +1,3 @@ +aaaa ICON "wx/msw/std.ico" + +#include "wx/msw/wx.rc" diff --git a/PlottWareControl/serial.cpp b/PlottWareControl/serial.cpp new file mode 100644 index 0000000..bce1e97 --- /dev/null +++ b/PlottWareControl/serial.cpp @@ -0,0 +1,175 @@ +#include "serial.h" + +/** +Got from: https://playground.arduino.cc/Interfacing/CPPWindows +**/ + +Serial::Serial(){ + //We're not yet connected + this->connected = false; + return; +} + +bool Serial::conn(const char *portName, int baud) +{ + if(this->connected){ + return false; //we're already connected; + } + //Try to connect to the given port throuh CreateFile + this->hSerial = CreateFileA(portName, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + + //Check if the connection was successfull + if(this->hSerial==INVALID_HANDLE_VALUE) + { + //If not success full display an Error + if(GetLastError()==ERROR_FILE_NOT_FOUND){ + + //Print Error if neccessary + fprintf(stderr, "ERROR> Handle was not attached. Reason: %s not available. At: Serial::conn(const char *portName, int baud) (file: %s, line: %i)\n", portName, __FILE__, __LINE__); + return false; + + } + else + { + fprintf(stderr, "ERROR> Serial connection failed. At: Serial::conn(const char *portName, int baud) (file: %s, line: %i)\n", __FILE__, __LINE__); + return false; + } + } + else + { + //If connected we try to set the comm parameters + DCB dcbSerialParams = {0}; + + //Try to get the current + if (!GetCommState(this->hSerial, &dcbSerialParams)) + { + //If impossible, show an error + fprintf(stderr, "ERROR> Failed to get current serial parameters! At: Serial::conn(const char *portName, int baud) (file: %s, line: %i)\n", __FILE__, __LINE__); + return false; + } + else + { + //Define serial connection parameters for the arduino board + dcbSerialParams.BaudRate=baud; + dcbSerialParams.ByteSize=8; + dcbSerialParams.StopBits=ONESTOPBIT; + dcbSerialParams.Parity=NOPARITY; + //Setting the DTR to Control_Enable ensures that the Arduino is properly + //reset upon establishing a connection + dcbSerialParams.fDtrControl = DTR_CONTROL_ENABLE; + + //Set the parameters and check for their proper application + if(!SetCommState(hSerial, &dcbSerialParams)) + { + fprintf(stderr, "ERROR> Could not set Serial Port parameters At: Serial::conn(const char *portName, int baud) (file: %s, line: %i)\n", __FILE__, __LINE__); + return false; + } + else + { + //If everything went fine we're connected + this->connected = true; + //Flush any remaining characters in the buffers + PurgeComm(this->hSerial, PURGE_RXCLEAR | PURGE_TXCLEAR); + //We wait 2s as the arduino board will be reseting + Sleep(ARDUINO_WAIT_TIME); + return true; + } + } + } + +} + +Serial::~Serial() +{ + //Check if we are connected before trying to disconnect + if(this->connected) + { + //We're no longer connected + this->connected = false; + //Close the serial handler + CloseHandle(this->hSerial); + } +} + +void Serial::disconn(){ + //Check if we are connected before trying to disconnect + if(this->connected) + { + //We're no longer connected + this->connected = false; + //Close the serial handler + CloseHandle(this->hSerial); + } +} + +int Serial::ReadData(char *buffer, unsigned int nbChar) +{ + //Number of bytes we'll have read + DWORD bytesRead; + //Number of bytes we'll really ask to read + unsigned int toRead; + + //Use the ClearCommError function to get status info on the Serial port + ClearCommError(this->hSerial, &this->errors, &this->status); + + //block till there's something to read + while(this->status.cbInQue<=0){ + Sleep(10); + } + + //Check if there is something to read + if(this->status.cbInQue>0) + { + //If there is we check if there is enough data to read the required number + //of characters, if not we'll read only the available characters to prevent + //locking of the application. + if(this->status.cbInQue>nbChar) + { + toRead = nbChar; + } + else + { + toRead = this->status.cbInQue; + } + + //Try to read the require number of chars, and return the number of read bytes on success + if(ReadFile(this->hSerial, buffer, toRead, &bytesRead, NULL)) + { + return bytesRead; + } + + } + + //If nothing has been read, or that an error was detected return 0 + return 0; + +} + + +bool Serial::WriteData(const char *buffer, unsigned int nbChar) +{ + DWORD bytesSend; + + //Try to write the buffer on the Serial port + if(!WriteFile(this->hSerial, (void *)buffer, nbChar, &bytesSend, 0)) + { + //In case it don't work get comm error and return false + ClearCommError(this->hSerial, &this->errors, &this->status); + + return false; + } + else + return true; +} + +bool Serial::IsConnected() +{ + //Simply return the connection status + return this->connected; +} diff --git a/PlottWareControl/serial.h b/PlottWareControl/serial.h new file mode 100644 index 0000000..7dd3563 --- /dev/null +++ b/PlottWareControl/serial.h @@ -0,0 +1,46 @@ +#ifndef SERIAL_H_INCLUDED +#define SERIAL_H_INCLUDED + +//#include +#include +#include +#include + +#define ARDUINO_WAIT_TIME 2000 + +/** +Got from: https://playground.arduino.cc/Interfacing/CPPWindows +**/ + +class Serial +{ + private: + //Serial comm handler + HANDLE hSerial; + //Connection status + bool connected; + //Get various information about the connection + COMSTAT status; + //Keep track of last error + DWORD errors; + + public: + //Initialize Serial communication with the given COM port + Serial(); + bool conn(const char *portName, int baud); + //Close the connection + ~Serial(); + void disconn(); + //Read data in a buffer, if nbChar is greater than the + //maximum number of bytes available, it will return only the + //bytes available. The function return -1 when nothing could + //be read, the number of bytes actually read. + int ReadData(char *buffer, unsigned int nbChar); + //Writes data from a buffer through the Serial connection + //return true on success. + bool WriteData(const char *buffer, unsigned int nbChar); + //Check if we are actually connected + bool IsConnected(); +}; + +#endif // SERIAL_H_INCLUDED diff --git a/PlottWareControl/settings.cpp b/PlottWareControl/settings.cpp new file mode 100644 index 0000000..21d63ce --- /dev/null +++ b/PlottWareControl/settings.cpp @@ -0,0 +1,29 @@ +#include "settings.h" + +Settings::Settings(){ + printer=Printer(); + #ifdef PWC_DEBUG + debugmode=true; + #else + debugmode=false; + #endif // PWC_DEBUG +} + +Settings::Settings(Printer _printer, bool _debugmode){ + printer=_printer; + debugmode=_debugmode; +} + +Printer* Settings::getPrinter(){ + return &printer; +} + +bool Settings::isDebug(){ + return debugmode; +} + +bool Settings::setSettings(Printer _printer, bool _debugmode){ + printer=_printer; + debugmode=_debugmode; + return true; +} diff --git a/PlottWareControl/settings.h b/PlottWareControl/settings.h new file mode 100644 index 0000000..c883c0e --- /dev/null +++ b/PlottWareControl/settings.h @@ -0,0 +1,20 @@ +#ifndef SETTINGS_H_INCLUDED +#define SETTINGS_H_INCLUDED + +#include +#include "printer.h" + +class Settings{ + Printer printer; + bool debugmode; +public: + Settings(); + Settings(Printer _printer, bool _debugmode); + + Printer* getPrinter(); + bool isDebug(); + + bool setSettings(Printer _printer, bool _debugmode); +}; + +#endif // SETTINGS_H_INCLUDED diff --git a/PlottWareControl/version.h b/PlottWareControl/version.h new file mode 100644 index 0000000..108cc7e --- /dev/null +++ b/PlottWareControl/version.h @@ -0,0 +1,33 @@ +#ifndef VERSION_H +#define VERSION_H + +namespace Version{ + + //Date Version Types + static const char DATE[] = "06"; + static const char MONTH[] = "12"; + static const char YEAR[] = "2017"; + static const char UBUNTU_VERSION_STYLE[] = "17.12"; + + //Software Status + static const char STATUS[] = "Alpha"; + static const char STATUS_SHORT[] = "a"; + + //Standard Version Type + static const long MAJOR = 0; + static const long MINOR = 1; + static const long BUILD = 5; + static const long REVISION = 28; + + //Miscellaneous Version Types + static const long BUILDS_COUNT = 356; + #define RC_FILEVERSION 0,1,5,28 + #define RC_FILEVERSION_STRING "0, 1, 5, 28\0" + static const char FULLVERSION_STRING [] = "0.1.5.28"; + + //These values are to keep track of your versioning state, don't modify them. + static const long BUILD_HISTORY = 0; + + +} +#endif //VERSION_H diff --git a/PlottWareControl/wxsmith/GcodeEditorDialog.wxs b/PlottWareControl/wxsmith/GcodeEditorDialog.wxs new file mode 100644 index 0000000..593c879 --- /dev/null +++ b/PlottWareControl/wxsmith/GcodeEditorDialog.wxs @@ -0,0 +1,44 @@ + + + + 902,565 + wxSYS_COLOUR_WINDOW + 1 + 1 + + 16,48 + 872,500 + + 10 + + normal + 0 + swiss + Courier New + + + + + + 24,16 + + 16 + + normal + 0 + swiss + + + + + + 704,16 + + + + + 792,16 + + + + diff --git a/PlottWareControl/wxsmith/PlottWareControlframe.wxs b/PlottWareControl/wxsmith/PlottWareControlframe.wxs new file mode 100644 index 0000000..49c270b --- /dev/null +++ b/PlottWareControl/wxsmith/PlottWareControlframe.wxs @@ -0,0 +1,621 @@ + + + + PlottWareControl + .\res\icon.bmp + 473,543 + wxSYS_COLOUR_WINDOW + 0 + + 680,72 + 475,536 + + + 467,421 + wxSYS_COLOUR_WINDOW + + + 16,56 + Create new project + + + + + 16,16 + + 14 + + normal + 0 + swiss + + + + + 104,56 + Open an existing project + + + + 192,56 + 0 + Save current project + + + + 280,56 + 0 + Close current project + + + + + + + + 467,479 + wxSYS_COLOUR_WINDOW + + + 16,16 + + 14 + + normal + 0 + swiss + + + + -1 + 24,56 + 120,168 + + + + + 160,56 + 0 + Load new image + + + + + 160,88 + 0 + Delete selected image + + + + + 16,464 + 432,23 + 0 + Preview images on canvas + + + + + 160,168 + 24,23 + 0 + + + + + 160,200 + 24,23 + 0 + + + + + 24,248 + + + + 88,248 + 120,13 + + + + 24,272 + + + 0 + 88,264 + 120,21 + 0 + + + + 0 + 999999999 + 88,288 + 0 + X coordinate of image + + + + 0 + 999999999 + 88,312 + 0 + X coordinate of image + + + + 0 + 999999999 + 88,336 + 0 + X coordinate of top-left crop point + + + + 0 + 999999999 + 88,360 + 0 + Y coordinate of top-left crop point + + + + 0 + 999999999 + 88,384 + 0 + X coordinate of bottom-right crop point + + + + 0 + 999999999 + 88,408 + 0 + Y coordinate of bottom-right crop point + + + + + 72,296 + 8,13 + + + + 72,320 + + + + 24,296 + + + + 72,344 + + + + 72,368 + + + + 72,392 + + + + 72,416 + + + + 24,344 + + + + + + + wxSYS_COLOUR_WINDOW + + + 16,56 + + + + 16,16 + + 14 + + normal + 0 + swiss + + + + + 1 + 144,56 + 0 + Retrive all borders + + + + + + 192,56 + 0 + Retrive only the external border + + + + + 16,88 + + + 100 + 255 + 144,80 + 0 + Threshold for canny edge detection + + + + + 16,136 + + + + 144,136 + 32,13 + + + + 144,160 + + + 184,128 + 0 + Edge to be colored + + + + + Leave out + + 184,152 + 0 + Used color + + + + + 320,152 + 0 + + + + + 16,208 + 440,23 + 0 + Preview the processed image + + + + + + + + wxSYS_COLOUR_WINDOW + + + 16,16 + + 14 + + normal + 0 + swiss + + + + + 16,56 + 0 + Generate G code + + + + + 104,56 + 0 + Edit generate G code + + + + + 192,56 + 0 + Export G code to file + + + + + + + + wxSYS_COLOUR_WINDOW + + + 16,16 + + 14 + + normal + 0 + swiss + + + + 8,120 + 440,280 + #E0E0E0 + + + 8,8 + + 12 + + normal + 0 + swiss + + + + + 88,8 + + + + 128,8 + 48,13 + + + + 8,32 + 72,23 + Connect/Disconnect to the printer + + + + + 208,40 + 20,20 + 0 + + + + + 208,72 + 20,20 + 0 + + + + + 184,56 + 20,20 + 0 + + 12 + + normal + 0 + swiss + Arial + + + + + + 232,56 + 20,20 + 0 + + 12 + + normal + 0 + swiss + + + + + + 320,8 + 50,23 + 0 + Home axises + + + + + No tool + + 0 + 320,32 + 112,21 + 0 + Select used drawing head + + + + + 280,40 + + + + 384,8 + 50,23 + 0 + Cycle power supply + + + + 25 + 320,64 + 48,21 + 0 + Amount in mm to move when button pressed + + + + 280,72 + + + + 88,32 + + + + 128,32 + 48,13 + + + + 8,64 + + + + 8,80 + + + + 24,64 + 48,13 + + + + 24,80 + 48,13 + + + + 8,120 + + + 64,112 + 360,21 + 0 + + + + -1 + 8,160 + 424,104 + + + + 8,144 + + + + + 16,56 + 0 + Start printing + + + + + 104,56 + 0 + Stop printing + + + + + 320,16 + 128,56 + 0 + #F81F5A + + 10 + + bold + 0 + swiss + + Reset printer immediately + + + + + 24,440 + 1 + + + 1 + 104,432 + 336,36 + 1 + + + + 24,488 + 72,13 + 1 + + + + 104,488 + 336,13 + 1 + + + + + + + + + + + Ctrl-s + Change settings + + + + + Alt-F4 + Quit the application + + + + + + + + F1 + Show info about this application + + + + + + 2 + 375,100 + wxSB_NORMAL,wxSB_NORMAL + + + Select file + + + Message + + + + + + + + diff --git a/PlottWareControl/wxsmith/SettingDialog.wxs b/PlottWareControl/wxsmith/SettingDialog.wxs new file mode 100644 index 0000000..1f2c601 --- /dev/null +++ b/PlottWareControl/wxsmith/SettingDialog.wxs @@ -0,0 +1,162 @@ + + + + 389,432 + wxSYS_COLOUR_WINDOW + + + 0,8 + + 14 + + normal + 0 + swiss + + + + + 8,48 + 376,280 + + + + 32,72 + + + 0 + -1 + 100000 + 104,64 + Length of printing area (-1 for infinite) + + + + 248,72 + + + + 32,96 + + + 0 + -1 + 100000 + 104,88 + Width of printing area (-1 for infinite) + + + + 248,96 + + + + 32,120 + + + 0 + 104,112 + Number of available drawing pens + + + + + 32,144 + + + -1 + 104,136 + 120,80 + List of pens + + + + 264,152 + Color of pen + + + + 232,160 + + + + 232,176 + 136,23 + Set color + + + + 24,232 + 344,3 + + + + 32,248 + + + + 32,272 + + + + 32,296 + Auto detect printer settings (only works if serial port and baud rate is set) + + + + + 16,352 + + + + 96,352 + Enable debug mode (show stages of image processing) + + + + 176,384 + Save settings + + + + + 272,384 + Dismiss changes + + + + + 300 + 600 + 1200 + 2400 + 4800 + 9600 + 14400 + 19200 + 28800 + 38400 + 57600 + 115200 + + 0 + 104,264 + 120,21 + Baud rate of device + + + 0 + 136,240 + 88,21 + Serial port on which the plotter is connected + + + + 104,248 + + + Message + + + + diff --git a/PlottWareFirmware/LICENSE.txt b/PlottWareFirmware/LICENSE.txt new file mode 100644 index 0000000..aae2f33 --- /dev/null +++ b/PlottWareFirmware/LICENSE.txt @@ -0,0 +1,619 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. \ No newline at end of file diff --git a/PlottWareFirmware/PlottWareFirmware.cbp b/PlottWareFirmware/PlottWareFirmware.cbp new file mode 100644 index 0000000..42e76fd --- /dev/null +++ b/PlottWareFirmware/PlottWareFirmware.cbp @@ -0,0 +1,672 @@ + + + + + + diff --git a/PlottWareFirmware/PlottWareFirmware.depend b/PlottWareFirmware/PlottWareFirmware.depend new file mode 100644 index 0000000..8e64f68 --- /dev/null +++ b/PlottWareFirmware/PlottWareFirmware.depend @@ -0,0 +1,115 @@ +# depslib dependency file v1.0 +1512676056 source:c:\users\setup\documents\plotter\plottwarefirmware\plottwarefirmware.ino + + + + "config.h" + "globals.h" + "motors.h" + "gcodeutils.h" + +1371033102 c:\users\setup\downloads\codeblocks-arduino\arduino\hardware\arduino\cores\arduino\arduino.h + + + + + + + "binary.h" + "WCharacter.h" + "WString.h" + "HardwareSerial.h" + "pins_arduino.h" + +1314140394 c:\users\setup\downloads\codeblocks-arduino\include\stdlib.h + <_mingw.h> + + +1314140392 c:\users\setup\downloads\codeblocks-arduino\include\_mingw.h + +1314140394 c:\users\setup\downloads\codeblocks-arduino\include\string.h + <_mingw.h> + + +1314140394 c:\users\setup\downloads\codeblocks-arduino\include\math.h + <_mingw.h> + +1362986950 c:\users\setup\downloads\codeblocks-arduino\arduino\hardware\arduino\cores\arduino\binary.h + +1362986950 c:\users\setup\downloads\codeblocks-arduino\arduino\hardware\arduino\cores\arduino\wcharacter.h + + +1314140392 c:\users\setup\downloads\codeblocks-arduino\include\ctype.h + <_mingw.h> + + +1371033134 c:\users\setup\downloads\codeblocks-arduino\arduino\hardware\arduino\cores\arduino\wstring.h + + + + + +1362986950 c:\users\setup\downloads\codeblocks-arduino\arduino\hardware\arduino\cores\arduino\hardwareserial.h + + "Stream.h" + "USBAPI.h" + +1314140394 c:\users\setup\downloads\codeblocks-arduino\include\inttypes.h + <_mingw.h> + + + +1314140394 c:\users\setup\downloads\codeblocks-arduino\include\stdint.h + + +1371032830 c:\users\setup\downloads\codeblocks-arduino\arduino\hardware\arduino\cores\arduino\stream.h + + "Print.h" + +1362986950 c:\users\setup\downloads\codeblocks-arduino\arduino\hardware\arduino\cores\arduino\print.h + + + "WString.h" + "Printable.h" + +1314140394 c:\users\setup\downloads\codeblocks-arduino\include\stdio.h + <_mingw.h> + + + + +1314140396 c:\users\setup\downloads\codeblocks-arduino\include\sys\types.h + <_mingw.h> + + +1362986950 c:\users\setup\downloads\codeblocks-arduino\arduino\hardware\arduino\cores\arduino\printable.h + + +1362986950 c:\users\setup\downloads\codeblocks-arduino\arduino\hardware\arduino\cores\arduino\new.h + + +1362986950 c:\users\setup\downloads\codeblocks-arduino\arduino\hardware\arduino\cores\arduino\usbapi.h + +1362986950 c:\users\setup\downloads\codeblocks-arduino\arduino\hardware\arduino\variants\standard\pins_arduino.h + + +1512675960 c:\users\setup\documents\plotter\plottwarefirmware\config.h + + +1512674201 c:\users\setup\documents\plotter\plottwarefirmware\globals.h + +1512675473 c:\users\setup\documents\plotter\plottwarefirmware\motors.h + + +1512675391 c:\users\setup\documents\plotter\plottwarefirmware\gcodeutils.h + "Utils.h" + "commandParsers.h" + +1512677478 c:\users\setup\documents\plotter\plottwarefirmware\utils.h + +1512677282 c:\users\setup\documents\plotter\plottwarefirmware\commandparsers.h + + "selfreset.h" + +1512674365 c:\users\setup\documents\plotter\plottwarefirmware\selfreset.h + diff --git a/PlottWareFirmware/PlottWareFirmware.ino b/PlottWareFirmware/PlottWareFirmware.ino new file mode 100644 index 0000000..462fb87 --- /dev/null +++ b/PlottWareFirmware/PlottWareFirmware.ino @@ -0,0 +1,50 @@ +/*************************************************************************** + * Name: PlottWareFirmware.ino + * Purpose: Source and project for the Arduino firmware + * Author: Fandly Gergo (fandlygergo@gmail.hu) + * Created: 2017-12-07 + * Copyright: Copyright (C) 2017 Fandly Gergo (systemtest.tk) + * License: + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + **************************************************************************/ + +#include + +#include +#include + +#include "config.h" +#include "globals.h" +#include "motors.h" +#include "gcodeutils.h" + +void setup(){ + Serial.begin(9600); + motorSetup(); + penSetup(); + penPinsSetup(); + if(XHOME){ + pinMode(XHOME_PIN, INPUT); + } + if(YHOME){ + pinMode(YHOME_PIN, INPUT); + } +} + +void loop(){ + if(Serial.available()){ + String code=Serial.readString(); + parseGcode(code); + } +} diff --git a/PlottWareFirmware/PlottWareFirmware.layout b/PlottWareFirmware/PlottWareFirmware.layout new file mode 100644 index 0000000..9cbcfc4 --- /dev/null +++ b/PlottWareFirmware/PlottWareFirmware.layout @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PlottWareFirmware/Utils.h b/PlottWareFirmware/Utils.h new file mode 100644 index 0000000..0d4b7d1 --- /dev/null +++ b/PlottWareFirmware/Utils.h @@ -0,0 +1,113 @@ +#ifndef UTILS_H_INCLUDED +#define UTILS_H_INCLUDED + +unsigned long int mod(long int a){ + return a>0?a:-a; +} + +double toAbsoluteX(double x){ + return posX+x; +} + +double toAbsoluteY(double y){ + return posY+y; +} + +String removeComments(String code){ + if(code.indexOf(";")!=-1){ + return code.substring(0, code.indexOf(";")); + } + else if(code.indexOf("(")!=-1){ + return code.substring(0, code.indexOf("("))+code.substring(code.indexOf(")")); + } + else{ + return code; + } +} + +double getParameter(String code, char param){ + char b[50]; + code.substring(code.indexOf(param)+1, code.indexOf(" ", code.indexOf(param))).toCharArray(b, 50); + return atof(b); +} + +String getCommand(String code){ + return code.substring(0, code.indexOf(" ")); +} + +void goTo(double x, double y, long speed){ + /** + Makes use of Bresenham algorithm + @link https://www.marginallyclever.com/blog/2013/08/how-to-build-an-2-axis-arduino-cnc-gcode-interpreter/ + **/ + + //set speed + stepperX.setSpeed(speed); + stepperY.setSpeed(speed); + + //convert to something "normal" + if(relative){ + x=toAbsoluteX(x); + y=toAbsoluteY(y); + } + + //maintain limits + if(MAX_X!=-1 && x>MAX_X){ + x=MAX_X; + } + if(MAX_Y !=-1 && y>MAX_Y){ + y=MAX_Y; + } + + //coords to steps + int xsteps=x*STEPX; + int ysteps=y*STEPY; + + //calculate deltas + int dx=abs(xsteps-posX); + int dy=abs(ysteps-posY); + int moveX=x>posX?STEP_INCREMENT:-STEP_INCREMENT; + int moveY=y>posY?STEP_INCREMENT:-STEP_INCREMENT; + + unsigned long int over=0; + + if(dx>dy){ + for(unsigned long int i=0; i=dx){ + over-=dx; + stepperY.step(moveY); + } + delay(STEP_DELAY); + } + } + else{ + for(unsigned long int i=0; i=dy){ + over-=dy; + stepperX.step(moveX); + } + delay(STEP_DELAY); + } + } + + //update coords + posX=x; + posY=y; + posXmm=x; + posYmm=y; +} + +void penUp(int pen, bool up=true){ + if(up){ + digitalWrite(pen_pins[pen], HIGH); + } + else{ + digitalWrite(pen_pins[pen], LOW); + } +} + +#endif // UTILS_H_INCLUDED diff --git a/PlottWareFirmware/build/PlottWareFirmware_uno.elf b/PlottWareFirmware/build/PlottWareFirmware_uno.elf new file mode 100644 index 0000000..475d964 Binary files /dev/null and b/PlottWareFirmware/build/PlottWareFirmware_uno.elf differ diff --git a/PlottWareFirmware/build/PlottWareFirmware_uno.elf.eep.hex b/PlottWareFirmware/build/PlottWareFirmware_uno.elf.eep.hex new file mode 100644 index 0000000..7c166a1 --- /dev/null +++ b/PlottWareFirmware/build/PlottWareFirmware_uno.elf.eep.hex @@ -0,0 +1 @@ +:00000001FF diff --git a/PlottWareFirmware/build/PlottWareFirmware_uno.elf.hex b/PlottWareFirmware/build/PlottWareFirmware_uno.elf.hex new file mode 100644 index 0000000..ee1d630 --- /dev/null +++ b/PlottWareFirmware/build/PlottWareFirmware_uno.elf.hex @@ -0,0 +1,811 @@ +:100000000C9482000C94AA000C94AA000C94AA00F0 +:100010000C94AA000C94AA000C94AA000C94AA00B8 +:100020000C94AA000C94AA000C94AA000C94AA00A8 +:100030000C94AA000C94AA000C94AA000C94AA0098 +:100040000C94B4120C94AA000C948C0F0C94DA0F3C +:100050000C94AA000C94AA000C94AA000C94AA0078 +:100060000C94AA000C94AA000000000024002700B1 +:100070002A0000000000250028002B0000000000DE +:1000800023002600290004040404040404040202DA +:100090000202020203030303030301020408102007 +:1000A0004080010204081020010204081020000012 +:1000B0000007000201000003040600000000000029 +:1000C0000000494E46494E4954594E414ECDCCCC84 +:1000D0003D0AD7233C17B7D13877CC2B329595E61C +:1000E000241FB14F0A000020410000C84200401CFC +:1000F0004620BCBE4CCA1B0E5AAEC59D74004407B8 +:1001000046113D0711241FBECFEFD8E0DEBFCDBFA3 +:1001100011E0A0E0B1E0ECEAF1E302C005900D923D +:10012000AE3EB107D9F713E0AEEEB1E001C01D92CB +:10013000A530B107E1F710E0C2E0D1E004C022979A +:10014000FE010E948318CE3FD107C9F70E949C117F +:100150000C94C9180C940000CF93DF93BC0182303B +:10016000910510F462E070E0A0910103B0910203E8 +:10017000ED01E0E0F0E040E050E021C088819981AD +:100180008617970769F48A819B81309719F09383CA +:10019000828304C09093020380930103FE0134C064 +:1001A0006817790738F44115510519F08417950738 +:1001B00008F4AC01FE018A819B819C01E901209732 +:1001C000E9F641155105A9F1CA01861B970B049761 +:1001D00008F4BA01E0E0F0E02AC08D919C911197FB +:1001E00084179507F9F46417750781F412968D91B9 +:1001F0009C911397309719F09383828304C0909356 +:10020000020380930103FD0132964CC0CA01861B94 +:10021000970BFD01E80FF91F6193719302978D937E +:100220009C9340C0FD01828193819C01D90110976C +:10023000A1F68091FF0290910003892B41F48091F7 +:10024000C9019091CA01909300038093FF024091ED +:10025000CB015091CC014115510541F44DB75EB72A +:100260008091C7019091C801481B590B2091FF0252 +:1002700030910003CA01821B930B8617970780F009 +:10028000AB014E5F5F4F8417950750F0420F531F2D +:10029000509300034093FF02F9016193719302C0F0 +:1002A000E0E0F0E0CF01DF91CF910895CF93DF93AD +:1002B000009709F450C0EC0122971B821A82A0918A +:1002C0000103B0910203109709F140E050E0AC1730 +:1002D000BD0708F1BB83AA83FE0121913191E20F92 +:1002E000F31FAE17BF0779F48D919C911197280FDA +:1002F000391F2E5F3F4F3983288312968D919C9131 +:1003000013979B838A834115510571F4D09302039F +:10031000C093010320C012968D919C911397AD015B +:10032000009711F0DC01D3CFFA01D383C28321916E +:100330003191E20FF31FCE17DF0769F488819981AD +:10034000280F391F2E5F3F4FFA01318320838A81A6 +:100350009B8193838283DF91CF910895A0E0B0E0E9 +:10036000E4EBF1E00C9494186C01009729F4CB01B4 +:100370000E94AC006C01C1C08EEF882E8FEF982ECA +:100380008C0C9D1C8601060F171F0815190508F413 +:10039000B2C0F401A081B181A617B707B8F0A530AB +:1003A000B10508F4AAC0CD0104978617970708F491 +:1003B000A4C01297A61BB70BF801A193B193D40167 +:1003C0006D937C93CF010E94560197C07B01EA1A7E +:1003D000FB0AEEEFFFEFEE0EFF1E36016A0E7B1EEC +:1003E000C0910103D091020344245524AA24BB24C4 +:1003F0004AC0C615D705E1F5488159814E155F05FC +:10040000B8F1CA0104978E159F05B0F41296A40F97 +:10041000B51FF401B183A0832A813B8141145104AB +:1004200031F0D20113963C932E93129766C030930D +:1004300002032093010361C08A819B81F8019383A9 +:100440008283425050404E195F09518340834114CA +:10045000510431F0D20113961C930E93129704C0ED +:100460001093020300930103F4017183608345C07C +:1004700088819981A816B90608F45C012E018A8149 +:100480009B819C01E901209709F0B3CF8091FF0285 +:100490009091000386159705E9F4A616B706D0F4E7 +:1004A0002091CB013091CC012115310541F42DB7BC +:1004B0003EB78091C7019091C801281B390B0217E4 +:1004C0001307C8F4109300030093FF02D4016D9347 +:1004D0007C9313C0CB010E94AC00EC01009759F053 +:1004E000F40140815181B6010E948702C6010E9439 +:1004F00056016E0102C0CC24DD24C601CDB7DEB7A3 +:10050000E0E10C94B018662777270C94D504FB0122 +:10051000DC0102C001900D9241505040D8F708957F +:10052000FC018191861721F08823D9F79927089536 +:100530003197CF010895FB01DC018D910190801965 +:100540000110D9F3990B0895FB01DC0101900D9284 +:100550000020E1F70895FB01DC014150504048F0D4 +:1005600001900D920020C9F701C01D9241505040EA +:10057000E0F70895FB0151915523A9F0BF01DC017B +:100580004D9145174111E1F759F4CD01019000203B +:1005900049F04D9140154111C9F3FB014111EFCFD5 +:1005A00081E090E001970895AEE0B0E0EAEDF2E07E +:1005B0000C94A0180D891E8986E08C831A83098308 +:1005C0008FEF9FE79E838D839E01275E3F4FCE0175 +:1005D00001966F89788DA9010E94F8022F813885D4 +:1005E000020F131FF80110822E96E4E00C94BC1841 +:1005F000ABE0B0E0EEEFF2E00C9492183C012B017E +:100600005A01FC0117821682838181FD03C06FEFBE +:100610007FEFC6C19AE0892E1E010894211C311C6F +:10062000F3012381F20123FD859123FF81912F01A5 +:10063000882309F4B2C1853239F423FD859123FF63 +:1006400081912F01853229F490E0B3010E94630665 +:10065000E7CF982FFF24EE249924FFE1FF15D0F077 +:100660009B3269F09C3228F4903259F0933291F425 +:100670000EC09D3249F0903369F441E024C052E04D +:10068000F52A84E0F82A28C098E0F92A25C0E0E19C +:10069000FE2A22C0F7FC29C0892F80538A3070F4CB +:1006A000F6FE05C0989C902C1124980E15C0E89C6D +:1006B000E02C1124E80EF0E2FF2A0EC09E3229F44D +:1006C000F6FC6BC140E4F42A07C09C3619F450E8EC +:1006D000F52A02C0983649F4F20123FD959123FFD3 +:1006E00091912F01992309F0B8CF892F8554833038 +:1006F00018F08052833038F444E050E0A40EB51E68 +:100700005FE359830FC0933631F0933779F0933517 +:1007100009F056C020C0F5018081898342E050E095 +:10072000A40EB51E610101E010E012C0F501C08009 +:10073000D180F6FC03C06FEF7FEF02C0692D70E03F +:1007400042E050E0A40EB51EC6010E9458068C017E +:100750005FE7F52214C0F501C080D180F6FC03C02C +:100760006FEF7FEF02C0692D70E042E050E0A40E11 +:10077000B51EC6010E944D068C0150E8F52AF3FE15 +:1007800007C01AC080E290E0B3010E946306EA94B9 +:100790008E2D90E008171907A8F30EC0F601F7FC9C +:1007A0008591F7FE81916F0190E0B3010E9463068D +:1007B000E110EA94015010400115110579F7EAC0E3 +:1007C000943611F0993669F5F7FE08C0F5012081DD +:1007D00031814281538184E090E00AC0F50180813B +:1007E00091819C01442737FD4095542F82E090E091 +:1007F000A80EB91E9FE6F92257FF09C050954095F3 +:10080000309521953F4F4F4F5F4FE0E8FE2ACA01D8 +:10081000B901A1012AE030E00E948F06D82ED2183B +:1008200040C0953729F41F2D1F7E2AE030E01DC0FF +:100830001F2D197F9F3661F0903720F4983509F00D +:10084000ACC00FC0903739F0983709F0A6C004C08B +:1008500028E030E00AC0106114FD146020E130E0AF +:1008600004C014FD166020E132E017FF08C0F50156 +:10087000608171818281938144E050E008C0F5017C +:1008800080819181BC0180E090E042E050E0A40EC4 +:10089000B51EA1010E948F06D82ED2188FE7F82E20 +:1008A000F122F6FE0BC05EEFF522D91438F4F4FE07 +:1008B00007C0F2FC05C08FEEF82202C01D2D01C05A +:1008C000192DF4FE0DC0FE01ED0DF11D8081803368 +:1008D00019F499EEF92208C01F5FF2FE05C003C0AB +:1008E0008F2D867809F01F5F0F2DF3FC14C0F0FEEA +:1008F0000FC01E1510F09D2C0BC09D2C9E0C911A44 +:100900001E2D06C080E290E0B3010E9463061F5FC7 +:100910001E15C0F304C01E1510F4E11A01C0EE2428 +:1009200004FF0FC080E390E0B3010E94630602FF62 +:100930001DC001FD03C088E790E00EC088E590E08F +:100940000BC0802F867891F001FF02C08BE201C0BE +:1009500080E2F7FC8DE290E0B3010E94630606C0DE +:1009600080E390E0B3010E9463069A94D914C0F327 +:10097000DA94F101ED0DF11D808190E0B3010E9448 +:100980006306DD20A9F706C080E290E0B3010E9473 +:100990006306EA94EE20C1F743CEF30166817781C6 +:1009A000CB012B96E2E10C94AE18A0E0B0E0EBEDA9 +:1009B000F4E00C949818EC015B016115710519F0D5 +:1009C000FB0191838083F9908F2D90E00E9487181E +:1009D000892BC9F7FDE2FF1621F4F990EE24E39488 +:1009E00005C02BE2F21609F4F990EE248E010150B5 +:1009F0001040C80162EC70E043E050E00E94350610 +:100A0000892B01F58E010E5F1F4FC80165EC70E068 +:100A100045E050E00E943506892B19F48E01095FEC +:100A20001F4FA114B10419F0F50111830083E0FCFC +:100A300004C070E090E080E814C070E090E080E8CE +:100A40006FEF08C1C8016AEC70E043E050E00E941B +:100A50003506892B69F4A114B10429F470E090E003 +:100A600080EC6FE7F7C02296F501D183C083F6CF03 +:100A70008824992440E050E060E070E0EF2DE053DE +:100A8000EA30A0F5F2E0EF2A8E2D90E09C0128706C +:100A90003070E2FE06C0232B79F50894811C911C6E +:100AA0002BC0232B19F0089481089108DB01CA019F +:100AB00012E0880F991FAA1FBB1F1A95D1F7480F84 +:100AC000591F6A1F7B1F440F551F661F771F4E0F4C +:100AD000511D611D711D483929E9520729E9620735 +:100AE00029E1720748F084E0E82A06C0EE3F31F4BD +:100AF000E3FC39C098E0E92AF990C0CFE53311F062 +:100B0000E53189F529912D3219F4E0E1EE2A05C08D +:100B10002B3219F081E090E003C0299182E090E04F +:100B2000E22FE053EA3018F0C81BD90B1CC020E0BC +:100B300030E0FCE020383F075CF4C901880F991FC2 +:100B4000880F991F280F391F220F331F2E0F311DB9 +:100B5000E991E053EA3068F3E4FE03C03095219553 +:100B60003F4F820E931ECE2CDD24E1FE07C0A11460 +:100B7000B10421F02197F501D183C083CB01BA01E3 +:100B80000E9404177B018C01F3E0CF22DD2423E0D7 +:100B9000C216D10421F417FB109517F910955701CF +:100BA0006801C801B70120E030E040E050E00E9459 +:100BB000CF16882309F44AC097FE0DC021EEE22E1D +:100BC00020E0F22E9094819491089394C0E2D0E0BA +:100BD00000E010E012C099EFE92E90E0F92EF6CF78 +:100BE000F7012591359145915491C601B5010E94B7 +:100BF000BA175B016C018C1A9D0A8C169D0684F74E +:100C0000D595C7950F5F1F4F0630110529F08CEF62 +:100C10009FEFE80EF91EF1CFC501D6017C018D01D1 +:100C20008C2D880F8D2D881F8F3F51F0C601B50187 +:100C300020E030E040E050E00E94CF16882331F4FD +:100C400082E290E090930403809303037E2D9F2D16 +:100C5000802F612F272F392F482F562FB901CA0116 +:100C6000CDB7DEB7ECE00C94B418FB01DC014150C9 +:100C7000504088F08D9181341CF08B350CF4805EEF +:100C8000659161341CF06B350CF4605E861B61115C +:100C900071F3990B0895881BFCCFFC0105906150FE +:100CA00070400110D8F7809590958E0F9F1F089582 +:100CB000FC016150704001900110D8F7809590952B +:100CC0008E0F9F1F08950F931F93CF93DF938C0177 +:100CD000EB018B8181FF1BC082FF0DC02E813F8104 +:100CE0008C819D812817390764F4E881F98101938B +:100CF000F983E88306C0E885F985802F0995892B5B +:100D000031F48E819F8101969F838E8302C00FEF05 +:100D10001FEFC801DF91CF911F910F910895FA0144 +:100D2000AA27283051F1203181F1E8946F936E7F2A +:100D30006E5F7F4F8F4F9F4FAF4FB1E03ED0B4E01B +:100D40003CD0670F781F891F9A1FA11D680F791F5C +:100D50008A1F911DA11D6A0F711D811D911DA11D6D +:100D600020D009F468943F912AE0269F112430197D +:100D7000305D3193DEF6CF010895462F4770405D18 +:100D80004193B3E00FD0C9F7F6CF462F4F70405DC7 +:100D90004A3318F0495D31FD4052419302D0A9F722 +:100DA000EACFB4E0A6959795879577956795BA951C +:100DB000C9F700976105710508959B01AC010A2EE2 +:100DC00006945795479537952795BA95C9F7620FB9 +:100DD000731F841F951FA01D0895EF92FF920F931C +:100DE0001F938130910551F0892B19F46F5F7F4F6C +:100DF000A1F11F910F91FF90EF9008956F5F7F4FCA +:100E0000C1F70EEE11E0C80160E071E00E94AB1581 +:100E1000095F1F4F82E00A301807A9F785E192E0C9 +:100E200068EC70E048E050E029E030E00AE010E0D3 +:100E3000FBE0EF2EF12C0E94500F8FE292E068EC65 +:100E400070E042E050E023E030E004E010E0E5E054 +:100E5000EE2EF12C0E94500FCCCF03E012E0C8011F +:100E60000E945E160750104081E0073E1807B9F750 +:100E70001F910F91FF90EF90089580E090E06FEF49 +:100E80007FEF0E94ED06089581E090E06FEF7FEF25 +:100E90000E94ED0608950F931F93DF93CF93CDB774 +:100EA000DEB7C45FD1400FB6F894DEBF0FBECDBF32 +:100EB0008DB79EB70C970FB6F8949EBF0FBE8DBF2F +:100EC000EDB7FEB731968E010F5F1F4FADB7BEB7BE +:100ED00012961C930E93119781E091E09383828385 +:100EE00087E391E09583848381E090E09783868314 +:100EF0008FEF9FEF9187808784E190E093878287CF +:100F00000E94D4028DB79EB70C960FB6F8949EBF80 +:100F10000FBE8DBF83ED92E0B8010E941112CC503C +:100F2000DE4F0FB6F894DEBF0FBECDBFCF91DF917D +:100F30001F910F9108950F931F93DF93CF93CDB718 +:100F4000DEB7E2970FB6F894DEBF0FBECDBF8DB708 +:100F50009EB70C970FB6F8949EBF0FBE8DBFEDB72E +:100F6000FEB731968E010F5F1F4FADB7BEB7129619 +:100F70001C930E93119780E591E093838283809177 +:100F8000D5019091D601A091D701B091D801848369 +:100F90009583A683B7838091D9019091DA01A091BE +:100FA000DB01B091DC0180879187A287B3870E9423 +:100FB000D4028DB79EB70C960FB6F8949EBF0FBEA5 +:100FC0008DBF83ED92E0B8010E941112E2960FB638 +:100FD000F894DEBF0FBECDBFCF91DF911F910F916F +:100FE000089583ED92E06AE571E00E941112089580 +:100FF000BC0183ED92E00E94571208950F931F9356 +:10100000DF93CF93CDB7DEB727970FB6F894DEBF47 +:101010000FBECDBF81E0809314028E010F5F1F4F82 +:10102000C80166E671E00E94AB15C8010E94F8078E +:10103000C8010E945E1627960FB6F894DEBF0FBE59 +:10104000CDBFCF91DF911F910F9108950F931F9303 +:10105000DF93CF93CDB7DEB727970FB6F894DEBFF7 +:101060000FBECDBF109214028E010F5F1F4FC8013B +:1010700066E671E00E94AB15C8010E94F807C8013E +:101080000E945E1627960FB6F894DEBF0FBECDBF46 +:10109000CF91DF911F910F9108950F931F93DF93CD +:1010A000CF93CDB7DEB727970FB6F894DEBF0FBE4C +:1010B000CDBF1092CD011092CE011092CF011092AF +:1010C000D0011092D1011092D2011092D30110924E +:1010D000D4018E010F5F1F4FC80166E671E00E94C8 +:1010E000AB15C8010E94F807C8010E945E1627963A +:1010F0000FB6F894DEBF0FBECDBFCF91DF911F9129 +:101100000F9108950F931F93DF93CF93CDB7DEB761 +:1011100027970FB6F894DEBF0FBECDBF0E94D8163A +:101120000E9430138E010F5F1F4FC80166E671E009 +:101130000E94AB15C8010E94F807C8010E945E1604 +:1011400027960FB6F894DEBF0FBECDBFCF91DF91CB +:101150001F910F910895FC01662349F4EE0FFF1FC4 +:10116000E65FFD4F808160E00E94FD130895EE0F61 +:10117000FF1FE65FFD4F808161E00E94FD1308952F +:101180000F931F93DF93CF93CDB7DEB727970FB69B +:10119000F894DEBF0FBECDBF8C01809112029091FA +:1011A0001302009701F5043011051CF1109213028F +:1011B000109212028E010F5F1F4FC80166E671E0A8 +:1011C0000E94AB15C8010E94F807C8010E945E1674 +:1011D00027960FB6F894DEBF0FBECDBFCF91DF913B +:1011E0001F910F91089561E00E94AB080430110532 +:1011F000ECF6C80160E00E94AB0810931302009364 +:101200001202D8CF2F923F924F925F926F927F92AD +:101210008F929F92AF92BF92CF92DF92EF92FF9206 +:101220000F931F93DF93CF93CDB7DEB72C970FB6F5 +:10123000F894DEBF0FBECDBF6B837C838D839E830E +:101240002F83388749875A8785E192E0B801A70143 +:101250000E94500E8FE292E0B801A7010E94500E4A +:1012600080911402882361F16091CD017091CE01CB +:101270008091CF019091D0010E9404179B01AC0195 +:101280006B817C818D819E810E946B166B837C8338 +:101290008D839E836091D1017091D2018091D301A1 +:1012A0009091D4010E9404179B01AC016F81788555 +:1012B00089859A850E946B166F83788789879A87BC +:1012C0006B817C818D819E8120E030E040EA51E499 +:1012D0000E94B61718160CF00CC180E090E0A0EA4E +:1012E000B1E48B839C83AD83BE8398EEE92E93E0BB +:1012F000F92E012D112D88EEC82E83E0D82E6F8196 +:10130000788589859A8520E030E048E452E40E949F +:10131000BA170E94D3162091CD013091CE01409191 +:10132000CF015091D0012E153F054007510709F418 +:101330002EC15601A21AB30ACB01AA2797FDA09588 +:10134000BA2FE090D101F090D2010091D301109119 +:10135000D4018E159F05A007B10709F414C16B01D4 +:10136000CE18DF08CA01B9010E9404179B01AC0125 +:101370006B817C818D819E810E94B61718160CF4BA +:10138000B3C0AFEFBFEFBA83A983C801B7010E9412 +:1013900004179B01AC016F81788589859A850E942D +:1013A000B61718160CF49BC08FEF9FEF9C878B87A6 +:1013B000CA14DB040CF441C03601882477FC809405 +:1013C000982C611471048104910409F441C0150141 +:1013D000442437FC4094542CEE24FF248701AA2493 +:1013E000BB24650110C060E070E080E090E00E94E6 +:1013F00030130894A11CB11CC11CD11CA614B70445 +:10140000C804D90428F58FE292E06B857C850E94A0 +:10141000EE0EE20CF31C041D151DE614F70408057E +:10142000190508F3E618F7080809190985E192E09B +:1014300069817A810E94EE0ED6CF3501882477FC2F +:101440008094982C611471048104910409F064C0A3 +:101450006B817C818D819E810E94D8167B018C01DD +:101460006093CD017093CE018093CF019093D00112 +:101470006F81788589859A850E94D8166093D101FD +:101480007093D2018093D3019093D401E092D5015F +:10149000F092D6010093D7011093D8016093D9013F +:1014A0007093DA018093DB019093DC012C960FB6E8 +:1014B000F894DEBF0FBECDBFCF91DF911F910F918A +:1014C000FF90EF90DF90CF90BF90AF909F908F9064 +:1014D0007F906F905F904F903F902F900895A1E084 +:1014E000B0E0BC87AB8764CFE1E0F0E0FA83E9834A +:1014F0004CCF6B817C818D819E8120E030E048E47F +:1015000052E40E94BA170E94D3167B010027F7FC11 +:101510000095102F6B01F3CE1601442437FC409444 +:10152000542CEE24FF248701AA24BB24650111C09A +:1015300060E070E080E090E00E9430130894A11C0D +:10154000B11CC11CD11CA614B704C804D90408F0EE +:101550007FCF85E192E069817A810E94EE0EE20CF4 +:10156000F31C041D151DE614F7040805190500F306 +:10157000E618F708080919098FE292E06B857C8567 +:101580000E94EE0ED5CF6701C61AD70AEBCE5701DF +:10159000AC18BD08D1CEEF92FF920F931F93DF934B +:1015A000CF93CDB7DEB727970FB6F894DEBF0FBE47 +:1015B000CDBFF6E9EF2EF12C012D112D0E9402096D +:1015C0008E010F5F1F4FC80166E671E00E94AB15E8 +:1015D000C8010E94F807C8010E945E1627960FB640 +:1015E000F894DEBF0FBECDBFCF91DF911F910F9159 +:1015F000FF90EF900895CF92DF92EF92FF920F93BA +:101600001F93DF93CF93CDB7DEB727970FB6F8942C +:10161000DEBF0FBECDBFD82EC92E7B018E010F5F5E +:101620001F4FC80169E671E00E94AB15C701B80100 +:101630000E9474149C018D2D9C2DB70140E050E058 +:101640000E94DE15C8010E945E168D2D9C2D2796E6 +:101650000FB6F894DEBF0FBECDBFCF91DF911F91C3 +:101660000F91FF90EF90DF90CF900895AF92BF92CF +:10167000CF92DF92EF92FF920F931F93DF93CF935E +:10168000CDB7DEB7C054D0400FB6F894DEBF0FBE62 +:10169000CDBF7C01162F0E9497146C015E01089447 +:1016A000A11CB11CC50169E671E00E94AB15C70120 +:1016B000612F0E949714AC01C701B5010E94561416 +:1016C0009C018E01085F1F4F0894C11CD11CC801EA +:1016D000B701A6010E94DE15AFE0EA2EF12CEC0E58 +:1016E000FD1EC801B70142E350E020E030E00E9457 +:1016F0009C14C8010E945E16C5010E945E16C701B7 +:101700000E948302C05CDF4F0FB6F894DEBF0FBEAD +:10171000CDBFCF91DF911F910F91FF90EF90DF90A0 +:10172000CF90BF90AF9008954F925F926F927F924B +:101730008F929F92AF92BF92CF92DF92EF92FF92E1 +:101740000F931F93DF93CF93CDB7DEB7E8970FB614 +:10175000F894DEBF0FBECDBF582E492E3B018E013F +:101760000F5F1F4FC8016BE671E00E94AB15C3010C +:10177000B8010E9474147C01C8010E945E168FEFAC +:10178000E8168FEFF80681F18E01085F1F4FC80140 +:101790006BE671E00E94AB15C301B8010E9474149E +:1017A0009C01852D942DB30140E050E00E94DE1590 +:1017B000C8010E945E16852D942DE8960FB6F89408 +:1017C000DEBF0FBECDBFCF91DF911F910F91FF9074 +:1017D000EF90DF90CF90BF90AF909F908F907F90D1 +:1017E0006F905F904F9008958E01015F1F4FC80169 +:1017F0006DE671E00E94AB15C301B8010E9474143C +:101800007C01C8010E945E168FEFE8168FEFF80684 +:1018100009F452C086E1882E912C8C0E9D1EC401C5 +:101820006DE671E00E94AB15C301B4010E9474140F +:101830009C010DE1A02EB12CAC0EBD1EC501B30163 +:1018400040E050E00E94DE1512E3C12ED12CCC0EF8 +:10185000DD1EC601B5010E945316B4E2EB2EF12C39 +:10186000EC0EFD1EC7016FE671E00E94AB15C301CF +:10187000B7010E947414AC018E01055D1F4FC801B1 +:10188000B3010E942516C601B8010E947415BC015F +:10189000852D942D0E944816C8010E945E16C7012E +:1018A0000E945E16C6010E946416C5010E945E1663 +:1018B000C4010E945E167FCF852D942DB3010E9436 +:1018C000481679CF6F927F928F929F92AF92BF927C +:1018D000CF92DF92EF92FF920F931F93DF93CF93FC +:1018E000CDB7DEB7CB55D0400FB6F894DEBF0FBEF4 +:1018F000CDBF4C017E010894E11CF11CC701B4016D +:101900000E9448168E01085F1F4FC801B7010E9450 +:10191000940BC401B8010E943116C8010E945E16E2 +:10192000C7010E945E168E010A5E1F4FC801B401F6 +:101930000E9448165FE0652E712C6C0E7D1EC3015F +:10194000B8010E94FB0AC8010E945E16C40160E053 +:1019500070E00E943014FC010081C30161E771E076 +:101960000E94C914882309F083C0C30164E771E0B1 +:101970000E94C9148823E9F5C30167E771E00E945A +:10198000C914882309F087C0C3016AE771E00E9487 +:10199000C914882309F090C0C3016EE771E00E946A +:1019A000C914882309F08BC0C30162E871E00E946A +:1019B000C914882309F086C0C30166E871E00E945B +:1019C000C914882309F481C08E01005C1F4FC8012F +:1019D000B4010E944816C80164E50E94360B0E94BB +:1019E000D316DC01CB010E94C008C8010E945E161C +:1019F00026C03BE2A32EB12CAC0EBD1EC501B40126 +:101A00000E944816C50168E50E94360B6B017C01F7 +:101A10008E010E5C1F4FC801B4010E944816C80118 +:101A200069E50E94360B9B01AC01C701B6010E941B +:101A3000CB0AC8010E945E16C5010E945E16C30152 +:101A40000E945E16C55ADF4F0FB6F894DEBF0FBE78 +:101A5000CDBFCF91DF911F910F91FF90EF90DF905D +:101A6000CF90BF90AF909F908F907F906F90089590 +:101A70004DE1A42EB12CAC0EBD1EC501B4010E94D7 +:101A80004816C50168E50E94360B6B017C018E018A +:101A90000C5D1F4FC0CF8E01075C1F4FC801B40102 +:101AA0000E944816C80160E50E94360B0E94820819 +:101AB000C8010E945E16C3CF0E944D08C0CF0E948D +:101AC0002608BDCF0E94FE07BACF043509F47CCFAB +:101AD000C30163EB71E00E94C914882359F5C30167 +:101AE00068E871E00E94C914882339F5C3016DE8E4 +:101AF00071E00E94C914882331F5C30162E971E0E5 +:101B00000E94C914882311F5C30167E971E00E949E +:101B1000C9148823F1F48E010B5A1F4FC8016CE9D8 +:101B200071E00E94AB15C8010E94F807C8010E942D +:101B30005E1685CF0E94F10782CFE0914902F091B5 +:101B40004A0209957CCF0E949B0779CF0E944B07E0 +:101B500076CF8E01095B1F4FC80167E971E00E94D3 +:101B6000AB15C401B8010E9474142EE4E22EF12CCE +:101B7000EC0EFD1EAC014C5F5F4FC701B4010E942B +:101B80002516C7010E94F807C7010E945E16C8010A +:101B90000E945E1654CFEF92FF920F931F93DF9334 +:101BA000CF93CDB7DEB72E970FB6F894DEBF0FBE3A +:101BB000CDBF83ED92E00E949C10892BC9F07E017D +:101BC0000894E11CF11CC70163ED72E00E949712BA +:101BD0008E01085F1F4FC801B7010E944816C80157 +:101BE0000E94620CC8010E945E16C7010E945E1628 +:101BF0002E960FB6F894DEBF0FBECDBFCF91DF910A +:101C00001F910F91FF90EF900895CF93DF93CCE059 +:101C1000D2E0888161E00E949113888161E00E9496 +:101C2000FD13229682E0C231D80799F7DF91CF9158 +:101C300008950F931F9305EF11E0C80166EB71E063 +:101C40000E94C515C80107966BEB71E00E94C5158F +:101C5000C8010E9660EC71E00E94C5151F910F91AE +:101C6000089583ED92E040E855E260E070E00E9464 +:101C700015100E94050E0E94190E86E090E09093C8 +:101C80000D0280930C0287E090E090930F02809306 +:101C90000E028CE090E09093110280931002089560 +:101CA000CF92DF92EF92FF920F931F936C017A0114 +:101CB0008B01FC0120853185442737FD4095542F49 +:101CC00060E67AEE80E090E00E945218CA01B90105 +:101CD000A80197010E945218F60124833583468398 +:101CE00057831F910F91FF90EF90DF90CF90089551 +:101CF0000F931F93CF93DF93EC018B018A859B8514 +:101D0000029731F56130710589F06230710524F474 +:101D10006115710541F01CC06230710571F06330CE +:101D20007105B1F40DC08E8560E002C08E8561E062 +:101D30000E94FD13888961E009C08E8561E002C0C0 +:101D40008E8560E00E94FD13888960E00E94FD138B +:101D50008A859B850497E9F501301105A1F00230D1 +:101D600011051CF4012B41F034C002301105D1F0F3 +:101D70000330110571F51DC08E8561E00E94FD13D1 +:101D8000888960E006C08E8560E00E94FD13888926 +:101D900061E00E94FD138A8961E00E94FD138C8935 +:101DA00060E015C08E8560E00E94FD13888961E0C7 +:101DB00006C08E8561E00E94FD13888960E00E9464 +:101DC000FD138A8960E00E94FD138C8961E00E9406 +:101DD000FD13DF91CF911F910F9108950F931F93E2 +:101DE000CF93DF93EC011616170624F481E090E000 +:101DF0009983888377FF02C0198218828B0177FF4D +:101E000046C0109501951F4F42C00E94FC122E89BA +:101E10003F89488D598D621B730B840B950B2C8168 +:101E20003D814E815F81621773078407950768F3D0 +:101E30000E94FC126E8B7F8B888F998F888199818D +:101E40002C853D85019761F42F5F3F4F3D872C879F +:101E5000888599852817390771F41D861C860BC063 +:101E6000232B21F4888599859D878C878C859D857A +:101E700001979D878C87015010408C859D8564E07B +:101E800070E00E941D18BC01CE010E94780E011561 +:101E9000110509F0BACFDF91CF911F910F910895ED +:101EA000CF92DF92EF92FF920F931F936C01842FDA +:101EB000F601158614861382128211821082168A08 +:101EC000178A108E118E7187608746875787318BEE +:101ED000208B138B028BF58AE48A61E00E949113B8 +:101EE000F601808961E00E949113F601828961E028 +:101EF0000E949113F601848961E00E94911384E0AD +:101F000090E0F601938782871F910F91FF90EF90E9 +:101F1000DF90CF90089508951F920F920FB60F9201 +:101F200011242F933F934F938F939F93EF93FF939E +:101F30008091C00082FD1DC04091C60020918B029F +:101F400030918C022F5F3F4F2F73307080918D0244 +:101F500090918E022817390771F0E0918B02F09171 +:101F60008C02E55BFD4F408330938C0220938B0203 +:101F700002C08091C600FF91EF919F918F914F9188 +:101F80003F912F910F900FBE0F901F901895E091E9 +:101F9000DF02F091E002E05CFF4F8191919120819E +:101FA0003181821B930B8F739070892B11F00E94EB +:101FB0008B0F08951F920F920FB60F9211242F933B +:101FC0003F938F939F93EF93FF932091CF02309194 +:101FD000D0028091D1029091D2022817390731F4B2 +:101FE0008091C1008F7D8093C10014C0E091D10227 +:101FF000F091D202E157FD4F20818091D102909162 +:10200000D20201968F7390709093D2028093D10286 +:102010002093C600FF91EF919F918F913F912F9157 +:102020000F900FBE0F901F901895AF92BF92DF9246 +:10203000EF92FF920F931F93CF93DF93EC017A01FE +:102040008B01DD24403081EE580780E0680780E096 +:10205000780711F0DD24D39491E0A92EB12CEC89FE +:10206000FD89DD2069F0C50108A002C0880F991F15 +:102070000A94E2F7808360E079E08DE390E005C0A8 +:10208000108260E874E88EE190E0A80197010E9458 +:102090003018215030404040504056954795379574 +:1020A000279580E12030380720F0DD2011F0DD2475 +:1020B000D6CFE889F9893083EA89FB89208319A280 +:1020C000EE89FF89408121E030E0C9010C8C02C01B +:1020D000880F991F0A94E2F7482B4083EE89FF8905 +:1020E0004081C9010D8C02C0880F991F0A94E2F744 +:1020F000482B4083EE89FF894081C9010E8C02C0C4 +:10210000880F991F0A94E2F7482B4083EE89FF89D4 +:1021100080810F8C02C0220F331F0A94E2F72095B2 +:1021200028232083DF91CF911F910F91FF90EF9093 +:10213000DF90BF90AF900895DC011C96ED91FC916B +:102140001D97E05CFF4F2191319180819181281B87 +:10215000390B2F733070C9010895DC011C96ED9185 +:10216000FC911D97E05CFF4F20813181E054F040ED +:10217000DF01AE5BBF4F8D919C91119728173907F6 +:1021800019F42FEF3FEF07C08D919C91E80FF91FD5 +:102190008081282F30E0C9010895DC011C96ED9163 +:1021A000FC911D97E05CFF4F20813181E054F040AD +:1021B000DF01AE5BBF4F8D919C91119728173907B6 +:1021C00019F42FEF3FEF10C08D919C911197E80FFC +:1021D000F91F20818D919C91119701968F739070BA +:1021E00011969C938E9330E0C9010895DC0191967D +:1021F0008C919197882339F05496ED91FC915597E5 +:10220000808186FFF9CF91961C920895CF93DF933A +:10221000EC01EE85FF85E05CFF4F20813181E054C9 +:10222000F0402F5F3F4F2F733070DF01AE5BBF4F29 +:102230008D919C91119728173907D1F3E05CFF4FDE +:1022400080819181E054F040E80FF91F6083EE85B2 +:10225000FF85E05CFF4F31832083EE89FF89208179 +:1022600081E090E00F8C02C0880F991F0A94E2F77A +:10227000282B208381E089A3EC89FD8980818064FB +:10228000808381E090E0DF91CF9108951092D60293 +:102290001092D50288EE93E0A0E0B0E08093D702E0 +:1022A0009093D802A093D902B093DA0281EE91E024 +:1022B0009093D4028093D3028BE492E09093E00257 +:1022C0008093DF028FE892E09093E2028093E10234 +:1022D00085EC90E09093E4028093E30284EC90E03C +:1022E0009093E6028093E50280EC90E09093E80200 +:1022F0008093E70281EC90E09093EA028093E902F8 +:1023000082EC90E09093EC028093EB0286EC90E0FC +:102310009093EE028093ED0284E08093EF0283E0DD +:102320008093F00287E08093F10285E08093F202CF +:1023300081E08093F3020895CF93DF930E945613B8 +:102340000E94310EC7ECDFE00E94CB0D2097E1F335 +:102350000E94C70FF9CFCF92DF92EF92FF920F93B7 +:102360001F93CF93DF937C016B018A01C0E0D0E023 +:102370000FC0D6016D916D01D701ED91FC910190D7 +:10238000F081E02DC7010995C80FD91F01501040F9 +:102390000115110571F7CE01DF91CF911F910F91BA +:1023A000FF90EF90DF90CF900895EF92FF920F9300 +:1023B0001F938C01DC01ED91FC910190F081E02DE7 +:1023C0006DE009957C01D801ED91FC910190F081BF +:1023D000E02DC8016AE009959C012E0D3F1DC90141 +:1023E0001F910F91FF90EF900895CF93DF93EC0131 +:1023F0006115710519F420E030E00FC0DB010D908C +:102400000020E9F71197A61BB70BE881F98102803C +:10241000F381E02DAD0109959C01C901DF91CF91B8 +:102420000895EF92FF920F931F937C010E94F51184 +:102430008C01C7010E94D511080F191FC8011F91F7 +:102440000F91FF90EF900895AF92BF92CF92DF92DD +:10245000EF92FF920F931F93CF93DF935C016B0179 +:10246000EE24FF24C0E0D0E010C0D501ED91FC9136 +:1024700000811181C601BE010E944514682FC5016B +:10248000F8010995E80EF91E2196F60184819581DF +:10249000C817D90750F3C701DF91CF911F910F9152 +:1024A000FF90EF90DF90CF90BF90AF900895EF92A4 +:1024B000FF920F931F937C010E9424128C01C7018D +:1024C0000E94D5119C01200F311FC9011F910F914E +:1024D000FF90EF900895CF93DF93EC010E94FC12E0 +:1024E000688779878A879B87E881F9810680F781E9 +:1024F000E02DCE0109959C0197FF15C00E94FC12AA +:10250000288539854A855B85621B730B840B950B87 +:102510002C813D814E815F81621773078407950787 +:1025200018F32FEF3FEFC901DF91CF9108950F937B +:102530001F93CF93DF93182F092FEB0165EC71E008 +:102540000E94AB1504C0812F902F0E944F15CE0121 +:102550000E946B12BC0197FFF6CF812F902FDF9165 +:10256000CF911F910F9108951F920F920FB60F9266 +:1025700011242F933F938F939F93AF93BF93809199 +:10258000F9029091FA02A091FB02B091FC02309105 +:10259000FD020196A11DB11D232F2D5F2D3720F0C7 +:1025A0002D570196A11DB11D2093FD028093F902C4 +:1025B0009093FA02A093FB02B093FC028091F50283 +:1025C0009091F602A091F702B091F8020196A11D38 +:1025D000B11D8093F5029093F602A093F702B09399 +:1025E000F802BF91AF919F918F913F912F910F90E2 +:1025F0000FBE0F901F9018958FB7F8942091F90295 +:102600003091FA024091FB025091FC028FBFB90158 +:10261000CA0108959FB7F8942091F5023091F6020F +:102620004091F7025091F80286B5A89B06C08F3FF3 +:1026300021F02F5F3F4F4F4F5F4F9FBF542F432FCE +:10264000322F2227280F311D411D511D82E0220FFC +:10265000331F441F551F8A95D1F7B901CA01089548 +:10266000EF92FF920F931F93CF93DF937B018C0127 +:102670000E940A13EB010EC00E940A136C1B7D0B13 +:10268000685E7340C8F30894E108F1080109110974 +:10269000C851DC4FE114F1040105110569F7DF9120 +:1026A000CF911F910F91FF90EF900895789484B58A +:1026B000826084BD84B5816084BD85B5826085BD3E +:1026C00085B5816085BDEEE6F0E080818160808324 +:1026D000E1E8F0E010828081826080838081816007 +:1026E0008083E0E8F0E0808181608083E1EBF0E0CE +:1026F000808184608083E0EBF0E080818160808372 +:10270000EAE7F0E08081846080838081826080835A +:102710008081816080838081806880831092C10085 +:102720000895CF93DF93482F50E0CA0186569F4FFC +:10273000FC0134914A575F4FFA018491882369F173 +:1027400090E0880F991FFC01E859FF4FA591B491C3 +:10275000FC01EE58FF4FC591D491662351F42FB779 +:10276000F8948C91932F909589238C938881892359 +:102770000BC0623061F42FB7F8948C91932F909531 +:1027800089238C938881832B88832FBF06C09FB7B2 +:10279000F8948C91832B8C939FBFDF91CF910895F8 +:1027A000833071F0843028F48130A1F0823021F53B +:1027B00014C08630B1F08730D1F08430E9F404C021 +:1027C000809180008F7703C0809180008F7D8093FF +:1027D0008000089584B58F7702C084B58F7D84BD55 +:1027E00008958091B0008F778093B0000895809114 +:1027F000B0008F7D8093B0000895FF920F931F93D8 +:10280000F62E482F50E0CA0182559F4FFC012491BB +:10281000CA0186569F4FFC0114914A575F4FFA0137 +:1028200004910023C9F0222319F0822F0E94D013B3 +:10283000E02FF0E0EE0FFF1FEE58FF4FA591B4918F +:102840009FB7F894FF2021F48C911095812302C04A +:102850008C91812B8C939FBF1F910F91FF900895B6 +:10286000FC019B01848195816817790728F46081B8 +:1028700071816115710529F41092FE026EEF72E00C +:1028800002C0620F731FCB010895FC018481958102 +:102890006817790748F40190F081E02D309721F016 +:1028A000E60FF71F8081089580E00895CF93DF93AE +:1028B000FC01DB01848195814817590760F4C081D0 +:1028C000D1816D917C91CE01840F951F0E94BA0237 +:1028D0009C01009719F42FEF3FEF02C02C1B3D0B1A +:1028E000C901DF91CF91089540E050E00E94561455 +:1028F0000895CF93DF93FC01848195814817590790 +:1029000068F4C081D181772767FD7095CE01840F6F +:10291000951F0E9490029C01009719F42FEF3FEF42 +:1029200002C02C1B3D0BC901DF91CF91089540E0FF +:1029300050E00E94791408950F931F93CF93DF9373 +:10294000FC018B0141155105F9F061157105E1F0AC +:10295000848195812817390718F0FB01108214C073 +:1029600041505040EC01C21BD30B4C175D0708F4DB +:10297000EA0160817181620F731FC801AE010E947C +:10298000AB02C00FD11F1882DF91CF911F910F9121 +:102990000895DC01FB0114968D919C911597892B6C +:1029A00031F461157105A9F090E0808108C00D90A7 +:1029B000BC91A02D6115710529F490E08C918823BC +:1029C00049F407C0CD010E949B029C0190E0232B9B +:1029D00009F491E0892F08950F931F93CF93DF930C +:1029E000EC018B016F5F7F4F888199810E94AE015E +:1029F000009711F480E005C0998388831B830A83C4 +:102A000081E0DF91CF911F910F910895CF93DF93D4 +:102A1000EC0188819981892B29F08A819B81861715 +:102A2000970760F4CE010E94EC14882341F08C815A +:102A30009D81892B19F4E881F981108281E0DF9171 +:102A4000CF910895EF92FF920F931F93CF93DF934F +:102A5000EC017B016C817D81E114F104C1F0411531 +:102A6000510599F08A01060F171FB8010E9406153B +:102A7000882369F0888199812C813D81820F931F81 +:102A8000B7010E94A4021D830C8381E001C080E095 +:102A9000DF91CF911F910F91FF90EF900895DF93F9 +:102AA000CF9300D0CDB7DEB769831A82BE016F5FC6 +:102AB0007F4F41E050E00E9422150F900F90CF9180 +:102AC000DF910895CF93DF93EC018881998100977E +:102AD00011F00E945601198218821D821C821B82ED +:102AE0001A82DF91CF9108950F931F93182F092F0A +:102AF000FB0160817181448155810E9422158823E8 +:102B000021F4812F902F0E946215812F902F1F9109 +:102B10000F910895EF92FF920F931F93CF93DF933E +:102B2000EC017B018A01BA010E940615882321F479 +:102B3000CE010E94621507C01D830C838881998194 +:102B4000B7010E94A402CE01DF91CF911F910F9196 +:102B5000FF90EF900895CF93DF93EC0119821882D4 +:102B60001B821A821D821C821E826115710551F022 +:102B7000DB010D900020E9F71197A61BB70BAD0103 +:102B80000E948A15DF91CF9108950F931F93182FFC +:102B9000092F6115710559F0DB010D900020E9F74F +:102BA0001197A61BB70BAD010E948A1502C00E94A7 +:102BB0006215812F902F1F910F910895BF92CF9290 +:102BC000DF92EF92FF920F931F93CF93DF93082F23 +:102BD000B92E6B017A01E9012417350710F4EA01D7 +:102BE0007901802F9B2D66EC71E00E94AB15D60118 +:102BF00014968D919C9115978E159F05D0F08C178A +:102C00009D0708F4EC01D601ED91FC911197EC0FB2 +:102C1000FD1F108110826D917C916E0D7F1D802FA4 +:102C20009B2D0E94C515D601ED91FC91EC0FFD1F67 +:102C30001083802F9B2DDF91CF911F910F91FF90DB +:102C4000EF90DF90CF90BF9008950F931F938C016A +:102C5000FB01248135810E94DE15C8011F910F916F +:102C60000895CF93DF93EC01FB018617970761F07E +:102C7000608171816115710529F0448155810E943F +:102C80008A1502C00E946215CE01DF91CF9108958E +:102C9000FC01118210821382128215821482168224 +:102CA0000E9431160895FC01118210821382128253 +:102CB0001582148216820E9431160895FC018081CB +:102CC00091810E9456010895FC01808191810E94AA +:102CD000560108955058BB27AA270ED00DC1FED02B +:102CE00030F003D120F031F49F3F11F41EF4F3C013 +:102CF0000EF4E095E7FBE9C0E92F0FD180F3BA1796 +:102D0000620773078407950718F071F49EF527C1D1 +:102D10000EF4E0950B2EBA2FA02D0B01B9019001F6 +:102D20000C01CA01A0011124FF27591B99F0593F3A +:102D300050F4503E68F11A16F040A22F232F342F82 +:102D40004427585FF3CF469537952795A795F040D0 +:102D50005395C9F77EF41F16BA0B620B730B840BE5 +:102D6000BAF09150A1F0FF0FBB1F661F771F881F9D +:102D7000C2F70EC0BA0F621F731F841F48F48795F5 +:102D800077956795B795F7959E3F08F0B3CF9395E4 +:102D9000880F08F09927EE0F97958795089571D0C1 +:102DA00008F481E0089504D06894B111D9C0089561 +:102DB000BCD088F09F5790F0B92F9927B751A0F059 +:102DC000D1F0660F771F881F991F1AF0BA95C9F7BF +:102DD00012C0B13081F0C3D0B1E00895C0C0672FF8 +:102DE000782F8827B85F39F0B93FCCF3869577956F +:102DF0006795B395D9F73EF4909580957095619558 +:102E00007F4F8F4F9F4F0895E89409C097FB3EF482 +:102E100090958095709561957F4F8F4F9F4F992327 +:102E2000A9F0F92F96E9BB279395F69587957795A5 +:102E30006795B795F111F8CFFAF4BB0F11F460FF65 +:102E40001BC06F5F7F4F8F4F9F4F16C0882311F0BD +:102E500096E911C0772321F09EE8872F762F05C0D1 +:102E6000662371F096E8862F70E060E02AF09A956C +:102E7000660F771F881FDAF7880F9695879597F961 +:102E80000895990F0008550FAA0BE0E8FEEF1616FB +:102E90001706E807F907C0F012161306E407F5074E +:102EA00098F0621B730B840B950B39F40A2661F0C2 +:102EB000232B242B252B21F408950A2609F4A14065 +:102EC000A6958FEF811D811D089597F99F6780E872 +:102ED00070E060E008959FEF80EC089500240A946C +:102EE0001616170618060906089500240A941216E5 +:102EF0001306140605060895092E0394000C11F418 +:102F0000882352F0BB0F40F4BF2B11F460FF04C0C4 +:102F10006F5F7F4F8F4F9F4F089557FD9058440F1D +:102F2000551F59F05F3F71F04795880F97FB991F28 +:102F300061F09F3F79F087950895121613061406E5 +:102F4000551FF2CF4695F1DF08C016161706180672 +:102F5000991FF1CF86957105610508940895E8944D +:102F6000BB2766277727CB0197F908958ADF08F4F6 +:102F70008FEF08950BD0C0CFB1DF28F0B6DF18F087 +:102F8000952309F0A2CFA7CF1124EACFC6DFA0F383 +:102F9000959FD1F3950F50E0551F629FF001729FEE +:102FA000BB27F00DB11D639FAA27F00DB11DAA1F0D +:102FB000649F6627B00DA11D661F829F2227B00D5A +:102FC000A11D621F739FB00DA11D621F839FA00DE5 +:102FD000611D221F749F3327A00D611D231F849F35 +:102FE000600D211D822F762F6A2F11249F5750408C +:102FF0008AF0E1F088234AF0EE0FFF1FBB1F661F27 +:10300000771F881F91505040A9F79E3F510570F0DF +:103010005CCFA6CF5F3FECF3983EDCF386957795C7 +:103020006795B795F795E7959F5FC1F7FE2B880FDA +:10303000911D9695879597F9089597FB092E072678 +:103040000AD077FD04D049D006D000201AF470953C +:1030500061957F4F0895F6F7909581959F4F08955C +:10306000A1E21A2EAA1BBB1BFD010DC0AA1FBB1F8C +:10307000EE1FFF1FA217B307E407F50720F0A21BFE +:10308000B30BE40BF50B661F771F881F991F1A946B +:1030900069F760957095809590959B01AC01BD0195 +:1030A000CF01089597FB092E05260ED057FD04D0B9 +:1030B000D7DF0AD0001C38F4509540953095219503 +:1030C0003F4F4F4F5F4F0895F6F79095809570955D +:1030D00061957F4F8F4F9F4F0895AA1BBB1B51E1F6 +:1030E00007C0AA1FBB1FA617B70710F0A61BB70B78 +:1030F000881F991F5A95A9F780959095BC01CD011D +:103100000895EE0FFF1F0590F491E02D09949111A1 +:1031100006C0803219F089508550D0F7089599275C +:10312000882708952F923F924F925F926F927F92DD +:103130008F929F92AF92BF92CF92DF92EF92FF92C7 +:103140000F931F93CF93DF93CDB7DEB7CA1BDB0B73 +:103150000FB6F894DEBF0FBECDBF09942A88398818 +:1031600048885F846E847D848C849B84AA84B9841F +:10317000C884DF80EE80FD800C811B81AA81B9812B +:10318000CE0FD11D0FB6F894DEBF0FBECDBFED013F +:10319000089511E0C2E0D1E004C0FE010E9483184E +:0C31A0002296C430D107C9F7F894FFCF85 +:1031AC00007B22736F667477617265223A222573F5 +:1031BC00222C2022706F776572223A25622C2022F5 +:1031CC006C656E677468223A25692C2022776964D5 +:1031DC007468223A256900506C6F7474576172657B +:1031EC004669726D776172652076302E302E310013 +:1031FC00583A256620593A25660050524F4752419D +:10320C004D20454E44004F4B0020003B0028002928 +:10321C000047300047310047340047323800473907 +:10322C0030004739310054004D313132004D3131CD +:10323C0034004D313135004D31313800436F6D6DF7 +:10324C00616E64206E6F7420737570706F7274652C +:10325C00642E004D320050656E310050656E3200A8 +:10326C0050656E33000000200005030000FFFFFFD7 +:10327C00FFFFFFFFFFFFFFFFFFFFFFFFFF0000004F +:0E328C00000611AB119C10CD10AD10F6100015 +:00000001FF diff --git a/PlottWareFirmware/build/PlottWareFirmware_uno.hex b/PlottWareFirmware/build/PlottWareFirmware_uno.hex new file mode 100644 index 0000000..ee1d630 --- /dev/null +++ b/PlottWareFirmware/build/PlottWareFirmware_uno.hex @@ -0,0 +1,811 @@ +:100000000C9482000C94AA000C94AA000C94AA00F0 +:100010000C94AA000C94AA000C94AA000C94AA00B8 +:100020000C94AA000C94AA000C94AA000C94AA00A8 +:100030000C94AA000C94AA000C94AA000C94AA0098 +:100040000C94B4120C94AA000C948C0F0C94DA0F3C +:100050000C94AA000C94AA000C94AA000C94AA0078 +:100060000C94AA000C94AA000000000024002700B1 +:100070002A0000000000250028002B0000000000DE +:1000800023002600290004040404040404040202DA +:100090000202020203030303030301020408102007 +:1000A0004080010204081020010204081020000012 +:1000B0000007000201000003040600000000000029 +:1000C0000000494E46494E4954594E414ECDCCCC84 +:1000D0003D0AD7233C17B7D13877CC2B329595E61C +:1000E000241FB14F0A000020410000C84200401CFC +:1000F0004620BCBE4CCA1B0E5AAEC59D74004407B8 +:1001000046113D0711241FBECFEFD8E0DEBFCDBFA3 +:1001100011E0A0E0B1E0ECEAF1E302C005900D923D +:10012000AE3EB107D9F713E0AEEEB1E001C01D92CB +:10013000A530B107E1F710E0C2E0D1E004C022979A +:10014000FE010E948318CE3FD107C9F70E949C117F +:100150000C94C9180C940000CF93DF93BC0182303B +:10016000910510F462E070E0A0910103B0910203E8 +:10017000ED01E0E0F0E040E050E021C088819981AD +:100180008617970769F48A819B81309719F09383CA +:10019000828304C09093020380930103FE0134C064 +:1001A0006817790738F44115510519F08417950738 +:1001B00008F4AC01FE018A819B819C01E901209732 +:1001C000E9F641155105A9F1CA01861B970B049761 +:1001D00008F4BA01E0E0F0E02AC08D919C911197FB +:1001E00084179507F9F46417750781F412968D91B9 +:1001F0009C911397309719F09383828304C0909356 +:10020000020380930103FD0132964CC0CA01861B94 +:10021000970BFD01E80FF91F6193719302978D937E +:100220009C9340C0FD01828193819C01D90110976C +:10023000A1F68091FF0290910003892B41F48091F7 +:10024000C9019091CA01909300038093FF024091ED +:10025000CB015091CC014115510541F44DB75EB72A +:100260008091C7019091C801481B590B2091FF0252 +:1002700030910003CA01821B930B8617970780F009 +:10028000AB014E5F5F4F8417950750F0420F531F2D +:10029000509300034093FF02F9016193719302C0F0 +:1002A000E0E0F0E0CF01DF91CF910895CF93DF93AD +:1002B000009709F450C0EC0122971B821A82A0918A +:1002C0000103B0910203109709F140E050E0AC1730 +:1002D000BD0708F1BB83AA83FE0121913191E20F92 +:1002E000F31FAE17BF0779F48D919C911197280FDA +:1002F000391F2E5F3F4F3983288312968D919C9131 +:1003000013979B838A834115510571F4D09302039F +:10031000C093010320C012968D919C911397AD015B +:10032000009711F0DC01D3CFFA01D383C28321916E +:100330003191E20FF31FCE17DF0769F488819981AD +:10034000280F391F2E5F3F4FFA01318320838A81A6 +:100350009B8193838283DF91CF910895A0E0B0E0E9 +:10036000E4EBF1E00C9494186C01009729F4CB01B4 +:100370000E94AC006C01C1C08EEF882E8FEF982ECA +:100380008C0C9D1C8601060F171F0815190508F413 +:10039000B2C0F401A081B181A617B707B8F0A530AB +:1003A000B10508F4AAC0CD0104978617970708F491 +:1003B000A4C01297A61BB70BF801A193B193D40167 +:1003C0006D937C93CF010E94560197C07B01EA1A7E +:1003D000FB0AEEEFFFEFEE0EFF1E36016A0E7B1EEC +:1003E000C0910103D091020344245524AA24BB24C4 +:1003F0004AC0C615D705E1F5488159814E155F05FC +:10040000B8F1CA0104978E159F05B0F41296A40F97 +:10041000B51FF401B183A0832A813B8141145104AB +:1004200031F0D20113963C932E93129766C030930D +:1004300002032093010361C08A819B81F8019383A9 +:100440008283425050404E195F09518340834114CA +:10045000510431F0D20113961C930E93129704C0ED +:100460001093020300930103F4017183608345C07C +:1004700088819981A816B90608F45C012E018A8149 +:100480009B819C01E901209709F0B3CF8091FF0285 +:100490009091000386159705E9F4A616B706D0F4E7 +:1004A0002091CB013091CC012115310541F42DB7BC +:1004B0003EB78091C7019091C801281B390B0217E4 +:1004C0001307C8F4109300030093FF02D4016D9347 +:1004D0007C9313C0CB010E94AC00EC01009759F053 +:1004E000F40140815181B6010E948702C6010E9439 +:1004F00056016E0102C0CC24DD24C601CDB7DEB7A3 +:10050000E0E10C94B018662777270C94D504FB0122 +:10051000DC0102C001900D9241505040D8F708957F +:10052000FC018191861721F08823D9F79927089536 +:100530003197CF010895FB01DC018D910190801965 +:100540000110D9F3990B0895FB01DC0101900D9284 +:100550000020E1F70895FB01DC014150504048F0D4 +:1005600001900D920020C9F701C01D9241505040EA +:10057000E0F70895FB0151915523A9F0BF01DC017B +:100580004D9145174111E1F759F4CD01019000203B +:1005900049F04D9140154111C9F3FB014111EFCFD5 +:1005A00081E090E001970895AEE0B0E0EAEDF2E07E +:1005B0000C94A0180D891E8986E08C831A83098308 +:1005C0008FEF9FE79E838D839E01275E3F4FCE0175 +:1005D00001966F89788DA9010E94F8022F813885D4 +:1005E000020F131FF80110822E96E4E00C94BC1841 +:1005F000ABE0B0E0EEEFF2E00C9492183C012B017E +:100600005A01FC0117821682838181FD03C06FEFBE +:100610007FEFC6C19AE0892E1E010894211C311C6F +:10062000F3012381F20123FD859123FF81912F01A5 +:10063000882309F4B2C1853239F423FD859123FF63 +:1006400081912F01853229F490E0B3010E94630665 +:10065000E7CF982FFF24EE249924FFE1FF15D0F077 +:100660009B3269F09C3228F4903259F0933291F425 +:100670000EC09D3249F0903369F441E024C052E04D +:10068000F52A84E0F82A28C098E0F92A25C0E0E19C +:10069000FE2A22C0F7FC29C0892F80538A3070F4CB +:1006A000F6FE05C0989C902C1124980E15C0E89C6D +:1006B000E02C1124E80EF0E2FF2A0EC09E3229F44D +:1006C000F6FC6BC140E4F42A07C09C3619F450E8EC +:1006D000F52A02C0983649F4F20123FD959123FFD3 +:1006E00091912F01992309F0B8CF892F8554833038 +:1006F00018F08052833038F444E050E0A40EB51E68 +:100700005FE359830FC0933631F0933779F0933517 +:1007100009F056C020C0F5018081898342E050E095 +:10072000A40EB51E610101E010E012C0F501C08009 +:10073000D180F6FC03C06FEF7FEF02C0692D70E03F +:1007400042E050E0A40EB51EC6010E9458068C017E +:100750005FE7F52214C0F501C080D180F6FC03C02C +:100760006FEF7FEF02C0692D70E042E050E0A40E11 +:10077000B51EC6010E944D068C0150E8F52AF3FE15 +:1007800007C01AC080E290E0B3010E946306EA94B9 +:100790008E2D90E008171907A8F30EC0F601F7FC9C +:1007A0008591F7FE81916F0190E0B3010E9463068D +:1007B000E110EA94015010400115110579F7EAC0E3 +:1007C000943611F0993669F5F7FE08C0F5012081DD +:1007D00031814281538184E090E00AC0F50180813B +:1007E00091819C01442737FD4095542F82E090E091 +:1007F000A80EB91E9FE6F92257FF09C050954095F3 +:10080000309521953F4F4F4F5F4FE0E8FE2ACA01D8 +:10081000B901A1012AE030E00E948F06D82ED2183B +:1008200040C0953729F41F2D1F7E2AE030E01DC0FF +:100830001F2D197F9F3661F0903720F4983509F00D +:10084000ACC00FC0903739F0983709F0A6C004C08B +:1008500028E030E00AC0106114FD146020E130E0AF +:1008600004C014FD166020E132E017FF08C0F50156 +:10087000608171818281938144E050E008C0F5017C +:1008800080819181BC0180E090E042E050E0A40EC4 +:10089000B51EA1010E948F06D82ED2188FE7F82E20 +:1008A000F122F6FE0BC05EEFF522D91438F4F4FE07 +:1008B00007C0F2FC05C08FEEF82202C01D2D01C05A +:1008C000192DF4FE0DC0FE01ED0DF11D8081803368 +:1008D00019F499EEF92208C01F5FF2FE05C003C0AB +:1008E0008F2D867809F01F5F0F2DF3FC14C0F0FEEA +:1008F0000FC01E1510F09D2C0BC09D2C9E0C911A44 +:100900001E2D06C080E290E0B3010E9463061F5FC7 +:100910001E15C0F304C01E1510F4E11A01C0EE2428 +:1009200004FF0FC080E390E0B3010E94630602FF62 +:100930001DC001FD03C088E790E00EC088E590E08F +:100940000BC0802F867891F001FF02C08BE201C0BE +:1009500080E2F7FC8DE290E0B3010E94630606C0DE +:1009600080E390E0B3010E9463069A94D914C0F327 +:10097000DA94F101ED0DF11D808190E0B3010E9448 +:100980006306DD20A9F706C080E290E0B3010E9473 +:100990006306EA94EE20C1F743CEF30166817781C6 +:1009A000CB012B96E2E10C94AE18A0E0B0E0EBEDA9 +:1009B000F4E00C949818EC015B016115710519F0D5 +:1009C000FB0191838083F9908F2D90E00E9487181E +:1009D000892BC9F7FDE2FF1621F4F990EE24E39488 +:1009E00005C02BE2F21609F4F990EE248E010150B5 +:1009F0001040C80162EC70E043E050E00E94350610 +:100A0000892B01F58E010E5F1F4FC80165EC70E068 +:100A100045E050E00E943506892B19F48E01095FEC +:100A20001F4FA114B10419F0F50111830083E0FCFC +:100A300004C070E090E080E814C070E090E080E8CE +:100A40006FEF08C1C8016AEC70E043E050E00E941B +:100A50003506892B69F4A114B10429F470E090E003 +:100A600080EC6FE7F7C02296F501D183C083F6CF03 +:100A70008824992440E050E060E070E0EF2DE053DE +:100A8000EA30A0F5F2E0EF2A8E2D90E09C0128706C +:100A90003070E2FE06C0232B79F50894811C911C6E +:100AA0002BC0232B19F0089481089108DB01CA019F +:100AB00012E0880F991FAA1FBB1F1A95D1F7480F84 +:100AC000591F6A1F7B1F440F551F661F771F4E0F4C +:100AD000511D611D711D483929E9520729E9620735 +:100AE00029E1720748F084E0E82A06C0EE3F31F4BD +:100AF000E3FC39C098E0E92AF990C0CFE53311F062 +:100B0000E53189F529912D3219F4E0E1EE2A05C08D +:100B10002B3219F081E090E003C0299182E090E04F +:100B2000E22FE053EA3018F0C81BD90B1CC020E0BC +:100B300030E0FCE020383F075CF4C901880F991FC2 +:100B4000880F991F280F391F220F331F2E0F311DB9 +:100B5000E991E053EA3068F3E4FE03C03095219553 +:100B60003F4F820E931ECE2CDD24E1FE07C0A11460 +:100B7000B10421F02197F501D183C083CB01BA01E3 +:100B80000E9404177B018C01F3E0CF22DD2423E0D7 +:100B9000C216D10421F417FB109517F910955701CF +:100BA0006801C801B70120E030E040E050E00E9459 +:100BB000CF16882309F44AC097FE0DC021EEE22E1D +:100BC00020E0F22E9094819491089394C0E2D0E0BA +:100BD00000E010E012C099EFE92E90E0F92EF6CF78 +:100BE000F7012591359145915491C601B5010E94B7 +:100BF000BA175B016C018C1A9D0A8C169D0684F74E +:100C0000D595C7950F5F1F4F0630110529F08CEF62 +:100C10009FEFE80EF91EF1CFC501D6017C018D01D1 +:100C20008C2D880F8D2D881F8F3F51F0C601B50187 +:100C300020E030E040E050E00E94CF16882331F4FD +:100C400082E290E090930403809303037E2D9F2D16 +:100C5000802F612F272F392F482F562FB901CA0116 +:100C6000CDB7DEB7ECE00C94B418FB01DC014150C9 +:100C7000504088F08D9181341CF08B350CF4805EEF +:100C8000659161341CF06B350CF4605E861B61115C +:100C900071F3990B0895881BFCCFFC0105906150FE +:100CA00070400110D8F7809590958E0F9F1F089582 +:100CB000FC016150704001900110D8F7809590952B +:100CC0008E0F9F1F08950F931F93CF93DF938C0177 +:100CD000EB018B8181FF1BC082FF0DC02E813F8104 +:100CE0008C819D812817390764F4E881F98101938B +:100CF000F983E88306C0E885F985802F0995892B5B +:100D000031F48E819F8101969F838E8302C00FEF05 +:100D10001FEFC801DF91CF911F910F910895FA0144 +:100D2000AA27283051F1203181F1E8946F936E7F2A +:100D30006E5F7F4F8F4F9F4FAF4FB1E03ED0B4E01B +:100D40003CD0670F781F891F9A1FA11D680F791F5C +:100D50008A1F911DA11D6A0F711D811D911DA11D6D +:100D600020D009F468943F912AE0269F112430197D +:100D7000305D3193DEF6CF010895462F4770405D18 +:100D80004193B3E00FD0C9F7F6CF462F4F70405DC7 +:100D90004A3318F0495D31FD4052419302D0A9F722 +:100DA000EACFB4E0A6959795879577956795BA951C +:100DB000C9F700976105710508959B01AC010A2EE2 +:100DC00006945795479537952795BA95C9F7620FB9 +:100DD000731F841F951FA01D0895EF92FF920F931C +:100DE0001F938130910551F0892B19F46F5F7F4F6C +:100DF000A1F11F910F91FF90EF9008956F5F7F4FCA +:100E0000C1F70EEE11E0C80160E071E00E94AB1581 +:100E1000095F1F4F82E00A301807A9F785E192E0C9 +:100E200068EC70E048E050E029E030E00AE010E0D3 +:100E3000FBE0EF2EF12C0E94500F8FE292E068EC65 +:100E400070E042E050E023E030E004E010E0E5E054 +:100E5000EE2EF12C0E94500FCCCF03E012E0C8011F +:100E60000E945E160750104081E0073E1807B9F750 +:100E70001F910F91FF90EF90089580E090E06FEF49 +:100E80007FEF0E94ED06089581E090E06FEF7FEF25 +:100E90000E94ED0608950F931F93DF93CF93CDB774 +:100EA000DEB7C45FD1400FB6F894DEBF0FBECDBF32 +:100EB0008DB79EB70C970FB6F8949EBF0FBE8DBF2F +:100EC000EDB7FEB731968E010F5F1F4FADB7BEB7BE +:100ED00012961C930E93119781E091E09383828385 +:100EE00087E391E09583848381E090E09783868314 +:100EF0008FEF9FEF9187808784E190E093878287CF +:100F00000E94D4028DB79EB70C960FB6F8949EBF80 +:100F10000FBE8DBF83ED92E0B8010E941112CC503C +:100F2000DE4F0FB6F894DEBF0FBECDBFCF91DF917D +:100F30001F910F9108950F931F93DF93CF93CDB718 +:100F4000DEB7E2970FB6F894DEBF0FBECDBF8DB708 +:100F50009EB70C970FB6F8949EBF0FBE8DBFEDB72E +:100F6000FEB731968E010F5F1F4FADB7BEB7129619 +:100F70001C930E93119780E591E093838283809177 +:100F8000D5019091D601A091D701B091D801848369 +:100F90009583A683B7838091D9019091DA01A091BE +:100FA000DB01B091DC0180879187A287B3870E9423 +:100FB000D4028DB79EB70C960FB6F8949EBF0FBEA5 +:100FC0008DBF83ED92E0B8010E941112E2960FB638 +:100FD000F894DEBF0FBECDBFCF91DF911F910F916F +:100FE000089583ED92E06AE571E00E941112089580 +:100FF000BC0183ED92E00E94571208950F931F9356 +:10100000DF93CF93CDB7DEB727970FB6F894DEBF47 +:101010000FBECDBF81E0809314028E010F5F1F4F82 +:10102000C80166E671E00E94AB15C8010E94F8078E +:10103000C8010E945E1627960FB6F894DEBF0FBE59 +:10104000CDBFCF91DF911F910F9108950F931F9303 +:10105000DF93CF93CDB7DEB727970FB6F894DEBFF7 +:101060000FBECDBF109214028E010F5F1F4FC8013B +:1010700066E671E00E94AB15C8010E94F807C8013E +:101080000E945E1627960FB6F894DEBF0FBECDBF46 +:10109000CF91DF911F910F9108950F931F93DF93CD +:1010A000CF93CDB7DEB727970FB6F894DEBF0FBE4C +:1010B000CDBF1092CD011092CE011092CF011092AF +:1010C000D0011092D1011092D2011092D30110924E +:1010D000D4018E010F5F1F4FC80166E671E00E94C8 +:1010E000AB15C8010E94F807C8010E945E1627963A +:1010F0000FB6F894DEBF0FBECDBFCF91DF911F9129 +:101100000F9108950F931F93DF93CF93CDB7DEB761 +:1011100027970FB6F894DEBF0FBECDBF0E94D8163A +:101120000E9430138E010F5F1F4FC80166E671E009 +:101130000E94AB15C8010E94F807C8010E945E1604 +:1011400027960FB6F894DEBF0FBECDBFCF91DF91CB +:101150001F910F910895FC01662349F4EE0FFF1FC4 +:10116000E65FFD4F808160E00E94FD130895EE0F61 +:10117000FF1FE65FFD4F808161E00E94FD1308952F +:101180000F931F93DF93CF93CDB7DEB727970FB69B +:10119000F894DEBF0FBECDBF8C01809112029091FA +:1011A0001302009701F5043011051CF1109213028F +:1011B000109212028E010F5F1F4FC80166E671E0A8 +:1011C0000E94AB15C8010E94F807C8010E945E1674 +:1011D00027960FB6F894DEBF0FBECDBFCF91DF913B +:1011E0001F910F91089561E00E94AB080430110532 +:1011F000ECF6C80160E00E94AB0810931302009364 +:101200001202D8CF2F923F924F925F926F927F92AD +:101210008F929F92AF92BF92CF92DF92EF92FF9206 +:101220000F931F93DF93CF93CDB7DEB72C970FB6F5 +:10123000F894DEBF0FBECDBF6B837C838D839E830E +:101240002F83388749875A8785E192E0B801A70143 +:101250000E94500E8FE292E0B801A7010E94500E4A +:1012600080911402882361F16091CD017091CE01CB +:101270008091CF019091D0010E9404179B01AC0195 +:101280006B817C818D819E810E946B166B837C8338 +:101290008D839E836091D1017091D2018091D301A1 +:1012A0009091D4010E9404179B01AC016F81788555 +:1012B00089859A850E946B166F83788789879A87BC +:1012C0006B817C818D819E8120E030E040EA51E499 +:1012D0000E94B61718160CF00CC180E090E0A0EA4E +:1012E000B1E48B839C83AD83BE8398EEE92E93E0BB +:1012F000F92E012D112D88EEC82E83E0D82E6F8196 +:10130000788589859A8520E030E048E452E40E949F +:10131000BA170E94D3162091CD013091CE01409191 +:10132000CF015091D0012E153F054007510709F418 +:101330002EC15601A21AB30ACB01AA2797FDA09588 +:10134000BA2FE090D101F090D2010091D301109119 +:10135000D4018E159F05A007B10709F414C16B01D4 +:10136000CE18DF08CA01B9010E9404179B01AC0125 +:101370006B817C818D819E810E94B61718160CF4BA +:10138000B3C0AFEFBFEFBA83A983C801B7010E9412 +:1013900004179B01AC016F81788589859A850E942D +:1013A000B61718160CF49BC08FEF9FEF9C878B87A6 +:1013B000CA14DB040CF441C03601882477FC809405 +:1013C000982C611471048104910409F441C0150141 +:1013D000442437FC4094542CEE24FF248701AA2493 +:1013E000BB24650110C060E070E080E090E00E94E6 +:1013F00030130894A11CB11CC11CD11CA614B70445 +:10140000C804D90428F58FE292E06B857C850E94A0 +:10141000EE0EE20CF31C041D151DE614F70408057E +:10142000190508F3E618F7080809190985E192E09B +:1014300069817A810E94EE0ED6CF3501882477FC2F +:101440008094982C611471048104910409F064C0A3 +:101450006B817C818D819E810E94D8167B018C01DD +:101460006093CD017093CE018093CF019093D00112 +:101470006F81788589859A850E94D8166093D101FD +:101480007093D2018093D3019093D401E092D5015F +:10149000F092D6010093D7011093D8016093D9013F +:1014A0007093DA018093DB019093DC012C960FB6E8 +:1014B000F894DEBF0FBECDBFCF91DF911F910F918A +:1014C000FF90EF90DF90CF90BF90AF909F908F9064 +:1014D0007F906F905F904F903F902F900895A1E084 +:1014E000B0E0BC87AB8764CFE1E0F0E0FA83E9834A +:1014F0004CCF6B817C818D819E8120E030E048E47F +:1015000052E40E94BA170E94D3167B010027F7FC11 +:101510000095102F6B01F3CE1601442437FC409444 +:10152000542CEE24FF248701AA24BB24650111C09A +:1015300060E070E080E090E00E9430130894A11C0D +:10154000B11CC11CD11CA614B704C804D90408F0EE +:101550007FCF85E192E069817A810E94EE0EE20CF4 +:10156000F31C041D151DE614F7040805190500F306 +:10157000E618F708080919098FE292E06B857C8567 +:101580000E94EE0ED5CF6701C61AD70AEBCE5701DF +:10159000AC18BD08D1CEEF92FF920F931F93DF934B +:1015A000CF93CDB7DEB727970FB6F894DEBF0FBE47 +:1015B000CDBFF6E9EF2EF12C012D112D0E9402096D +:1015C0008E010F5F1F4FC80166E671E00E94AB15E8 +:1015D000C8010E94F807C8010E945E1627960FB640 +:1015E000F894DEBF0FBECDBFCF91DF911F910F9159 +:1015F000FF90EF900895CF92DF92EF92FF920F93BA +:101600001F93DF93CF93CDB7DEB727970FB6F8942C +:10161000DEBF0FBECDBFD82EC92E7B018E010F5F5E +:101620001F4FC80169E671E00E94AB15C701B80100 +:101630000E9474149C018D2D9C2DB70140E050E058 +:101640000E94DE15C8010E945E168D2D9C2D2796E6 +:101650000FB6F894DEBF0FBECDBFCF91DF911F91C3 +:101660000F91FF90EF90DF90CF900895AF92BF92CF +:10167000CF92DF92EF92FF920F931F93DF93CF935E +:10168000CDB7DEB7C054D0400FB6F894DEBF0FBE62 +:10169000CDBF7C01162F0E9497146C015E01089447 +:1016A000A11CB11CC50169E671E00E94AB15C70120 +:1016B000612F0E949714AC01C701B5010E94561416 +:1016C0009C018E01085F1F4F0894C11CD11CC801EA +:1016D000B701A6010E94DE15AFE0EA2EF12CEC0E58 +:1016E000FD1EC801B70142E350E020E030E00E9457 +:1016F0009C14C8010E945E16C5010E945E16C701B7 +:101700000E948302C05CDF4F0FB6F894DEBF0FBEAD +:10171000CDBFCF91DF911F910F91FF90EF90DF90A0 +:10172000CF90BF90AF9008954F925F926F927F924B +:101730008F929F92AF92BF92CF92DF92EF92FF92E1 +:101740000F931F93DF93CF93CDB7DEB7E8970FB614 +:10175000F894DEBF0FBECDBF582E492E3B018E013F +:101760000F5F1F4FC8016BE671E00E94AB15C3010C +:10177000B8010E9474147C01C8010E945E168FEFAC +:10178000E8168FEFF80681F18E01085F1F4FC80140 +:101790006BE671E00E94AB15C301B8010E9474149E +:1017A0009C01852D942DB30140E050E00E94DE1590 +:1017B000C8010E945E16852D942DE8960FB6F89408 +:1017C000DEBF0FBECDBFCF91DF911F910F91FF9074 +:1017D000EF90DF90CF90BF90AF909F908F907F90D1 +:1017E0006F905F904F9008958E01015F1F4FC80169 +:1017F0006DE671E00E94AB15C301B8010E9474143C +:101800007C01C8010E945E168FEFE8168FEFF80684 +:1018100009F452C086E1882E912C8C0E9D1EC401C5 +:101820006DE671E00E94AB15C301B4010E9474140F +:101830009C010DE1A02EB12CAC0EBD1EC501B30163 +:1018400040E050E00E94DE1512E3C12ED12CCC0EF8 +:10185000DD1EC601B5010E945316B4E2EB2EF12C39 +:10186000EC0EFD1EC7016FE671E00E94AB15C301CF +:10187000B7010E947414AC018E01055D1F4FC801B1 +:10188000B3010E942516C601B8010E947415BC015F +:10189000852D942D0E944816C8010E945E16C7012E +:1018A0000E945E16C6010E946416C5010E945E1663 +:1018B000C4010E945E167FCF852D942DB3010E9436 +:1018C000481679CF6F927F928F929F92AF92BF927C +:1018D000CF92DF92EF92FF920F931F93DF93CF93FC +:1018E000CDB7DEB7CB55D0400FB6F894DEBF0FBEF4 +:1018F000CDBF4C017E010894E11CF11CC701B4016D +:101900000E9448168E01085F1F4FC801B7010E9450 +:10191000940BC401B8010E943116C8010E945E16E2 +:10192000C7010E945E168E010A5E1F4FC801B401F6 +:101930000E9448165FE0652E712C6C0E7D1EC3015F +:10194000B8010E94FB0AC8010E945E16C40160E053 +:1019500070E00E943014FC010081C30161E771E076 +:101960000E94C914882309F083C0C30164E771E0B1 +:101970000E94C9148823E9F5C30167E771E00E945A +:10198000C914882309F087C0C3016AE771E00E9487 +:10199000C914882309F090C0C3016EE771E00E946A +:1019A000C914882309F08BC0C30162E871E00E946A +:1019B000C914882309F086C0C30166E871E00E945B +:1019C000C914882309F481C08E01005C1F4FC8012F +:1019D000B4010E944816C80164E50E94360B0E94BB +:1019E000D316DC01CB010E94C008C8010E945E161C +:1019F00026C03BE2A32EB12CAC0EBD1EC501B40126 +:101A00000E944816C50168E50E94360B6B017C01F7 +:101A10008E010E5C1F4FC801B4010E944816C80118 +:101A200069E50E94360B9B01AC01C701B6010E941B +:101A3000CB0AC8010E945E16C5010E945E16C30152 +:101A40000E945E16C55ADF4F0FB6F894DEBF0FBE78 +:101A5000CDBFCF91DF911F910F91FF90EF90DF905D +:101A6000CF90BF90AF909F908F907F906F90089590 +:101A70004DE1A42EB12CAC0EBD1EC501B4010E94D7 +:101A80004816C50168E50E94360B6B017C018E018A +:101A90000C5D1F4FC0CF8E01075C1F4FC801B40102 +:101AA0000E944816C80160E50E94360B0E94820819 +:101AB000C8010E945E16C3CF0E944D08C0CF0E948D +:101AC0002608BDCF0E94FE07BACF043509F47CCFAB +:101AD000C30163EB71E00E94C914882359F5C30167 +:101AE00068E871E00E94C914882339F5C3016DE8E4 +:101AF00071E00E94C914882331F5C30162E971E0E5 +:101B00000E94C914882311F5C30167E971E00E949E +:101B1000C9148823F1F48E010B5A1F4FC8016CE9D8 +:101B200071E00E94AB15C8010E94F807C8010E942D +:101B30005E1685CF0E94F10782CFE0914902F091B5 +:101B40004A0209957CCF0E949B0779CF0E944B07E0 +:101B500076CF8E01095B1F4FC80167E971E00E94D3 +:101B6000AB15C401B8010E9474142EE4E22EF12CCE +:101B7000EC0EFD1EAC014C5F5F4FC701B4010E942B +:101B80002516C7010E94F807C7010E945E16C8010A +:101B90000E945E1654CFEF92FF920F931F93DF9334 +:101BA000CF93CDB7DEB72E970FB6F894DEBF0FBE3A +:101BB000CDBF83ED92E00E949C10892BC9F07E017D +:101BC0000894E11CF11CC70163ED72E00E949712BA +:101BD0008E01085F1F4FC801B7010E944816C80157 +:101BE0000E94620CC8010E945E16C7010E945E1628 +:101BF0002E960FB6F894DEBF0FBECDBFCF91DF910A +:101C00001F910F91FF90EF900895CF93DF93CCE059 +:101C1000D2E0888161E00E949113888161E00E9496 +:101C2000FD13229682E0C231D80799F7DF91CF9158 +:101C300008950F931F9305EF11E0C80166EB71E063 +:101C40000E94C515C80107966BEB71E00E94C5158F +:101C5000C8010E9660EC71E00E94C5151F910F91AE +:101C6000089583ED92E040E855E260E070E00E9464 +:101C700015100E94050E0E94190E86E090E09093C8 +:101C80000D0280930C0287E090E090930F02809306 +:101C90000E028CE090E09093110280931002089560 +:101CA000CF92DF92EF92FF920F931F936C017A0114 +:101CB0008B01FC0120853185442737FD4095542F49 +:101CC00060E67AEE80E090E00E945218CA01B90105 +:101CD000A80197010E945218F60124833583468398 +:101CE00057831F910F91FF90EF90DF90CF90089551 +:101CF0000F931F93CF93DF93EC018B018A859B8514 +:101D0000029731F56130710589F06230710524F474 +:101D10006115710541F01CC06230710571F06330CE +:101D20007105B1F40DC08E8560E002C08E8561E062 +:101D30000E94FD13888961E009C08E8561E002C0C0 +:101D40008E8560E00E94FD13888960E00E94FD138B +:101D50008A859B850497E9F501301105A1F00230D1 +:101D600011051CF4012B41F034C002301105D1F0F3 +:101D70000330110571F51DC08E8561E00E94FD13D1 +:101D8000888960E006C08E8560E00E94FD13888926 +:101D900061E00E94FD138A8961E00E94FD138C8935 +:101DA00060E015C08E8560E00E94FD13888961E0C7 +:101DB00006C08E8561E00E94FD13888960E00E9464 +:101DC000FD138A8960E00E94FD138C8961E00E9406 +:101DD000FD13DF91CF911F910F9108950F931F93E2 +:101DE000CF93DF93EC011616170624F481E090E000 +:101DF0009983888377FF02C0198218828B0177FF4D +:101E000046C0109501951F4F42C00E94FC122E89BA +:101E10003F89488D598D621B730B840B950B2C8168 +:101E20003D814E815F81621773078407950768F3D0 +:101E30000E94FC126E8B7F8B888F998F888199818D +:101E40002C853D85019761F42F5F3F4F3D872C879F +:101E5000888599852817390771F41D861C860BC063 +:101E6000232B21F4888599859D878C878C859D857A +:101E700001979D878C87015010408C859D8564E07B +:101E800070E00E941D18BC01CE010E94780E011561 +:101E9000110509F0BACFDF91CF911F910F910895ED +:101EA000CF92DF92EF92FF920F931F936C01842FDA +:101EB000F601158614861382128211821082168A08 +:101EC000178A108E118E7187608746875787318BEE +:101ED000208B138B028BF58AE48A61E00E949113B8 +:101EE000F601808961E00E949113F601828961E028 +:101EF0000E949113F601848961E00E94911384E0AD +:101F000090E0F601938782871F910F91FF90EF90E9 +:101F1000DF90CF90089508951F920F920FB60F9201 +:101F200011242F933F934F938F939F93EF93FF939E +:101F30008091C00082FD1DC04091C60020918B029F +:101F400030918C022F5F3F4F2F73307080918D0244 +:101F500090918E022817390771F0E0918B02F09171 +:101F60008C02E55BFD4F408330938C0220938B0203 +:101F700002C08091C600FF91EF919F918F914F9188 +:101F80003F912F910F900FBE0F901F901895E091E9 +:101F9000DF02F091E002E05CFF4F8191919120819E +:101FA0003181821B930B8F739070892B11F00E94EB +:101FB0008B0F08951F920F920FB60F9211242F933B +:101FC0003F938F939F93EF93FF932091CF02309194 +:101FD000D0028091D1029091D2022817390731F4B2 +:101FE0008091C1008F7D8093C10014C0E091D10227 +:101FF000F091D202E157FD4F20818091D102909162 +:10200000D20201968F7390709093D2028093D10286 +:102010002093C600FF91EF919F918F913F912F9157 +:102020000F900FBE0F901F901895AF92BF92DF9246 +:10203000EF92FF920F931F93CF93DF93EC017A01FE +:102040008B01DD24403081EE580780E0680780E096 +:10205000780711F0DD24D39491E0A92EB12CEC89FE +:10206000FD89DD2069F0C50108A002C0880F991F15 +:102070000A94E2F7808360E079E08DE390E005C0A8 +:10208000108260E874E88EE190E0A80197010E9458 +:102090003018215030404040504056954795379574 +:1020A000279580E12030380720F0DD2011F0DD2475 +:1020B000D6CFE889F9893083EA89FB89208319A280 +:1020C000EE89FF89408121E030E0C9010C8C02C01B +:1020D000880F991F0A94E2F7482B4083EE89FF8905 +:1020E0004081C9010D8C02C0880F991F0A94E2F744 +:1020F000482B4083EE89FF894081C9010E8C02C0C4 +:10210000880F991F0A94E2F7482B4083EE89FF89D4 +:1021100080810F8C02C0220F331F0A94E2F72095B2 +:1021200028232083DF91CF911F910F91FF90EF9093 +:10213000DF90BF90AF900895DC011C96ED91FC916B +:102140001D97E05CFF4F2191319180819181281B87 +:10215000390B2F733070C9010895DC011C96ED9185 +:10216000FC911D97E05CFF4F20813181E054F040ED +:10217000DF01AE5BBF4F8D919C91119728173907F6 +:1021800019F42FEF3FEF07C08D919C91E80FF91FD5 +:102190008081282F30E0C9010895DC011C96ED9163 +:1021A000FC911D97E05CFF4F20813181E054F040AD +:1021B000DF01AE5BBF4F8D919C91119728173907B6 +:1021C00019F42FEF3FEF10C08D919C911197E80FFC +:1021D000F91F20818D919C91119701968F739070BA +:1021E00011969C938E9330E0C9010895DC0191967D +:1021F0008C919197882339F05496ED91FC915597E5 +:10220000808186FFF9CF91961C920895CF93DF933A +:10221000EC01EE85FF85E05CFF4F20813181E054C9 +:10222000F0402F5F3F4F2F733070DF01AE5BBF4F29 +:102230008D919C91119728173907D1F3E05CFF4FDE +:1022400080819181E054F040E80FF91F6083EE85B2 +:10225000FF85E05CFF4F31832083EE89FF89208179 +:1022600081E090E00F8C02C0880F991F0A94E2F77A +:10227000282B208381E089A3EC89FD8980818064FB +:10228000808381E090E0DF91CF9108951092D60293 +:102290001092D50288EE93E0A0E0B0E08093D702E0 +:1022A0009093D802A093D902B093DA0281EE91E024 +:1022B0009093D4028093D3028BE492E09093E00257 +:1022C0008093DF028FE892E09093E2028093E10234 +:1022D00085EC90E09093E4028093E30284EC90E03C +:1022E0009093E6028093E50280EC90E09093E80200 +:1022F0008093E70281EC90E09093EA028093E902F8 +:1023000082EC90E09093EC028093EB0286EC90E0FC +:102310009093EE028093ED0284E08093EF0283E0DD +:102320008093F00287E08093F10285E08093F202CF +:1023300081E08093F3020895CF93DF930E945613B8 +:102340000E94310EC7ECDFE00E94CB0D2097E1F335 +:102350000E94C70FF9CFCF92DF92EF92FF920F93B7 +:102360001F93CF93DF937C016B018A01C0E0D0E023 +:102370000FC0D6016D916D01D701ED91FC910190D7 +:10238000F081E02DC7010995C80FD91F01501040F9 +:102390000115110571F7CE01DF91CF911F910F91BA +:1023A000FF90EF90DF90CF900895EF92FF920F9300 +:1023B0001F938C01DC01ED91FC910190F081E02DE7 +:1023C0006DE009957C01D801ED91FC910190F081BF +:1023D000E02DC8016AE009959C012E0D3F1DC90141 +:1023E0001F910F91FF90EF900895CF93DF93EC0131 +:1023F0006115710519F420E030E00FC0DB010D908C +:102400000020E9F71197A61BB70BE881F98102803C +:10241000F381E02DAD0109959C01C901DF91CF91B8 +:102420000895EF92FF920F931F937C010E94F51184 +:102430008C01C7010E94D511080F191FC8011F91F7 +:102440000F91FF90EF900895AF92BF92CF92DF92DD +:10245000EF92FF920F931F93CF93DF935C016B0179 +:10246000EE24FF24C0E0D0E010C0D501ED91FC9136 +:1024700000811181C601BE010E944514682FC5016B +:10248000F8010995E80EF91E2196F60184819581DF +:10249000C817D90750F3C701DF91CF911F910F9152 +:1024A000FF90EF90DF90CF90BF90AF900895EF92A4 +:1024B000FF920F931F937C010E9424128C01C7018D +:1024C0000E94D5119C01200F311FC9011F910F914E +:1024D000FF90EF900895CF93DF93EC010E94FC12E0 +:1024E000688779878A879B87E881F9810680F781E9 +:1024F000E02DCE0109959C0197FF15C00E94FC12AA +:10250000288539854A855B85621B730B840B950B87 +:102510002C813D814E815F81621773078407950787 +:1025200018F32FEF3FEFC901DF91CF9108950F937B +:102530001F93CF93DF93182F092FEB0165EC71E008 +:102540000E94AB1504C0812F902F0E944F15CE0121 +:102550000E946B12BC0197FFF6CF812F902FDF9165 +:10256000CF911F910F9108951F920F920FB60F9266 +:1025700011242F933F938F939F93AF93BF93809199 +:10258000F9029091FA02A091FB02B091FC02309105 +:10259000FD020196A11DB11D232F2D5F2D3720F0C7 +:1025A0002D570196A11DB11D2093FD028093F902C4 +:1025B0009093FA02A093FB02B093FC028091F50283 +:1025C0009091F602A091F702B091F8020196A11D38 +:1025D000B11D8093F5029093F602A093F702B09399 +:1025E000F802BF91AF919F918F913F912F910F90E2 +:1025F0000FBE0F901F9018958FB7F8942091F90295 +:102600003091FA024091FB025091FC028FBFB90158 +:10261000CA0108959FB7F8942091F5023091F6020F +:102620004091F7025091F80286B5A89B06C08F3FF3 +:1026300021F02F5F3F4F4F4F5F4F9FBF542F432FCE +:10264000322F2227280F311D411D511D82E0220FFC +:10265000331F441F551F8A95D1F7B901CA01089548 +:10266000EF92FF920F931F93CF93DF937B018C0127 +:102670000E940A13EB010EC00E940A136C1B7D0B13 +:10268000685E7340C8F30894E108F1080109110974 +:10269000C851DC4FE114F1040105110569F7DF9120 +:1026A000CF911F910F91FF90EF900895789484B58A +:1026B000826084BD84B5816084BD85B5826085BD3E +:1026C00085B5816085BDEEE6F0E080818160808324 +:1026D000E1E8F0E010828081826080838081816007 +:1026E0008083E0E8F0E0808181608083E1EBF0E0CE +:1026F000808184608083E0EBF0E080818160808372 +:10270000EAE7F0E08081846080838081826080835A +:102710008081816080838081806880831092C10085 +:102720000895CF93DF93482F50E0CA0186569F4FFC +:10273000FC0134914A575F4FFA018491882369F173 +:1027400090E0880F991FFC01E859FF4FA591B491C3 +:10275000FC01EE58FF4FC591D491662351F42FB779 +:10276000F8948C91932F909589238C938881892359 +:102770000BC0623061F42FB7F8948C91932F909531 +:1027800089238C938881832B88832FBF06C09FB7B2 +:10279000F8948C91832B8C939FBFDF91CF910895F8 +:1027A000833071F0843028F48130A1F0823021F53B +:1027B00014C08630B1F08730D1F08430E9F404C021 +:1027C000809180008F7703C0809180008F7D8093FF +:1027D0008000089584B58F7702C084B58F7D84BD55 +:1027E00008958091B0008F778093B0000895809114 +:1027F000B0008F7D8093B0000895FF920F931F93D8 +:10280000F62E482F50E0CA0182559F4FFC012491BB +:10281000CA0186569F4FFC0114914A575F4FFA0137 +:1028200004910023C9F0222319F0822F0E94D013B3 +:10283000E02FF0E0EE0FFF1FEE58FF4FA591B4918F +:102840009FB7F894FF2021F48C911095812302C04A +:102850008C91812B8C939FBF1F910F91FF900895B6 +:10286000FC019B01848195816817790728F46081B8 +:1028700071816115710529F41092FE026EEF72E00C +:1028800002C0620F731FCB010895FC018481958102 +:102890006817790748F40190F081E02D309721F016 +:1028A000E60FF71F8081089580E00895CF93DF93AE +:1028B000FC01DB01848195814817590760F4C081D0 +:1028C000D1816D917C91CE01840F951F0E94BA0237 +:1028D0009C01009719F42FEF3FEF02C02C1B3D0B1A +:1028E000C901DF91CF91089540E050E00E94561455 +:1028F0000895CF93DF93FC01848195814817590790 +:1029000068F4C081D181772767FD7095CE01840F6F +:10291000951F0E9490029C01009719F42FEF3FEF42 +:1029200002C02C1B3D0BC901DF91CF91089540E0FF +:1029300050E00E94791408950F931F93CF93DF9373 +:10294000FC018B0141155105F9F061157105E1F0AC +:10295000848195812817390718F0FB01108214C073 +:1029600041505040EC01C21BD30B4C175D0708F4DB +:10297000EA0160817181620F731FC801AE010E947C +:10298000AB02C00FD11F1882DF91CF911F910F9121 +:102990000895DC01FB0114968D919C911597892B6C +:1029A00031F461157105A9F090E0808108C00D90A7 +:1029B000BC91A02D6115710529F490E08C918823BC +:1029C00049F407C0CD010E949B029C0190E0232B9B +:1029D00009F491E0892F08950F931F93CF93DF930C +:1029E000EC018B016F5F7F4F888199810E94AE015E +:1029F000009711F480E005C0998388831B830A83C4 +:102A000081E0DF91CF911F910F910895CF93DF93D4 +:102A1000EC0188819981892B29F08A819B81861715 +:102A2000970760F4CE010E94EC14882341F08C815A +:102A30009D81892B19F4E881F981108281E0DF9171 +:102A4000CF910895EF92FF920F931F93CF93DF934F +:102A5000EC017B016C817D81E114F104C1F0411531 +:102A6000510599F08A01060F171FB8010E9406153B +:102A7000882369F0888199812C813D81820F931F81 +:102A8000B7010E94A4021D830C8381E001C080E095 +:102A9000DF91CF911F910F91FF90EF900895DF93F9 +:102AA000CF9300D0CDB7DEB769831A82BE016F5FC6 +:102AB0007F4F41E050E00E9422150F900F90CF9180 +:102AC000DF910895CF93DF93EC018881998100977E +:102AD00011F00E945601198218821D821C821B82ED +:102AE0001A82DF91CF9108950F931F93182F092F0A +:102AF000FB0160817181448155810E9422158823E8 +:102B000021F4812F902F0E946215812F902F1F9109 +:102B10000F910895EF92FF920F931F93CF93DF933E +:102B2000EC017B018A01BA010E940615882321F479 +:102B3000CE010E94621507C01D830C838881998194 +:102B4000B7010E94A402CE01DF91CF911F910F9196 +:102B5000FF90EF900895CF93DF93EC0119821882D4 +:102B60001B821A821D821C821E826115710551F022 +:102B7000DB010D900020E9F71197A61BB70BAD0103 +:102B80000E948A15DF91CF9108950F931F93182FFC +:102B9000092F6115710559F0DB010D900020E9F74F +:102BA0001197A61BB70BAD010E948A1502C00E94A7 +:102BB0006215812F902F1F910F910895BF92CF9290 +:102BC000DF92EF92FF920F931F93CF93DF93082F23 +:102BD000B92E6B017A01E9012417350710F4EA01D7 +:102BE0007901802F9B2D66EC71E00E94AB15D60118 +:102BF00014968D919C9115978E159F05D0F08C178A +:102C00009D0708F4EC01D601ED91FC911197EC0FB2 +:102C1000FD1F108110826D917C916E0D7F1D802FA4 +:102C20009B2D0E94C515D601ED91FC91EC0FFD1F67 +:102C30001083802F9B2DDF91CF911F910F91FF90DB +:102C4000EF90DF90CF90BF9008950F931F938C016A +:102C5000FB01248135810E94DE15C8011F910F916F +:102C60000895CF93DF93EC01FB018617970761F07E +:102C7000608171816115710529F0448155810E943F +:102C80008A1502C00E946215CE01DF91CF9108958E +:102C9000FC01118210821382128215821482168224 +:102CA0000E9431160895FC01118210821382128253 +:102CB0001582148216820E9431160895FC018081CB +:102CC00091810E9456010895FC01808191810E94AA +:102CD000560108955058BB27AA270ED00DC1FED02B +:102CE00030F003D120F031F49F3F11F41EF4F3C013 +:102CF0000EF4E095E7FBE9C0E92F0FD180F3BA1796 +:102D0000620773078407950718F071F49EF527C1D1 +:102D10000EF4E0950B2EBA2FA02D0B01B9019001F6 +:102D20000C01CA01A0011124FF27591B99F0593F3A +:102D300050F4503E68F11A16F040A22F232F342F82 +:102D40004427585FF3CF469537952795A795F040D0 +:102D50005395C9F77EF41F16BA0B620B730B840BE5 +:102D6000BAF09150A1F0FF0FBB1F661F771F881F9D +:102D7000C2F70EC0BA0F621F731F841F48F48795F5 +:102D800077956795B795F7959E3F08F0B3CF9395E4 +:102D9000880F08F09927EE0F97958795089571D0C1 +:102DA00008F481E0089504D06894B111D9C0089561 +:102DB000BCD088F09F5790F0B92F9927B751A0F059 +:102DC000D1F0660F771F881F991F1AF0BA95C9F7BF +:102DD00012C0B13081F0C3D0B1E00895C0C0672FF8 +:102DE000782F8827B85F39F0B93FCCF3869577956F +:102DF0006795B395D9F73EF4909580957095619558 +:102E00007F4F8F4F9F4F0895E89409C097FB3EF482 +:102E100090958095709561957F4F8F4F9F4F992327 +:102E2000A9F0F92F96E9BB279395F69587957795A5 +:102E30006795B795F111F8CFFAF4BB0F11F460FF65 +:102E40001BC06F5F7F4F8F4F9F4F16C0882311F0BD +:102E500096E911C0772321F09EE8872F762F05C0D1 +:102E6000662371F096E8862F70E060E02AF09A956C +:102E7000660F771F881FDAF7880F9695879597F961 +:102E80000895990F0008550FAA0BE0E8FEEF1616FB +:102E90001706E807F907C0F012161306E407F5074E +:102EA00098F0621B730B840B950B39F40A2661F0C2 +:102EB000232B242B252B21F408950A2609F4A14065 +:102EC000A6958FEF811D811D089597F99F6780E872 +:102ED00070E060E008959FEF80EC089500240A946C +:102EE0001616170618060906089500240A941216E5 +:102EF0001306140605060895092E0394000C11F418 +:102F0000882352F0BB0F40F4BF2B11F460FF04C0C4 +:102F10006F5F7F4F8F4F9F4F089557FD9058440F1D +:102F2000551F59F05F3F71F04795880F97FB991F28 +:102F300061F09F3F79F087950895121613061406E5 +:102F4000551FF2CF4695F1DF08C016161706180672 +:102F5000991FF1CF86957105610508940895E8944D +:102F6000BB2766277727CB0197F908958ADF08F4F6 +:102F70008FEF08950BD0C0CFB1DF28F0B6DF18F087 +:102F8000952309F0A2CFA7CF1124EACFC6DFA0F383 +:102F9000959FD1F3950F50E0551F629FF001729FEE +:102FA000BB27F00DB11D639FAA27F00DB11DAA1F0D +:102FB000649F6627B00DA11D661F829F2227B00D5A +:102FC000A11D621F739FB00DA11D621F839FA00DE5 +:102FD000611D221F749F3327A00D611D231F849F35 +:102FE000600D211D822F762F6A2F11249F5750408C +:102FF0008AF0E1F088234AF0EE0FFF1FBB1F661F27 +:10300000771F881F91505040A9F79E3F510570F0DF +:103010005CCFA6CF5F3FECF3983EDCF386957795C7 +:103020006795B795F795E7959F5FC1F7FE2B880FDA +:10303000911D9695879597F9089597FB092E072678 +:103040000AD077FD04D049D006D000201AF470953C +:1030500061957F4F0895F6F7909581959F4F08955C +:10306000A1E21A2EAA1BBB1BFD010DC0AA1FBB1F8C +:10307000EE1FFF1FA217B307E407F50720F0A21BFE +:10308000B30BE40BF50B661F771F881F991F1A946B +:1030900069F760957095809590959B01AC01BD0195 +:1030A000CF01089597FB092E05260ED057FD04D0B9 +:1030B000D7DF0AD0001C38F4509540953095219503 +:1030C0003F4F4F4F5F4F0895F6F79095809570955D +:1030D00061957F4F8F4F9F4F0895AA1BBB1B51E1F6 +:1030E00007C0AA1FBB1FA617B70710F0A61BB70B78 +:1030F000881F991F5A95A9F780959095BC01CD011D +:103100000895EE0FFF1F0590F491E02D09949111A1 +:1031100006C0803219F089508550D0F7089599275C +:10312000882708952F923F924F925F926F927F92DD +:103130008F929F92AF92BF92CF92DF92EF92FF92C7 +:103140000F931F93CF93DF93CDB7DEB7CA1BDB0B73 +:103150000FB6F894DEBF0FBECDBF09942A88398818 +:1031600048885F846E847D848C849B84AA84B9841F +:10317000C884DF80EE80FD800C811B81AA81B9812B +:10318000CE0FD11D0FB6F894DEBF0FBECDBFED013F +:10319000089511E0C2E0D1E004C0FE010E9483184E +:0C31A0002296C430D107C9F7F894FFCF85 +:1031AC00007B22736F667477617265223A222573F5 +:1031BC00222C2022706F776572223A25622C2022F5 +:1031CC006C656E677468223A25692C2022776964D5 +:1031DC007468223A256900506C6F7474576172657B +:1031EC004669726D776172652076302E302E310013 +:1031FC00583A256620593A25660050524F4752419D +:10320C004D20454E44004F4B0020003B0028002928 +:10321C000047300047310047340047323800473907 +:10322C0030004739310054004D313132004D3131CD +:10323C0034004D313135004D31313800436F6D6DF7 +:10324C00616E64206E6F7420737570706F7274652C +:10325C00642E004D320050656E310050656E3200A8 +:10326C0050656E33000000200005030000FFFFFFD7 +:10327C00FFFFFFFFFFFFFFFFFFFFFFFFFF0000004F +:0E328C00000611AB119C10CD10AD10F6100015 +:00000001FF diff --git a/PlottWareFirmware/commandParsers.h b/PlottWareFirmware/commandParsers.h new file mode 100644 index 0000000..cd804cc --- /dev/null +++ b/PlottWareFirmware/commandParsers.h @@ -0,0 +1,86 @@ +#ifndef COMMANDPARSERS_H_INCLUDED +#define COMMANDPARSERS_H_INCLUDED + +#include +#include "selfreset.h" + +void cmdM118(String s){ + Serial.println(s); +} + +void cmdG0(double x, double y){ + goTo(x, y, SPEED_FAST); + cmdM118(String("OK")); +} + +void cmdG1(double x, double y){ + goTo(x, y, SPEED_NORMAL); + cmdM118("OK"); +} + +void cmdG4(double p){ + delay(p); + cmdM118("OK"); +} + +void cmdG28(){ + if(XHOME){ + while(digitalRead(XHOME)!=true){ + stepperX.step(-STEP_INCREMENT); + } + } + if(YHOME){ + while(digitalRead(YHOME)!=true){ + stepperY.step(-STEP_INCREMENT); + } + } + posX=0; + posY=0; + cmdM118("OK"); +} + +void cmdG90(){ + relative=false; + cmdM118("OK"); +} + +void cmdG91(){ + relative=true; + cmdM118("OK"); +} + +void cmdT(int t){ + if(tool){ + penUp(tool, true); + } + if(t<=PENCOUNT){ + penUp(t, false); + tool=t; + } + else{ + tool=0; + } + cmdM118("OK"); +} + +void cmdM2(){ + Serial.println("PROGRAM END"); +} + +void cmdM112(){ + selfReset(); +} + +void cmdM114(){ + char s[50]; + sprintf(s, "X:%f Y:%f", posXmm, posYmm); + Serial.println(s); +} + +void cmdM115(){ + char s[500]; + sprintf(s, "{\"software\":\"%s\", \"power\":%b, \"length\":%i, \"width\":%i", FIRMWARE, true, MAX_Y, MAX_X); + Serial.println(s); +} + +#endif // COMMANDPARSERS_H_INCLUDED diff --git a/PlottWareFirmware/config.h b/PlottWareFirmware/config.h new file mode 100644 index 0000000..be0f641 --- /dev/null +++ b/PlottWareFirmware/config.h @@ -0,0 +1,77 @@ +#ifndef CONFIG_H_INCLUDED +#define CONFIG_H_INCLUDED + +#include + +//firmware +#define FIRMWARE "PlottWareFirmware v0.0.1" + +//name of printer +#define NAME "PlottWare Alpha Prototype" + +//size of input buffer +#define MAX_MESSAGE_SIZE 1024 + +//step per mm +#define STEPX 50 +#define STEPY 50 + +//steps per revolution +#define STEPX_REVOLUTION 200 +#define STEPY_REVOLUTION 200 + +#define STEPPERX_PIN1 8 +#define STEPPERX_PIN2 9 +#define STEPPERX_PIN3 10 +#define STEPPERX_PIN4 11 + +#define STEPPERY_PIN1 2 +#define STEPPERY_PIN2 3 +#define STEPPERY_PIN3 4 +#define STEPPERY_PIN4 5 + +#define STEPPERX_REVERSE false +#define STEPPERY_REVERSE false + +//steps to increment once +#define STEP_INCREMENT 1 + +//delay in ms to wait for stepping +#define STEP_DELAY 0 + +//cruise speeds +#define SPEED_NORMAL 50 +#define SPEED_FAST 150 + +//in mm, if no limit, -1 +#define MAX_X 20 +#define MAX_Y -1 + +//pencount +#define PENCOUNT 3 + +//pens +String pens[PENCOUNT+1]; +void penSetup(){ + //pens[1]="Yellow"; + pens[1]="Pen1"; + pens[2]="Pen2"; + pens[3]="Pen3"; +} + +//pin of pens +int pen_pins[PENCOUNT+1]; +void penPinsSetup(){ + //pen_pins[1]=10; + pen_pins[1]=6; + pen_pins[2]=7; + pen_pins[3]=12; +} + +//homing +#define XHOME false +#define XHOME_PIN 10 +#define YHOME false +#define YHOME_PIN 0 + +#endif // CONFIG_H_INCLUDED diff --git a/PlottWareFirmware/gcodeutils.h b/PlottWareFirmware/gcodeutils.h new file mode 100644 index 0000000..7b13762 --- /dev/null +++ b/PlottWareFirmware/gcodeutils.h @@ -0,0 +1,53 @@ +#ifndef GCODEUTILS_H_INCLUDED +#define GCODEUTILS_H_INCLUDED + +#include "Utils.h" +#include "commandParsers.h" + +void parseGcode(String code){ + code=removeComments(code); + String cmd=getCommand(code); + char scmd=code[0]; + + if(cmd=="G0"){ + cmdG0(getParameter(code, 'X'), getParameter(code, 'Y')); + } + else if(cmd=="G1"){ + cmdG0(getParameter(code, 'X'), getParameter(code, 'Y')); + } + else if(cmd=="G4"){ + cmdG4(getParameter(code, 'P')); + } + else if(cmd=="G28"){ + cmdG28(); + } + else if(cmd=="G90"){ + cmdG90(); + } + else if(cmd=="G91"){ + cmdG91(); + } + else if(cmd=="T" || scmd=='T'){ + cmdT(getParameter(code, 'T')); + } + else if(cmd=="M2"){ + cmdM2(); + } + else if(cmd=="M112"){ + cmdM112(); + } + else if(cmd=="M114"){ + cmdM114(); + } + else if(cmd=="M115"){ + cmdM115(); + } + else if(cmd=="M118"){ + cmdM118(code.substring(code.indexOf("M118")+4)); + } + else{ + cmdM118("Command not supported."); + } +} + +#endif // GCODEUTILS_H_INCLUDED diff --git a/PlottWareFirmware/globals.h b/PlottWareFirmware/globals.h new file mode 100644 index 0000000..73728b3 --- /dev/null +++ b/PlottWareFirmware/globals.h @@ -0,0 +1,16 @@ +#ifndef GLOBALS_H_INCLUDED +#define GLOBALS_H_INCLUDED + +//in steps +unsigned long int posX=-1; +unsigned long int posY=-1; +unsigned long int posXmm=-1; +unsigned long int posYmm=-1; + +//currently selected tool +int tool=0; + +//positioning system +bool relative=false; + +#endif // GLOBALS_H_INCLUDED diff --git a/PlottWareFirmware/motors.h b/PlottWareFirmware/motors.h new file mode 100644 index 0000000..48632ba --- /dev/null +++ b/PlottWareFirmware/motors.h @@ -0,0 +1,17 @@ +#ifndef MOTORS_H_INCLUDED +#define MOTORS_H_INCLUDED + +#include + +Stepper stepperX(STEPX_REVOLUTION, STEPPERX_PIN1, STEPPERX_PIN2, STEPPERX_PIN3, STEPPERX_PIN4); +Stepper stepperY(STEPY_REVOLUTION, STEPPERY_PIN1, STEPPERY_PIN2, STEPPERY_PIN3, STEPPERY_PIN4); + +//pen motors +void motorSetup(){ + for(int i=1; i<=PENCOUNT; i++){ + pinMode(pen_pins[i], OUTPUT); + digitalWrite(pen_pins[i], HIGH); + } +} + +#endif // MOTORS_H_INCLUDED diff --git a/PlottWareFirmware/selfreset.h b/PlottWareFirmware/selfreset.h new file mode 100644 index 0000000..50c2e89 --- /dev/null +++ b/PlottWareFirmware/selfreset.h @@ -0,0 +1,7 @@ +#ifndef SELFRESET_H_INCLUDED +#define SELFRESET_H_INCLUDED + +//self reset +void(* selfReset) (void) = 0; + +#endif // SELFRESET_H_INCLUDED diff --git a/Presentation/IMG_0553.JPG b/Presentation/IMG_0553.JPG new file mode 100644 index 0000000..1af4208 Binary files /dev/null and b/Presentation/IMG_0553.JPG differ diff --git a/Presentation/IMG_0554.JPG b/Presentation/IMG_0554.JPG new file mode 100644 index 0000000..6270fa6 Binary files /dev/null and b/Presentation/IMG_0554.JPG differ diff --git a/Presentation/IMG_0555.JPG b/Presentation/IMG_0555.JPG new file mode 100644 index 0000000..fe8743b Binary files /dev/null and b/Presentation/IMG_0555.JPG differ diff --git a/Presentation/IMG_0556.JPG b/Presentation/IMG_0556.JPG new file mode 100644 index 0000000..c3c0a13 Binary files /dev/null and b/Presentation/IMG_0556.JPG differ diff --git a/Presentation/IMG_0557.JPG b/Presentation/IMG_0557.JPG new file mode 100644 index 0000000..0ec6768 Binary files /dev/null and b/Presentation/IMG_0557.JPG differ diff --git a/Presentation/IMG_0558.JPG b/Presentation/IMG_0558.JPG new file mode 100644 index 0000000..3a13dec Binary files /dev/null and b/Presentation/IMG_0558.JPG differ diff --git a/Presentation/IMG_0559.JPG b/Presentation/IMG_0559.JPG new file mode 100644 index 0000000..573c4b5 Binary files /dev/null and b/Presentation/IMG_0559.JPG differ diff --git a/Presentation/IMG_0560.JPG b/Presentation/IMG_0560.JPG new file mode 100644 index 0000000..626dab5 Binary files /dev/null and b/Presentation/IMG_0560.JPG differ diff --git a/Presentation/IMG_0561.JPG b/Presentation/IMG_0561.JPG new file mode 100644 index 0000000..c63be53 Binary files /dev/null and b/Presentation/IMG_0561.JPG differ diff --git a/Presentation/Presentation_hun.pptx b/Presentation/Presentation_hun.pptx new file mode 100644 index 0000000..6d354b2 Binary files /dev/null and b/Presentation/Presentation_hun.pptx differ diff --git a/Presentation/Presentation_hun_script.docx b/Presentation/Presentation_hun_script.docx new file mode 100644 index 0000000..0e65c41 Binary files /dev/null and b/Presentation/Presentation_hun_script.docx differ diff --git a/Presentation/forms.png b/Presentation/forms.png new file mode 100644 index 0000000..1f9566d Binary files /dev/null and b/Presentation/forms.png differ diff --git a/Presentation/test.gcode b/Presentation/test.gcode new file mode 100644 index 0000000..da9d1ac --- /dev/null +++ b/Presentation/test.gcode @@ -0,0 +1,762 @@ +;Generated by: PlottWareControl +;Project: C:\Users\setup\Documents\test.pwc +;Program created by: Fandly Gergo (fandlygergo@gmail.hu, systemtest.tk) + + + +G90 ;absolute positioning +M17 ;enable steppers +T1000 ;deselect all tools +G28 ;home axises +;printing contour #0 +T1 +G0 X49.100000 Y27.100000 +M300 S10 +G1 X49.000000 Y27.200000 +G1 X48.500000 Y27.200000 +G1 X48.400000 Y27.300000 +G1 X48.100000 Y27.300000 +G1 X48.000000 Y27.400000 +G1 X47.700000 Y27.400000 +G1 X47.600000 Y27.500000 +G1 X47.400000 Y27.500000 +G1 X47.300000 Y27.600000 +G1 X47.100000 Y27.600000 +G1 X47.000000 Y27.700000 +G1 X46.900000 Y27.700000 +G1 X46.800000 Y27.800000 +G1 X46.700000 Y27.800000 +G1 X46.600000 Y27.900000 +G1 X46.400000 Y27.900000 +G1 X46.300000 Y28.000000 +G1 X46.200000 Y28.000000 +G1 X46.000000 Y28.200000 +G1 X45.900000 Y28.200000 +G1 X45.700000 Y28.400000 +G1 X45.600000 Y28.400000 +G1 X45.300000 Y28.700000 +G1 X45.200000 Y28.700000 +G1 X44.200000 Y29.700000 +G1 X44.200000 Y29.800000 +G1 X43.900000 Y30.100000 +G1 X43.900000 Y30.200000 +G1 X43.700000 Y30.400000 +G1 X43.700000 Y30.500000 +G1 X43.600000 Y30.600000 +G1 X43.600000 Y30.700000 +G1 X43.500000 Y30.800000 +G1 X43.500000 Y30.900000 +G1 X43.400000 Y31.000000 +G1 X43.400000 Y31.100000 +G1 X43.300000 Y31.200000 +G1 X43.300000 Y31.300000 +G1 X43.200000 Y31.400000 +G1 X43.200000 Y31.500000 +G1 X43.100000 Y31.600000 +G1 X43.100000 Y31.800000 +G1 X43.000000 Y31.900000 +G1 X43.000000 Y32.100000 +G1 X42.900000 Y32.200000 +G1 X42.900000 Y32.500000 +G1 X42.800000 Y32.600000 +G1 X42.800000 Y32.900000 +G1 X42.700000 Y33.000000 +G1 X42.700000 Y33.600000 +G1 X42.600000 Y33.700000 +G1 X42.600000 Y34.700000 +G1 X42.700000 Y34.800000 +G1 X42.700000 Y35.300000 +G1 X42.800000 Y35.400000 +G1 X42.800000 Y35.700000 +G1 X42.900000 Y35.800000 +G1 X42.900000 Y36.100000 +G1 X43.000000 Y36.200000 +G1 X43.000000 Y36.400000 +G1 X43.100000 Y36.500000 +G1 X43.100000 Y36.700000 +G1 X43.200000 Y36.800000 +G1 X43.200000 Y36.900000 +G1 X43.300000 Y37.000000 +G1 X43.300000 Y37.100000 +G1 X43.400000 Y37.200000 +G1 X43.400000 Y37.400000 +G1 X43.500000 Y37.500000 +G1 X43.500000 Y37.600000 +G1 X43.700000 Y37.800000 +G1 X43.700000 Y37.900000 +G1 X43.700000 Y37.700000 +G1 X43.400000 Y37.400000 +G1 X43.400000 Y37.200000 +G1 X43.300000 Y37.100000 +G1 X43.300000 Y37.000000 +G1 X43.200000 Y36.900000 +G1 X43.200000 Y36.800000 +G1 X43.100000 Y36.700000 +G1 X43.100000 Y36.500000 +G1 X43.000000 Y36.400000 +G1 X43.000000 Y36.200000 +G1 X42.900000 Y36.100000 +G1 X42.900000 Y35.800000 +G1 X42.800000 Y35.700000 +G1 X42.800000 Y35.400000 +G1 X42.700000 Y35.300000 +G1 X42.700000 Y34.800000 +G1 X42.600000 Y34.700000 +G1 X42.600000 Y33.700000 +G1 X42.700000 Y33.600000 +G1 X42.700000 Y33.000000 +G1 X42.800000 Y32.900000 +G1 X42.800000 Y32.600000 +G1 X42.900000 Y32.500000 +G1 X42.900000 Y32.200000 +G1 X43.000000 Y32.100000 +G1 X43.000000 Y31.900000 +G1 X43.100000 Y31.800000 +G1 X43.100000 Y31.600000 +G1 X43.200000 Y31.500000 +G1 X43.200000 Y31.400000 +G1 X43.300000 Y31.300000 +G1 X43.300000 Y31.200000 +G1 X43.400000 Y31.100000 +G1 X43.400000 Y31.000000 +G1 X43.500000 Y30.900000 +G1 X43.500000 Y30.800000 +G1 X43.600000 Y30.700000 +G1 X43.600000 Y30.600000 +G1 X43.800000 Y30.400000 +G1 X43.800000 Y30.300000 +G1 X44.100000 Y30.000000 +G1 X44.100000 Y29.900000 +G1 X45.400000 Y28.600000 +G1 X45.500000 Y28.600000 +G1 X45.800000 Y28.300000 +G1 X45.900000 Y28.300000 +G1 X46.100000 Y28.100000 +G1 X46.200000 Y28.100000 +G1 X46.400000 Y27.900000 +G1 X46.600000 Y27.900000 +G1 X46.700000 Y27.800000 +G1 X46.800000 Y27.800000 +G1 X46.900000 Y27.700000 +G1 X47.000000 Y27.700000 +G1 X47.100000 Y27.600000 +G1 X47.300000 Y27.600000 +G1 X47.400000 Y27.500000 +G1 X47.600000 Y27.500000 +G1 X47.700000 Y27.400000 +G1 X48.000000 Y27.400000 +G1 X48.100000 Y27.300000 +G1 X48.400000 Y27.300000 +G1 X48.500000 Y27.200000 +G1 X49.000000 Y27.200000 +G1 X49.100000 Y27.100000 +G1 X50.200000 Y27.100000 +G1 X50.300000 Y27.200000 +G1 X50.800000 Y27.200000 +G1 X50.900000 Y27.300000 +G1 X51.200000 Y27.300000 +G1 X51.300000 Y27.400000 +G1 X51.600000 Y27.400000 +G1 X51.700000 Y27.500000 +G1 X51.900000 Y27.500000 +G1 X52.000000 Y27.600000 +G1 X52.200000 Y27.600000 +G1 X52.300000 Y27.700000 +G1 X52.400000 Y27.700000 +G1 X52.500000 Y27.800000 +G1 X52.600000 Y27.800000 +G1 X52.700000 Y27.900000 +G1 X52.900000 Y27.900000 +G1 X53.100000 Y28.100000 +G1 X53.200000 Y28.100000 +G1 X53.400000 Y28.300000 +G1 X53.500000 Y28.300000 +G1 X53.700000 Y28.500000 +G1 X53.800000 Y28.500000 +G1 X55.300000 Y30.000000 +G1 X55.300000 Y30.100000 +G1 X55.500000 Y30.300000 +G1 X55.500000 Y30.400000 +G1 X55.700000 Y30.600000 +G1 X55.700000 Y30.700000 +G1 X55.800000 Y30.800000 +G1 X55.800000 Y30.900000 +G1 X55.900000 Y31.000000 +G1 X55.900000 Y31.100000 +G1 X56.000000 Y31.200000 +G1 X56.000000 Y31.300000 +G1 X56.100000 Y31.400000 +G1 X56.100000 Y31.500000 +G1 X56.200000 Y31.600000 +G1 X56.200000 Y31.800000 +G1 X56.300000 Y31.900000 +G1 X56.300000 Y32.100000 +G1 X56.400000 Y32.200000 +G1 X56.400000 Y32.500000 +G1 X56.500000 Y32.600000 +G1 X56.500000 Y33.100000 +G1 X56.600000 Y33.200000 +G1 X56.600000 Y35.100000 +G1 X56.500000 Y35.200000 +G1 X56.500000 Y35.700000 +G1 X56.400000 Y35.800000 +G1 X56.400000 Y36.100000 +G1 X56.300000 Y36.200000 +G1 X56.300000 Y36.400000 +G1 X56.200000 Y36.500000 +G1 X56.200000 Y36.700000 +G1 X56.100000 Y36.800000 +G1 X56.100000 Y36.900000 +G1 X56.000000 Y37.000000 +G1 X56.000000 Y37.100000 +G1 X55.900000 Y37.200000 +G1 X55.900000 Y37.400000 +G1 X55.600000 Y37.700000 +G1 X55.600000 Y37.900000 +G1 X55.600000 Y37.800000 +G1 X55.800000 Y37.600000 +G1 X55.800000 Y37.500000 +G1 X55.900000 Y37.400000 +G1 X55.900000 Y37.200000 +G1 X56.000000 Y37.100000 +G1 X56.000000 Y37.000000 +G1 X56.100000 Y36.900000 +G1 X56.100000 Y36.800000 +G1 X56.200000 Y36.700000 +G1 X56.200000 Y36.500000 +G1 X56.300000 Y36.400000 +G1 X56.300000 Y36.200000 +G1 X56.400000 Y36.100000 +G1 X56.400000 Y35.800000 +G1 X56.500000 Y35.700000 +G1 X56.500000 Y35.200000 +G1 X56.600000 Y35.100000 +G1 X56.600000 Y33.200000 +G1 X56.500000 Y33.100000 +G1 X56.500000 Y32.600000 +G1 X56.400000 Y32.500000 +G1 X56.400000 Y32.200000 +G1 X56.300000 Y32.100000 +G1 X56.300000 Y31.900000 +G1 X56.200000 Y31.800000 +G1 X56.200000 Y31.600000 +G1 X56.100000 Y31.500000 +G1 X56.100000 Y31.400000 +G1 X56.000000 Y31.300000 +G1 X56.000000 Y31.200000 +G1 X55.900000 Y31.100000 +G1 X55.900000 Y31.000000 +G1 X55.800000 Y30.900000 +G1 X55.800000 Y30.700000 +G1 X55.600000 Y30.500000 +G1 X55.600000 Y30.400000 +G1 X55.400000 Y30.200000 +G1 X55.400000 Y30.100000 +G1 X55.200000 Y29.900000 +G1 X55.200000 Y29.800000 +G1 X54.000000 Y28.600000 +G1 X53.900000 Y28.600000 +G1 X53.700000 Y28.400000 +G1 X53.600000 Y28.400000 +G1 X53.400000 Y28.200000 +G1 X53.300000 Y28.200000 +G1 X53.100000 Y28.000000 +G1 X53.000000 Y28.000000 +G1 X52.900000 Y27.900000 +G1 X52.700000 Y27.900000 +G1 X52.600000 Y27.800000 +G1 X52.500000 Y27.800000 +G1 X52.400000 Y27.700000 +G1 X52.300000 Y27.700000 +G1 X52.200000 Y27.600000 +G1 X52.000000 Y27.600000 +G1 X51.900000 Y27.500000 +G1 X51.700000 Y27.500000 +G1 X51.600000 Y27.400000 +G1 X51.300000 Y27.400000 +G1 X51.200000 Y27.300000 +G1 X50.900000 Y27.300000 +G1 X50.800000 Y27.200000 +G1 X50.300000 Y27.200000 +G1 X50.200000 Y27.100000 +M300 S50 +;printing contour #1 +T1 +G0 X3.600000 Y9.400000 +M300 S10 +G1 X22.400000 Y9.400000 +G1 X22.600000 Y9.600000 +G1 X22.600000 Y30.100000 +G1 X22.500000 Y30.200000 +G1 X3.500000 Y30.200000 +G1 X3.300000 Y30.000000 +G1 X3.300000 Y9.700000 +M300 S50 +;printing contour #2 +T1 +G0 X3.600000 Y9.400000 +M300 S10 +G1 X3.500000 Y9.500000 +G1 X3.400000 Y9.500000 +G1 X3.400000 Y9.600000 +G1 X3.300000 Y9.700000 +G1 X3.300000 Y30.000000 +G1 X3.400000 Y30.100000 +G1 X3.400000 Y30.200000 +G1 X22.600000 Y30.200000 +G1 X22.600000 Y9.500000 +G1 X22.500000 Y9.500000 +G1 X22.400000 Y9.400000 +M300 S50 +;printing contour #3 +T1 +G0 X49.100000 Y2.400000 +M300 S10 +G1 X49.300000 Y2.400000 +G1 X49.600000 Y2.700000 +G1 X49.600000 Y2.800000 +G1 X49.800000 Y3.000000 +G1 X49.800000 Y3.100000 +G1 X50.100000 Y3.400000 +G1 X50.100000 Y3.500000 +G1 X50.300000 Y3.700000 +G1 X50.300000 Y3.800000 +G1 X50.500000 Y4.000000 +G1 X50.500000 Y4.100000 +G1 X50.800000 Y4.400000 +G1 X50.800000 Y4.500000 +G1 X51.000000 Y4.700000 +G1 X51.000000 Y4.800000 +G1 X51.200000 Y5.000000 +G1 X51.200000 Y5.100000 +G1 X51.500000 Y5.400000 +G1 X51.500000 Y5.500000 +G1 X51.700000 Y5.700000 +G1 X51.700000 Y5.800000 +G1 X52.000000 Y6.100000 +G1 X52.000000 Y6.200000 +G1 X52.200000 Y6.400000 +G1 X52.200000 Y6.500000 +G1 X52.400000 Y6.700000 +G1 X52.400000 Y6.800000 +G1 X52.700000 Y7.100000 +G1 X52.700000 Y7.200000 +G1 X52.900000 Y7.400000 +G1 X52.900000 Y7.500000 +G1 X53.100000 Y7.700000 +G1 X53.100000 Y7.800000 +G1 X53.400000 Y8.100000 +G1 X53.400000 Y8.200000 +G1 X53.600000 Y8.400000 +G1 X53.600000 Y8.500000 +G1 X53.900000 Y8.800000 +G1 X53.900000 Y8.900000 +G1 X54.100000 Y9.100000 +G1 X54.100000 Y9.200000 +G1 X54.300000 Y9.400000 +G1 X54.300000 Y9.500000 +G1 X54.600000 Y9.800000 +G1 X54.600000 Y9.900000 +G1 X54.800000 Y10.100000 +G1 X54.800000 Y10.200000 +G1 X55.000000 Y10.400000 +G1 X55.000000 Y10.500000 +G1 X55.300000 Y10.800000 +G1 X55.300000 Y10.900000 +G1 X55.500000 Y11.100000 +G1 X55.500000 Y11.200000 +G1 X55.800000 Y11.500000 +G1 X55.800000 Y11.600000 +G1 X56.000000 Y11.800000 +G1 X56.000000 Y11.900000 +G1 X56.200000 Y12.100000 +G1 X56.200000 Y12.200000 +G1 X56.500000 Y12.500000 +G1 X56.500000 Y12.600000 +G1 X56.700000 Y12.800000 +G1 X56.700000 Y12.900000 +G1 X56.900000 Y13.100000 +G1 X56.900000 Y13.200000 +G1 X57.200000 Y13.500000 +G1 X57.200000 Y13.600000 +G1 X57.400000 Y13.800000 +G1 X57.400000 Y13.900000 +G1 X57.700000 Y14.200000 +G1 X57.700000 Y14.300000 +G1 X57.900000 Y14.500000 +G1 X57.900000 Y14.600000 +G1 X58.100000 Y14.800000 +G1 X58.100000 Y14.900000 +G1 X58.400000 Y15.200000 +G1 X58.400000 Y15.300000 +G1 X58.600000 Y15.500000 +G1 X58.600000 Y15.600000 +G1 X58.800000 Y15.800000 +G1 X58.800000 Y15.900000 +G1 X59.100000 Y16.200000 +G1 X59.100000 Y16.300000 +G1 X59.300000 Y16.500000 +G1 X59.300000 Y16.600000 +G1 X59.600000 Y16.900000 +G1 X59.600000 Y17.000000 +G1 X59.800000 Y17.200000 +G1 X59.800000 Y17.300000 +G1 X60.000000 Y17.500000 +G1 X60.000000 Y17.600000 +G1 X60.300000 Y17.900000 +G1 X60.300000 Y18.000000 +G1 X60.500000 Y18.200000 +G1 X60.500000 Y18.300000 +G1 X60.700000 Y18.500000 +G1 X60.700000 Y18.600000 +G1 X61.000000 Y18.900000 +G1 X61.000000 Y19.000000 +G1 X61.200000 Y19.200000 +G1 X61.200000 Y19.300000 +G1 X61.500000 Y19.600000 +G1 X61.500000 Y19.700000 +G1 X61.700000 Y19.900000 +G1 X61.700000 Y20.000000 +G1 X61.900000 Y20.200000 +G1 X61.900000 Y20.300000 +G1 X62.000000 Y20.400000 +G1 X62.000000 Y20.600000 +G1 X61.900000 Y20.700000 +G1 X36.400000 Y20.700000 +G1 X36.300000 Y20.600000 +G1 X36.300000 Y20.400000 +G1 X36.400000 Y20.300000 +G1 X36.400000 Y20.200000 +G1 X36.600000 Y20.000000 +G1 X36.600000 Y19.900000 +G1 X36.900000 Y19.600000 +G1 X36.900000 Y19.500000 +G1 X37.100000 Y19.300000 +G1 X37.100000 Y19.200000 +G1 X37.400000 Y18.900000 +G1 X37.400000 Y18.800000 +G1 X37.600000 Y18.600000 +G1 X37.600000 Y18.500000 +G1 X37.900000 Y18.200000 +G1 X37.900000 Y18.100000 +G1 X38.100000 Y17.900000 +G1 X38.100000 Y17.800000 +G1 X38.300000 Y17.600000 +G1 X38.300000 Y17.500000 +G1 X38.600000 Y17.200000 +G1 X38.600000 Y17.100000 +G1 X38.800000 Y16.900000 +G1 X38.800000 Y16.800000 +G1 X39.100000 Y16.500000 +G1 X39.100000 Y16.400000 +G1 X39.300000 Y16.200000 +G1 X39.300000 Y16.100000 +G1 X39.600000 Y15.800000 +G1 X39.600000 Y15.700000 +G1 X39.800000 Y15.500000 +G1 X39.800000 Y15.400000 +G1 X40.100000 Y15.100000 +G1 X40.100000 Y15.000000 +G1 X40.300000 Y14.800000 +G1 X40.300000 Y14.700000 +G1 X40.500000 Y14.500000 +G1 X40.500000 Y14.400000 +G1 X40.800000 Y14.100000 +G1 X40.800000 Y14.000000 +G1 X41.000000 Y13.800000 +G1 X41.000000 Y13.700000 +G1 X41.300000 Y13.400000 +G1 X41.300000 Y13.300000 +G1 X41.500000 Y13.100000 +G1 X41.500000 Y13.000000 +G1 X41.800000 Y12.700000 +G1 X41.800000 Y12.600000 +G1 X42.000000 Y12.400000 +G1 X42.000000 Y12.300000 +G1 X42.200000 Y12.100000 +G1 X42.200000 Y12.000000 +G1 X42.500000 Y11.700000 +G1 X42.500000 Y11.600000 +G1 X42.700000 Y11.400000 +G1 X42.700000 Y11.300000 +G1 X43.000000 Y11.000000 +G1 X43.000000 Y10.900000 +G1 X43.200000 Y10.700000 +G1 X43.200000 Y10.600000 +G1 X43.500000 Y10.300000 +G1 X43.500000 Y10.200000 +G1 X43.700000 Y10.000000 +G1 X43.700000 Y9.900000 +G1 X44.000000 Y9.600000 +G1 X44.000000 Y9.500000 +G1 X44.200000 Y9.300000 +G1 X44.200000 Y9.200000 +G1 X44.400000 Y9.000000 +G1 X44.400000 Y8.900000 +G1 X44.700000 Y8.600000 +G1 X44.700000 Y8.500000 +G1 X44.900000 Y8.300000 +G1 X44.900000 Y8.200000 +G1 X45.200000 Y7.900000 +G1 X45.200000 Y7.800000 +G1 X45.400000 Y7.600000 +G1 X45.400000 Y7.500000 +G1 X45.700000 Y7.200000 +G1 X45.700000 Y7.100000 +G1 X45.900000 Y6.900000 +G1 X45.900000 Y6.800000 +G1 X46.200000 Y6.500000 +G1 X46.200000 Y6.400000 +G1 X46.400000 Y6.200000 +G1 X46.400000 Y6.100000 +G1 X46.600000 Y5.900000 +G1 X46.600000 Y5.800000 +G1 X46.900000 Y5.500000 +G1 X46.900000 Y5.400000 +G1 X47.100000 Y5.200000 +G1 X47.100000 Y5.100000 +G1 X47.400000 Y4.800000 +G1 X47.400000 Y4.700000 +G1 X47.600000 Y4.500000 +G1 X47.600000 Y4.400000 +G1 X47.900000 Y4.100000 +G1 X47.900000 Y4.000000 +G1 X48.100000 Y3.800000 +G1 X48.100000 Y3.700000 +G1 X48.400000 Y3.400000 +G1 X48.400000 Y3.300000 +G1 X48.600000 Y3.100000 +G1 X48.600000 Y3.000000 +G1 X48.800000 Y2.800000 +G1 X48.800000 Y2.700000 +M300 S50 +;printing contour #4 +T1 +G0 X49.000000 Y2.400000 +M300 S10 +G1 X48.900000 Y2.500000 +G1 X48.900000 Y2.600000 +G1 X48.700000 Y2.800000 +G1 X48.700000 Y2.900000 +G1 X48.500000 Y3.100000 +G1 X48.500000 Y3.200000 +G1 X48.200000 Y3.500000 +G1 X48.200000 Y3.600000 +G1 X48.000000 Y3.800000 +G1 X48.000000 Y3.900000 +G1 X47.700000 Y4.200000 +G1 X47.700000 Y4.300000 +G1 X47.500000 Y4.500000 +G1 X47.500000 Y4.600000 +G1 X47.200000 Y4.900000 +G1 X47.200000 Y5.000000 +G1 X47.000000 Y5.200000 +G1 X47.000000 Y5.300000 +G1 X46.700000 Y5.600000 +G1 X46.700000 Y5.700000 +G1 X46.500000 Y5.900000 +G1 X46.500000 Y6.000000 +G1 X46.300000 Y6.200000 +G1 X46.300000 Y6.300000 +G1 X46.000000 Y6.600000 +G1 X46.000000 Y6.700000 +G1 X45.800000 Y6.900000 +G1 X45.800000 Y7.000000 +G1 X45.500000 Y7.300000 +G1 X45.500000 Y7.400000 +G1 X45.300000 Y7.600000 +G1 X45.300000 Y7.700000 +G1 X45.000000 Y8.000000 +G1 X45.000000 Y8.100000 +G1 X44.800000 Y8.300000 +G1 X44.800000 Y8.400000 +G1 X44.500000 Y8.700000 +G1 X44.500000 Y8.800000 +G1 X44.300000 Y9.000000 +G1 X44.300000 Y9.100000 +G1 X44.100000 Y9.300000 +G1 X44.100000 Y9.400000 +G1 X43.800000 Y9.700000 +G1 X43.800000 Y9.800000 +G1 X43.600000 Y10.000000 +G1 X43.600000 Y10.100000 +G1 X43.300000 Y10.400000 +G1 X43.300000 Y10.500000 +G1 X43.100000 Y10.700000 +G1 X43.100000 Y10.800000 +G1 X42.800000 Y11.100000 +G1 X42.800000 Y11.200000 +G1 X42.600000 Y11.400000 +G1 X42.600000 Y11.500000 +G1 X42.300000 Y11.800000 +G1 X42.300000 Y11.900000 +G1 X42.100000 Y12.100000 +G1 X42.100000 Y12.200000 +G1 X41.900000 Y12.400000 +G1 X41.900000 Y12.500000 +G1 X41.600000 Y12.800000 +G1 X41.600000 Y12.900000 +G1 X41.400000 Y13.100000 +G1 X41.400000 Y13.200000 +G1 X41.100000 Y13.500000 +G1 X41.100000 Y13.600000 +G1 X40.900000 Y13.800000 +G1 X40.900000 Y13.900000 +G1 X40.600000 Y14.200000 +G1 X40.600000 Y14.300000 +G1 X40.400000 Y14.500000 +G1 X40.400000 Y14.600000 +G1 X40.200000 Y14.800000 +G1 X40.200000 Y14.900000 +G1 X39.900000 Y15.200000 +G1 X39.900000 Y15.300000 +G1 X39.700000 Y15.500000 +G1 X39.700000 Y15.600000 +G1 X39.400000 Y15.900000 +G1 X39.400000 Y16.000000 +G1 X39.200000 Y16.200000 +G1 X39.200000 Y16.300000 +G1 X38.900000 Y16.600000 +G1 X38.900000 Y16.700000 +G1 X38.700000 Y16.900000 +G1 X38.700000 Y17.000000 +G1 X38.400000 Y17.300000 +G1 X38.400000 Y17.400000 +G1 X38.200000 Y17.600000 +G1 X38.200000 Y17.700000 +G1 X38.000000 Y17.900000 +G1 X38.000000 Y18.000000 +G1 X37.700000 Y18.300000 +G1 X37.700000 Y18.400000 +G1 X37.500000 Y18.600000 +G1 X37.500000 Y18.700000 +G1 X37.200000 Y19.000000 +G1 X37.200000 Y19.100000 +G1 X37.000000 Y19.300000 +G1 X37.000000 Y19.400000 +G1 X36.700000 Y19.700000 +G1 X36.700000 Y19.800000 +G1 X36.500000 Y20.000000 +G1 X36.500000 Y20.100000 +G1 X36.300000 Y20.300000 +G1 X36.300000 Y20.700000 +G1 X62.000000 Y20.700000 +G1 X62.000000 Y20.300000 +G1 X61.800000 Y20.100000 +G1 X61.800000 Y20.000000 +G1 X61.600000 Y19.800000 +G1 X61.600000 Y19.700000 +G1 X61.400000 Y19.500000 +G1 X61.400000 Y19.400000 +G1 X61.100000 Y19.100000 +G1 X61.100000 Y19.000000 +G1 X60.900000 Y18.800000 +G1 X60.900000 Y18.700000 +G1 X60.600000 Y18.400000 +G1 X60.600000 Y18.300000 +G1 X60.400000 Y18.100000 +G1 X60.400000 Y18.000000 +G1 X60.200000 Y17.800000 +G1 X60.200000 Y17.700000 +G1 X59.900000 Y17.400000 +G1 X59.900000 Y17.300000 +G1 X59.700000 Y17.100000 +G1 X59.700000 Y17.000000 +G1 X59.500000 Y16.800000 +G1 X59.500000 Y16.700000 +G1 X59.200000 Y16.400000 +G1 X59.200000 Y16.300000 +G1 X59.000000 Y16.100000 +G1 X59.000000 Y16.000000 +G1 X58.700000 Y15.700000 +G1 X58.700000 Y15.600000 +G1 X58.500000 Y15.400000 +G1 X58.500000 Y15.300000 +G1 X58.300000 Y15.100000 +G1 X58.300000 Y15.000000 +G1 X58.000000 Y14.700000 +G1 X58.000000 Y14.600000 +G1 X57.800000 Y14.400000 +G1 X57.800000 Y14.300000 +G1 X57.600000 Y14.100000 +G1 X57.600000 Y14.000000 +G1 X57.300000 Y13.700000 +G1 X57.300000 Y13.600000 +G1 X57.100000 Y13.400000 +G1 X57.100000 Y13.300000 +G1 X56.800000 Y13.000000 +G1 X56.800000 Y12.900000 +G1 X56.600000 Y12.700000 +G1 X56.600000 Y12.600000 +G1 X56.400000 Y12.400000 +G1 X56.400000 Y12.300000 +G1 X56.100000 Y12.000000 +G1 X56.100000 Y11.900000 +G1 X55.900000 Y11.700000 +G1 X55.900000 Y11.600000 +G1 X55.700000 Y11.400000 +G1 X55.700000 Y11.300000 +G1 X55.400000 Y11.000000 +G1 X55.400000 Y10.900000 +G1 X55.200000 Y10.700000 +G1 X55.200000 Y10.600000 +G1 X54.900000 Y10.300000 +G1 X54.900000 Y10.200000 +G1 X54.700000 Y10.000000 +G1 X54.700000 Y9.900000 +G1 X54.500000 Y9.700000 +G1 X54.500000 Y9.600000 +G1 X54.200000 Y9.300000 +G1 X54.200000 Y9.200000 +G1 X54.000000 Y9.000000 +G1 X54.000000 Y8.900000 +G1 X53.800000 Y8.700000 +G1 X53.800000 Y8.600000 +G1 X53.500000 Y8.300000 +G1 X53.500000 Y8.200000 +G1 X53.300000 Y8.000000 +G1 X53.300000 Y7.900000 +G1 X53.000000 Y7.600000 +G1 X53.000000 Y7.500000 +G1 X52.800000 Y7.300000 +G1 X52.800000 Y7.200000 +G1 X52.600000 Y7.000000 +G1 X52.600000 Y6.900000 +G1 X52.300000 Y6.600000 +G1 X52.300000 Y6.500000 +G1 X52.100000 Y6.300000 +G1 X52.100000 Y6.200000 +G1 X51.900000 Y6.000000 +G1 X51.900000 Y5.900000 +G1 X51.600000 Y5.600000 +G1 X51.600000 Y5.500000 +G1 X51.400000 Y5.300000 +G1 X51.400000 Y5.200000 +G1 X51.100000 Y4.900000 +G1 X51.100000 Y4.800000 +G1 X50.900000 Y4.600000 +G1 X50.900000 Y4.500000 +G1 X50.700000 Y4.300000 +G1 X50.700000 Y4.200000 +G1 X50.400000 Y3.900000 +G1 X50.400000 Y3.800000 +G1 X50.200000 Y3.600000 +G1 X50.200000 Y3.500000 +G1 X50.000000 Y3.300000 +G1 X50.000000 Y3.200000 +G1 X49.700000 Y2.900000 +G1 X49.700000 Y2.800000 +G1 X49.500000 Y2.600000 +G1 X49.500000 Y2.500000 +G1 X49.400000 Y2.400000 +M300 S50 +T1000 ;deselect tool +M18 ;disable steppers +M2 ;program end + + + +;Line count: 762 +;Max X: 62.000000 +;Max Y: 37.900000 +;ENJOY! \ No newline at end of file