code-generation

Generate DTOs from Object

吃可爱长大的小学妹 提交于 2019-12-01 04:23:14
I want to auto gen some DTOs from some of my existing objects, I was wondering if there already exist a Resharper, DevExpress or VSX open source to use, I need a tool to look into my code and let me choose which properties I want to include in my DTO and then generate a class based on that... This is kind of a hack but you could use Visual Studio/Resharper to Extract an interface from the class, then create a DTO class and derive from the interface, then use Visual Studio to auto implement the interface members (then, optionally remove the interface). Another opinion would be to use some

Viewing the code generated by @synthesize for getter/setter

岁酱吖の 提交于 2019-12-01 03:57:17
问题 Is it possible to view the exact code generated by @synthesize? 回答1: You can read the Clang compiler source to see the C++ code that generates the getter and setter methods: http://llvm.org/svn/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp It's pretty cryptic but that's the most accurate way of seeing the code generated. You can also look at the objc_getProperty and objc_setProperty implementations in Apple's runtime implementation. While not literally the same as the code that is generated,

Looking for a java code generation library [closed]

五迷三道 提交于 2019-12-01 03:35:36
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . What is/are "good" java code generation libs? I found a generation part in JaxMe, but it's poor and old. I like to generate java code through java code. So basically use a lib to tell that it has to generate a

Why are unnecessary atomic loads not optimized away?

ぐ巨炮叔叔 提交于 2019-12-01 03:13:07
问题 Let's consider this trivial code: #include <atomic> std::atomic<int> a; void f(){ for(int k=0;k<100;++k) a.load(std::memory_order_relaxed); } MSVC, Clang and GCC all perform 100 loads of a, while it seems obvious it could have been optimized away. I expected the function f to be a nop (See generated code here) Actually, I expected this code generation for a volatile atomic: volatile std::atomic<int> va; void g(){ for(int k=0;k<100;++k) va.load(std::memory_order_relaxed); } Why do compilers

How to avoid multiplication in pointer arithmetic?

我们两清 提交于 2019-12-01 03:01:30
问题 If I write int main(int argc, char *argv[]) { int temp[50][3]; return &temp[argc] - &temp[0]; } and compile it with Visual C++, I get back: 009360D0 55 push ebp 009360D1 8B EC mov ebp,esp 009360D3 8B 45 08 mov eax,dword ptr [argc] 009360D6 8D 0C 40 lea ecx,[eax+eax*2] 009360D9 B8 AB AA AA 2A mov eax,2AAAAAABh 009360DE C1 E1 02 shl ecx,2 009360E1 F7 E9 imul ecx 009360E3 D1 FA sar edx,1 009360E5 8B C2 mov eax,edx 009360E7 C1 E8 1F shr eax,1Fh 009360EA 03 C2 add eax,edx 009360EC 5D pop ebp

Eclipse generate getter/setter for domain objects and classmembers with 'm' suffix

那年仲夏 提交于 2019-12-01 02:19:29
问题 I have a small question regarding generated getter and setter methods in my domain objects. I want to use a common style guide for my source code. One part of that style guide says that I start each class member name with the prefix 'm' for member. class User{ String mName; List<Call> mAllCall; List<Geo> mAllGeo; Unfortunately I have a couple of classes with many more member variables. The problem I have is that I am a very lazy developer, and that I create the getter and setter methods in

Visual Studio 2015 not automatically adding asterisk for multiline comments

不羁的心 提交于 2019-12-01 02:18:18
When typing multi-line comments Visual studio used to add an automatic asterisk to each new line of the comment as I press enter(apparently 2015 does not do this anymore). I really liked this. As of right now though, if I type "/*" and enter, Visual studio does not try to autocomplete it at all. In fact, it even lets me end the comment with "*/" , too, instead of doing it for me. So my question is: is anyone else experiencing this? How do I get the original functionality back, so each new line is automatically prefixed with an asterisk, and closed for me by "*/" ? I already checked and yes, my

Circular Buffer in Simulink

99封情书 提交于 2019-12-01 01:03:13
I would like to implement a very huge (10^6 Elements - fixed size) circular buffer in pure Simulink model (no further toolboxes, no S-Function ). At some points I need to read some elements (anywhere, not just begin or end). The following solutions I can not use: "Queue Block" or "Buffer Block" (I have no Signal Processing Toolbox available) "Discrete Delay" ( I need a hugh buffer and will not place 10^6 delays into the model) "Sim Events" (I need to generate code from this model) The "S-Function" I tried not yet, and I am looking for an alternative solution. What further approach do you know?

Generate classes from XSD

℡╲_俬逩灬. 提交于 2019-12-01 00:42:18
You are doing contract first development of web services in a SOA world. After editing an XSD file, what is the best way to automatically (re)generate .net classes from the XSD files? xsd.exe will generate new classes for you. Depending on how Visual Studio is set up, adding xsd.exe to "Properties / build events / post-build events" will force a regeneration every time you do a rebuild. If using .net 1.1 or 2.0, xsd.exe. If using 3.0 or 3.5, svcutil.exe. If you don't mind using non-supported code, LINQ-to-XSD ( http://blogs.msdn.com/xmlteam/archive/2008/02/21/linq-to-xsd-alpha-0-2.aspx ) is

C# to format (indent, align) C# properly

爱⌒轻易说出口 提交于 2019-11-30 22:10:46
We have a code generator that munges the schema of a given database to automate our inhouse n-tier architecture. The output is various C# partial classes, one per file. In the code to munge all the strings, we try and keep on top of the indenting and formatting as much as possible, but invariably when you come to open the file in Visual Studio the formatting is awry. A quick ctrl-k, ctrl-d fixes it, but obviously this reformatting is lost the next time the class is generated. What I'd like to know, is if there's a way I can somehow automatically format the contents of the textfile in the same