method-signature

Regex question about parsing method signature

£可爱£侵袭症+ 提交于 2019-11-29 12:06:04
I'm trying to parse a method signature that is in this format: 'function_name(foo=<str>, bar=<array>)' From this, I want the name of the method, and each argument and it's type. Obviously I don't want the < , > characters, etc. The number of parameters will be variable. My question is: How is it possible to get all the parameters when using this regex? I'm using Python, but I'm just looking for a general idea. Do I need named groups and, if so, how can I use them to capture multiple parameters, each with it's type, all in one regex? marcog You can't match a variable number of groups with

Call function in c++ dll without header

白昼怎懂夜的黑 提交于 2019-11-29 03:39:37
I would like to call a method from an dll, but i don't have the source neither the header file. I tried to use the dumpbin /exports to see the name of the method, but i can found the methods signature? Is there any way to call this method? Thanks, It is possible to figure out a C function signature by analysing beginnig of its disassembly. The function arguments will be on the stack and the function will do some "pops" to read them in reverse order. You will not find the argument names, but you should be able to find out their number and the types. Things may get more difficult with return

Is it possible to pass a method as an argument in Objective-C?

北城余情 提交于 2019-11-28 22:33:36
问题 I have a method that varies by a single method call inside, and I'd like to pass the method/signature of the method that it varies by as an argument... is this possible in Objective C or is that too much to hope for? 回答1: NSInvocation is a class for wrapping up a method calls in an object. You can set a selector (method signature), set arguments by index. You can then set a target and call invoke to trigger the call, or leave the target unset and use invokeWithTarget: in a loop of some sort

Why are jQuery's callback arguments inconsistent?

时光怂恿深爱的人放手 提交于 2019-11-28 20:22:39
A common pattern within jQuery is a method that takes a callback which is passed an element of an array and its index within that array. However, it seems completely random which argument comes first. For example, from the jQuery docs at http://api.jquery.com : jQuery.each( collection, callback(indexInArray, valueOfElement) ) .each( function(index, Element) ) jQuery.map( array, callback(elementOfArray, indexInArray) ) .map( callback(index, domElement) ) jQuery.grep( array, function(elementOfArray, indexInArray), [ invert ] ) .filter( function(index) ) In three cases ( jQuery.each , .each ,

C++ typedef member function signature syntax

梦想的初衷 提交于 2019-11-28 19:06:02
问题 I want to declare type definition for a member function signature. Global function typedefs look like this: typedef int (function_signature)(int, int); typedef int (*function_pointer) (int, int); But I'm not able to the same thing for a member function: typedef int (foo::memberf_signature)(int, int); // memberf_pointer is not a member of foo typedef int (foo::*memberf_pointer)(int, int); It sounds logically to me, because "foo::" ist the syntax to access a member in the class foo. How can I

Static member functions error; How to properly write the signature?

﹥>﹥吖頭↗ 提交于 2019-11-28 15:50:02
I am getting an error when trying to compile my code in g++ using the current signature: cannot declare member function static void Foo::Bar(std::ostream&, const Foo::Node*) to have static linkage My question is twofold: Why does it not Compile this way? What is the correct signature, and why? Signatures have always been the death of me when using C++ Edit: Here is the class header file, as well: class Foo { public: Foo(); ~Foo(); bool insert(const Foo2 &v); Foo * find(const Foo2 &v); const Foo * find(const Foo2 &v) const; void output(ostream &s) const; private: //Foo(const Foo &v); //Foo&

Is it possible to write a Rust macro that will expand into a function/method signature?

…衆ロ難τιáo~ 提交于 2019-11-28 13:29:57
I would love to be able to something like the following: macro_rules! impl_a_method( ($obj:ident, $body:block) => ( fn a_method(foo: Foo, bar: Bar, baz: Baz) -> $obj $body ) ) // Implementation would look like: impl_a_method!(MyType, { MyType { foo: foo.blah(), bar: bar.bloo(), baz: baz.floozy(), } }) My real-world example features methods with much larger signatures which I have to implement in unique ways for 30+ different types. I have tried something similar to the above macro, however I run into errors where rustc considers foo , bar and baz unresolved names at the expansion site (even

Definition of a method signature?

走远了吗. 提交于 2019-11-28 06:22:45
What is the correct definition of a method signature (or a signature of a method)? On google, I find various definitions: It is the combination of the method name and the parameter list Does that mean method signature = method name + argument list ? Then I do not see difference between " method " and " method signature ". If I have a method: public void Foo(int x, int y) { ... } Would my method signature be one of the following, or neither? Foo Foo(int, int) Foo(int x, int y) Foo(34, 78) How am I suppose to answer if someone ask me what is the method signature of the method? There are a number

Regex question about parsing method signature

久未见 提交于 2019-11-28 05:57:06
问题 I'm trying to parse a method signature that is in this format: 'function_name(foo=<str>, bar=<array>)' From this, I want the name of the method, and each argument and it's type. Obviously I don't want the < , > characters, etc. The number of parameters will be variable. My question is: How is it possible to get all the parameters when using this regex? I'm using Python, but I'm just looking for a general idea. Do I need named groups and, if so, how can I use them to capture multiple

How can an interface include a method that references the concrete implementation type of the interface in its signature or return type?

笑着哭i 提交于 2019-11-27 23:36:38
Suppose I am designing something like the following interface: public interface MyInterface{ public MyInterface method1(); public void method2(MyInterface mi); } However, there is the caveat that the return type for method1 and the parameter for method2 match the concrete implementation and not just MyInterface . That is, if I have MyInterfaceImpl that implements MyInterface , it needs to have the following: public class MyInterfaceImpl implements MyInterface{ @Override public MyInterfaceImpl method1(){...} @Override public void method2(MyInterfaceImpl mi){...} } As written above, method1 won