indentation

How to add indention to the stream operator

青春壹個敷衍的年華 提交于 2020-01-10 12:39:12
问题 In our project we use the c++ stream operator (<<) in our object model to print out an easy readible format of the data. A simplified example is this: std::ostream& operator<<(std::ostream & oStream, const OwnClass& iOwnClass) { oStream << "[SomeMember1: " << iOwnClass._ownMember1 << "]\n"; oStream << "[SomeMember2: " << iOwnClass._ownMember2 << "]\n"; } Resulting in this in the logging: [SomeMember1: foo] [SomeMember2: bar] What we want now is to be able to indent the result of that operator

Indent several lines in Emacs

女生的网名这么多〃 提交于 2020-01-10 06:30:08
问题 In my Emacs, space key can indent correctly 1 line. If I select several lines, and press space key, the indenting does not work. By following this link, I try C-M-\ or C-M-q , but C-M deletes directly the whole block selected. Here is my .emacs, could anyone help? 回答1: If you want Emacs to correctly indent multiple lines, then the command is C-META \ also known as C-M-\ . In other words, it's not Control - M , but Control - Meta - Backslash ( Control + Alt + \ on most keyboards) 回答2: Select

editing the NetBeans source formatting standard

假如想象 提交于 2020-01-10 00:34:40
问题 Is there any way of changing the standard by which NetBeans automatically formats the code when doing "Source->Format"? I seem to remember seeing this option somewhere, but I can't find anything about it. 回答1: You can change a very limited number of settings related to formatting. open up netbeans IDE Go to tools->options click on Editor button on top left of the options dialog box click on the formatting tab select PHP from the language select box then you would be able to see the required

editing the NetBeans source formatting standard

老子叫甜甜 提交于 2020-01-10 00:34:05
问题 Is there any way of changing the standard by which NetBeans automatically formats the code when doing "Source->Format"? I seem to remember seeing this option somewhere, but I can't find anything about it. 回答1: You can change a very limited number of settings related to formatting. open up netbeans IDE Go to tools->options click on Editor button on top left of the options dialog box click on the formatting tab select PHP from the language select box then you would be able to see the required

Is there a version of GNU indent which supports Objective C?

六眼飞鱼酱① 提交于 2020-01-06 07:02:34
问题 If so where can I get it? 回答1: Uncrustify seems to be useful. I haven't tested it yet. Here is a brach that claims Code beautifier and a very mighty one at that. This fork aims to improve support for Objective-C/Objective-C++. Here you'll find a config for objC. This blogpost describes how to run uncrustify from xcode 来源: https://stackoverflow.com/questions/3849418/is-there-a-version-of-gnu-indent-which-supports-objective-c

Changing indentation in Python's IDLE

倖福魔咒の 提交于 2020-01-06 06:56:07
问题 I have written many lines of code already, and have now changed my mind on their indentation. (I want to put all of these lines into a 'while' loop.) For each line, I could press the space button or tab, but this would take a long time. Can I add the appropriate indentation/margin to all these lines at once? 回答1: In Sublime Text, highlight text and press TAB (or SHIFT + TAB to do the opposite i.e. remove one level of indentation). This will do the same as adding a tab at the beginning of

Java - Handle indentation in “getTextContent()” of DOM parsed XML

拟墨画扇 提交于 2020-01-06 02:34:17
问题 I've written some java code that parses an XML using DOM for loading data in a program of mine. Formatting the XML with Eclipse "format" function, I've encountered a problem: the previous working getTextContent() from a document element, now returns a string that contains the whitespaces (or whatelse) added from Eclipse's formatting. I'm looking for a solution that given: <myElement> some text of mine </myElement> when I code-select the element <myElement> from the document, I want the

How to deal with IndentationError: unexpected indent

你。 提交于 2020-01-06 01:33:38
问题 I'm currently working with raspberry pi and using DHT11 to read temperature and humidity values every second. I have to save these values into a database in real time. Here's my code that showing sensor data every second. #!/usr/bin/python import RPi.GPIO as GPIO import dht11 import time import datetime import csv import os dht11_pin = 17 limit_sec = 15 #15 sec # initialize GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.cleanup() sleep_time = 1 instance = dht11.DHT11(pin=dht11_pin)

Eclipse Java code formatting

微笑、不失礼 提交于 2020-01-05 07:12:22
问题 I'm writting a GUI program. It has several JPanels that conatin other components. It would be really nice if my code would look like this: parent component code child component code grandchild component code instead of this: parent component code child component code grandchild component code It would make the code far more readable. Is(Are) there some character(s) I can put in my code that Java will ignore, but Eclipse would detect it as a part of code that has to have additional indentation

Eclipse Java code formatting

不想你离开。 提交于 2020-01-05 07:12:10
问题 I'm writting a GUI program. It has several JPanels that conatin other components. It would be really nice if my code would look like this: parent component code child component code grandchild component code instead of this: parent component code child component code grandchild component code It would make the code far more readable. Is(Are) there some character(s) I can put in my code that Java will ignore, but Eclipse would detect it as a part of code that has to have additional indentation