How I do find properties name list of a object - c++

JSAPI provide function JS_GetProperty to get specified property name's value
but how to get them as name list / all properties name ?
found similar issue on link below
https://groups.google.com/forum/?fromgroups#!topic/mozilla.dev.tech.js-engine/usHtJn4LR7A
Thank you very much ,sir

There are two ways to approach this. The older JS_Enumerate function or the combination of JS_NewPropertyIterator and JS_NextProperty. I would recommend the latter, because you don't have to mess around with the jsid array yourself.

Related

How to get a list of placeholders / variables in a word template

using phpword, I would like to get a list of all the placeholders ${var_name} that is in a template
I have searched here and in the documentation but I have not been able to find a function that can give a list of placeholders / variables
I'm assuming you're referring to the PHPWord TemplateProcessor.It actually does provide a method that returns an array of all the variables in the template, which is $phpWord->getVariables() as refer to the source code. I found it when digging into the source code. The official documentation is long out of date.
Hope it helps!

Create a custom property map

I'm trying to use the write_graphml function from the Boost Graph Library. The relevant things to know are that this function takes in a dynamic property map composed of property maps for each vertex and edge property, and assumes that all properties on the vertices and edges can be resolved to character types for writing to the file. This makes sense and works for most of my properties. However, I have 1 edge property that is an enum, and so it refuses to compile.
I think what I need is to create a custom PropertyMap that basically acts as a wrapper around the one for that edge property, intercepts the accesses, and returns a character representation in place of the enum values.
Is this the right way to solve this, and if so where can I look for how to define my own custom PropertyMap? I've been digging through the docs and code and so far I'm lost.
Got some help from someone else looking closer at the error messages, and it turns out defining << for std::ostream and >> for std::istream for my custom type enabled boost to write everything properly.

How to define a primitive device in Proteus?

I'm trying to make my own full adder and some other devices as a sub-circuit in "Proteus" and use them several times in a bigger circuit.
The problem is when you copy a sub-circuit you need to rename all of its inner parts, otherwise, the parts with a same name in two sub-circuits would be considered as one, therefore you'd get some errors.
So I'd like to know if there is a way to define a full adder of my own and use it like "74LS183" which is a primitive device, and by primitive I mean it has been defined in the library.
From answer posted here
It's in the Proteus Help file:
SCHEMATIC CAPTURE HELP (F1) -> MULTI-SHEET DESIGNS -> Hierarchical Designs
See the section "Module Components":
Any ordinary component can be made into a module by setting the Attach Hierarchy Module checkbox on the Edit Component dialogue form.
The component's value is taken to be the name for the associated circuit,
and the component's reference serves as the instance name.
after this you can use your new implementation of that component with your new name. for making it available at library see "External Modules" section of proteus help.
The problem with copying is solved in "Proteus 8".not completely but sort of.
I mean you can copy a subcircuit without a need to change it's inner parts, but you must change the subcircuit name and I mean the bigger name above the subcircuit not the little one below it.
so there is no need to define a primitive.

goocanvas how to switch of antialiasing

Can give me someone an idea how I can switch of the antialiasing for all items in a goocanvasmm?
I tried to get the root item model but this did not contain the antialiasing property.
I could not really find any valid documentation for goocanvasmm. I really need a tutorial but I can't find some.
[edit]
Sorry, I need the code for goocanvasmm!!! not goocanvas. So please do not edit this again. Yes, it is the c++ version of gtk+ called gtkmm and the goocanvasmm
[edit]
I have now a rect in the canvas and I could get the rect->property_antialias()=???? but now i struggled with PropertyProxy.
the following both lines will not work:
1)
rect->property_antialias()=CAIRO_ANTIALIAS_NONE ;
no match for »operator=« (operand types are »Glib::PropertyProxy« and »_cairo_antialias«)
2)
rect->property_antialias()=ANTIALIAS_NONE ;
error: 'ANTIALIAS_NONE' was not declared in this scope
Thanks!
GooCanvaItemSimple is the base class for most items. It has an antialias property which is of a type that maps to cairo_antialias_t.
This is for the C version, not C++, but it should be easy to map to the 'mm' versions of the docs. Here's the equivalent for antialias in goocanvasmm.
When you don't know where a property is, just dig in the parent classes or interfaces implemented until you find it.
Then, set the value of the appropriate Cairo::Antialias type (which is a type defined in cairomm).
rect->property_antialias() = Cairo::ANTIALIAS_NONE;

Softimage access parameters in C++

I'm a bit desperate here... I'm trying to access one parameter of a light in Softimage.
First, when we do this:
light.GetParameterValue(L"LightExponent")
it works!
But when we try:
light.GetParameterValue(L"soft_light.atten")
it fails completely!
I tried to find documentation, but the only code that I could find is in Python and no indication for the equivalent in C++. In python, they manage to do something like:
xsi = Application
test = xsi.GetValue("LightName.point.soft_light.atten")
But I cannot figure out what is Application, and it's not the same as XSI::Application in the API.
So, any idea how to access this value ? Also, if I could found the equivalent to Application.GetValue (in the script, you can see Application.SetValue... so I imagine that GetValue exists in some form!) in C++, that would be nice... I could simply use the name of the light and then add the information that I need to access that value like:
SomeUnknownClassForNow::GetValue(light.GetName() + ".point.soft_light.atten");
Any idea ?
With the help of a client of ours, I finally managed to find a proper solution to this.
First, there's some direct parameters, like "LightExponent". But there's other parameters associated with an object, like a light, in other categories called Shaders.
With a light, or a least a point light, there's only one Shader, called "soft_light". It's possible to access it by:
light.GetShaders()[0]
It's possible to verify its name to with GetName(). Which, in this case, would be "LightName.point.soft_light".
Finally, to access the "soft_light.atten" parameter:
light.GetShaders()[0].GetParameterValue("atten")
So, in Softimage, there's sort of Hierarchy in objects and all these a separated as shaders. For more complex object, just find the right shader and extract its parameter.