Questions tagged [construct]

Construct is a powerful declarative parser for binary data.

It is based on the concept of defining data structures in a declarative manner, rather than procedural code: Simple constructs can be combined hierarchically to form increasingly complex data structures. It's the first library that makes parsing fun, instead of the usual headache it is today. Official documentation: https://construct.readthedocs.io

239 questions
0
votes
1 answer

PHP OOP constructing class property form method in same class

For some reason I can't get this to work: number_added = $this->add_two(); } public function add_two(){ return…
Jursels
  • 173
  • 1
  • 3
  • 12
0
votes
0 answers

DomPDF - Cached_PDF_Decorator declaration error

Fatal error: Declaration of Cached_PDF_Decorator::_construct() must be compatible with that of Canvas::_construct() in /my/path/to/cached_pdf_decorator.cls.php on line 22 relevant code in Cached_PDF_Decorator: class Cached_PDF_Decorator extends…
DefZep
  • 153
  • 2
  • 11
0
votes
0 answers

Parsing continuous bit stream in python using Construct module

I'm trying to parse a binary data packet in python with Construct module and have successfully parsed the header part (like data length) but according to packet spec part of the data inside the packet is encoded using continuous bit stream and last…
Tamm
  • 262
  • 6
  • 15
-1
votes
2 answers

Creating Objects in iteration - The better approach

As I was developing something, I wondered what might be the better/faster approach to create a bunch of objects while iterating over something. Lets say we have this wrapper-class: public class Photo{ private String url; private String…
Lukas Knuth
  • 25,449
  • 15
  • 83
  • 111
-1
votes
2 answers

How to initialize char[] in a struct with constexpr char[] using initializer list?

I have a struct like: constexpr char defaultName[6] = "Hello"; struct MyStruct{ char name[6]; int val; }; Now I want to initialize the struct using initializer list as following: MyStruct structObj{defaultName, 0}; However, this doesn't…
Dev G
  • 5
  • 5
-1
votes
1 answer

what is this syntax mean is c++ "class_name: class_ptr_1(nullptr), class_ptr_2(nullptr) {}"

I am not able to understand the syntax of class_name: class_ptr_1(nullptr), class_ptr_2(nullptr) {}
-1
votes
1 answer

How do I prevent HTML5 game from suspending?

I am making an HTML5 game with Construct 2 and face one little problem: once I switch tab I get my game paused(suspended) I have cleared the default engine suspension by calling "cr_setSuspended = function() {}" and now I don't receive messages…
Modemi4
  • 47
  • 9
-1
votes
1 answer

Getting Address of Constructed Item/Member in C++

I'm writing part of a customer database that handles making new customers and selling them items. In "Customer.h", I have the struct: struct Customer { String name; int bottles; Customer(String); Customer(void) { name =…
WesLee
  • 1
  • 1
-1
votes
1 answer

Call to a Construct

I have a class.php with a construct name = $name; $this->color = $color; } function get_name() { return $this->name; } function…
Francisco
  • 11
  • 3
-1
votes
2 answers

C++ Constructors and Classes?

I'm new to C++ and I'm trying to learn how to use constructors and classes. I have the code running correctly in C through structs, but when I try to implement classes in C++ I get errors I don't know where from. The code is meant for me to input a…
-1
votes
1 answer

Symmfony & Sonata : How to access EntityManagerInterface from AbstractAdmin extends?

I have a class extending AbstractAdmin. I try to inject the EntityManagerInterface with : namespace App\Admin; use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Datagrid\ListMapper; use…
Alexglvr
  • 427
  • 5
  • 18
-1
votes
2 answers

Deduction guide for the template class std::valarray

In the C++ Standard there is the following deduction guide for the template class std::valarray: template valarray(const T(&)[cnt], size_t) -> valarray; However among the constructors of the class there is only the…
Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335
-1
votes
1 answer

how to parse a bin file by construct?

the file format is: from construct import * file_format=Struct( 'n_links'/ Int32ul, # number of links 'links'/ Array(this.n_links, Int32ul), # links 'n_Items' / ??? # how to do here ? ) 02000000 0C000000 …
王王王
  • 127
  • 1
  • 10
-1
votes
1 answer

public function __construct() in php7 -- Way beyond my grasp

I'm absolutely lost here.. i've read through previous questions and answers but all i do is break the code even more. This obviously no longer works in php7, so i'm trying (and failing) to get this to work. It's probably a slap-head for most of the…
astro
  • 1
-1
votes
1 answer

How to avoid an endless construct loop?

I have two classes that depend on each other. class ClassA extends SomeClass { public function __construct(ClassB $classB) { $this->classB = $classB; } } class ClassB extends SomeOtherClass { public function __construct(ClassA…
americanknight
  • 689
  • 3
  • 18
  • 37
1 2 3
15
16