PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/examples/api_jsonxml/resources/AnythingToXML/TabUtils.cfc

http://github.com/atuttle/Taffy
ColdFusion CFScript | 55 lines | 47 code | 8 blank | 0 comment | 1 complexity | 9a069bb1337f1466e15eb4f74f58e75c MD5 | raw file
 1<cfcomponent displayname="TabUtils" namespace="TabUtils" output="no">
 2	<!--- Tab Utilities by Daniel Gaspar <daniel.gaspar@gmail.com> 5/1/2008 --->
 3	<!---  Keeps track of tabs 'n	prints them	-Dg--->
 4	<!--- 
 5	
 6		Copyright 2008 Daniel Gaspar Licensed under the Apache License, Version 2.0 (the "License");
 7		you may not use this file except in compliance with the License. You may obtain a copy of the
 8		License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or
 9		agreed to in writing, software distributed under the License is distributed on an "AS IS"
10		BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
11		for the specific language governing permissions and limitations under the License.
12	
13	
14	--->
15	<cfproperty name="tabs" default="0" type="numeric" />
16	
17	<cffunction name="init" access="public" output="no" returntype="any">
18		<cfargument name="tabs" type="numeric" required="no" default="0" />
19		<cfset this.tabs = arguments.tabs />	
20		<cfreturn this>
21	</cffunction>
22	
23	<cffunction name="setTabs" access="public" output="no" returntype="any">
24		<cfargument name="tabs" type="numeric" required="no" default="#this.tabs#" />
25		<cfset this.tabs = arguments.tabs />	
26	</cffunction>
27	
28	<cffunction name="addtab" access="public" output="no" returntype="void">
29		<cfargument name="num" type="numeric" required="no" default="1" />
30		<cfset this.tabs = this.tabs  + arguments.num />		
31	</cffunction>
32	
33	<cffunction name="removetab" access="public" output="no" returntype="void">
34		<cfargument name="num" type="numeric" required="no" default="1" />
35		<cfset this.tabs = this.tabs  - arguments.num />		
36	</cffunction>	
37		
38	<cffunction name="printtabs" access="public" output="no" returntype="string" >
39		<cfargument name="tabs" type="numeric" required="no" default="#this.tabs#" />
40		<cfset var returnstring = "" />
41		<cfset var i = 1 />	
42		<!---<cfif this.tabs gt 0 >	--->
43		<cfprocessingdirective suppresswhitespace="yes">
44			<cfsetting enablecfoutputonly="yes">
45			<cfsavecontent variable="returnstring" >				
46				<cfoutput>#chr(10)#</cfoutput>				
47				<cfloop from="1" to="#arguments.tabs#" index="i" >
48					<cfoutput>#chr(09)#</cfoutput>
49				</cfloop>				
50			</cfsavecontent>
51		</cfprocessingdirective>
52		<!---</cfif>--->
53		<cfreturn returnstring>
54	</cffunction>
55</cfcomponent>