Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Camelon2004-12-10 03:53:10 +0000
committerJohn Camelon2004-12-10 03:53:10 +0000
commitb9bdbe47af68d6b937e67816c8a84d8ff182de78 (patch)
tree9c63d852df0c8061a592b69cdd12932aeb70889d /core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLinkageSpecification.java
parent9508bc314e35c30e012c5257b6d1c0c1354f85ba (diff)
downloadorg.eclipse.cdt-b9bdbe47af68d6b937e67816c8a84d8ff182de78.tar.gz
org.eclipse.cdt-b9bdbe47af68d6b937e67816c8a84d8ff182de78.tar.xz
org.eclipse.cdt-b9bdbe47af68d6b937e67816c8a84d8ff182de78.zip
Moved parser2 packages to dom.parser
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLinkageSpecification.java')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLinkageSpecification.java83
1 files changed, 83 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLinkageSpecification.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLinkageSpecification.java
new file mode 100644
index 00000000000..b2ca33506ec
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLinkageSpecification.java
@@ -0,0 +1,83 @@
+/**********************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.internal.core.dom.parser.cpp;
+
+import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
+
+/**
+ * @author jcamelon
+ */
+public class CPPASTLinkageSpecification extends CPPASTNode implements
+ ICPPASTLinkageSpecification {
+
+ private String literal;
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification#getLiteral()
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification#setLiteral(java.lang.String)
+ */
+ public void setLiteral(String value) {
+ this.literal = value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification#getDeclarations()
+ */
+ public IASTDeclaration [] getDeclarations() {
+ if( declarations == null ) return IASTDeclaration.EMPTY_DECLARATION_ARRAY;
+ removeNullDeclarations();
+ return declarations;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification#addDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
+ */
+ public void addDeclaration(IASTDeclaration declaration) {
+ if( declarations == null )
+ {
+ declarations = new IASTDeclaration[ DEFAULT_DECLARATIONS_LIST_SIZE ];
+ currentIndex = 0;
+ }
+ if( declarations.length == currentIndex )
+ {
+ IASTDeclaration [] old = declarations;
+ declarations = new IASTDeclaration[ old.length * 2 ];
+ for( int i = 0; i < old.length; ++i )
+ declarations[i] = old[i];
+ }
+ declarations[ currentIndex++ ] = declaration;
+ }
+
+ private void removeNullDeclarations() {
+ int nullCount = 0;
+ for( int i = 0; i < declarations.length; ++i )
+ if( declarations[i] == null )
+ ++nullCount;
+ if( nullCount == 0 ) return;
+ IASTDeclaration [] old = declarations;
+ int newSize = old.length - nullCount;
+ declarations = new IASTDeclaration[ newSize ];
+ for( int i = 0; i < newSize; ++i )
+ declarations[i] = old[i];
+ currentIndex = newSize;
+ }
+
+ private int currentIndex = 0;
+ private IASTDeclaration [] declarations = null;
+ private static final int DEFAULT_DECLARATIONS_LIST_SIZE = 4;
+
+}

Back to the top