// Path: src/org/udalov/jclang/structs/NativeIndexerCallbacks.java
// @SuppressWarnings("unused")
// public class NativeIndexerCallbacks extends Structure {
//     // TODO: all callbacks
//     public Callback abortQuery;
//     public Callback diagnostic;
//     public EnteredMainFileCallback enteredMainFile;
//     public Callback ppIncludedFile;
//     public Callback importedASTFile;
//     public StartedTranslationUnitCallback startedTranslationUnit;
//     public Callback indexDeclaration;
//     public Callback indexEntityReference;
// 
//     public NativeIndexerCallbacks() {
//         super();
//         initFieldOrder();
//     }
// 
//     public NativeIndexerCallbacks(@NotNull final IndexerCallback callback) {
//         super();
//         this.enteredMainFile = new EnteredMainFileCallback() {
//             @Nullable
//             @Override
//             public Pointer apply(@Nullable Pointer clientData, @NotNull CXFile mainFile, @Nullable Pointer reserved) {
//                 callback.enteredMainFile(mainFile.toFile());
//                 return null;
//             }
//         };
//         this.startedTranslationUnit = new StartedTranslationUnitCallback() {
//             @Override
//             public void apply(@Nullable Pointer clientData, @Nullable Pointer reserved) {
//                 callback.startedTranslationUnit();
//             }
//         };
//         this.indexDeclaration = new IndexDeclarationCallback() {
//             @Override
//             public void apply(@Nullable Pointer clientData, @NotNull CXIdxDeclInfo.ByReference info) {
//                 callback.indexDeclaration(new DeclarationInfo(info));
//             }
//         };
//         initFieldOrder();
//     }
// 
//     private void initFieldOrder() {
//         setFieldOrder(new String[]{"abortQuery", "diagnostic", "enteredMainFile", "ppIncludedFile", "importedASTFile",
//                                    "startedTranslationUnit", "indexDeclaration", "indexEntityReference"});
//     }
// 
//     public interface EnteredMainFileCallback extends Callback {
//         @Nullable
//         Pointer apply(@Nullable Pointer clientData, @NotNull CXFile mainFile, @Nullable Pointer reserved);
//     }
// 
//     public interface StartedTranslationUnitCallback extends Callback {
//         void apply(@Nullable Pointer clientData, @Nullable Pointer reserved);
//     }
// 
//     public interface IndexDeclarationCallback extends Callback {
//         void apply(@Nullable Pointer clientData, @NotNull CXIdxDeclInfo.ByReference info);
//     }
// }
// 
// Path: src/org/udalov/jclang/util/Util.java
// public class Util {
//     private Util() {}
// 
//     public static <E extends Enum<E>> int buildOptionsMask(@NotNull E... values) {
//         int result = 0;
//         for (E value : values) {
//             result |= 1 << value.ordinal();
//         }
//         return result;
//     }
// }
// 
// Path: src/org/udalov/jclang/TranslationUnit.java
// public enum Flag {
//     DETAILED_PREPROCESSING_RECORD,
//     INCOMPLETE,
//     PRECOMPILED_PREAMBLE,
//     CACHE_COMPLETION_RESULTS,
//     FOR_SERIALIZATION,
//     @Deprecated CXX_CHAINED_PCH,
//     SKIP_FUNCTION_BODIES,
//     INCLUDE_BRIEF_COMMENTS_IN_CODE_COMPLETION
// }


import com.sun.jna.PointerType;
import com.sun.jna.ptr.PointerByReference;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.udalov.jclang.structs.NativeIndexerCallbacks;
import org.udalov.jclang.util.Util;
import static org.udalov.jclang.TranslationUnit.Flag;
/*
 * Copyright 2013 Alexander Udalov
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.udalov.jclang;



public class Index extends PointerType {
    @NotNull
    public TranslationUnit parseTranslationUnit(@Nullable String sourceFilename, @NotNull String[] args, @NotNull Flag... options)
            throws TranslationException {
// Path: src/org/udalov/jclang/structs/NativeIndexerCallbacks.java
// @SuppressWarnings("unused")
// public class NativeIndexerCallbacks extends Structure {
//     // TODO: all callbacks
//     public Callback abortQuery;
//     public Callback diagnostic;
//     public EnteredMainFileCallback enteredMainFile;
//     public Callback ppIncludedFile;
//     public Callback importedASTFile;
//     public StartedTranslationUnitCallback startedTranslationUnit;
//     public Callback indexDeclaration;
//     public Callback indexEntityReference;
// 
//     public NativeIndexerCallbacks() {
//         super();
//         initFieldOrder();
//     }
// 
//     public NativeIndexerCallbacks(@NotNull final IndexerCallback callback) {
//         super();
//         this.enteredMainFile = new EnteredMainFileCallback() {
//             @Nullable
//             @Override
//             public Pointer apply(@Nullable Pointer clientData, @NotNull CXFile mainFile, @Nullable Pointer reserved) {
//                 callback.enteredMainFile(mainFile.toFile());
//                 return null;
//             }
//         };
//         this.startedTranslationUnit = new StartedTranslationUnitCallback() {
//             @Override
//             public void apply(@Nullable Pointer clientData, @Nullable Pointer reserved) {
//                 callback.startedTranslationUnit();
//             }
//         };
//         this.indexDeclaration = new IndexDeclarationCallback() {
//             @Override
//             public void apply(@Nullable Pointer clientData, @NotNull CXIdxDeclInfo.ByReference info) {
//                 callback.indexDeclaration(new DeclarationInfo(info));
//             }
//         };
//         initFieldOrder();
//     }
// 
//     private void initFieldOrder() {
//         setFieldOrder(new String[]{"abortQuery", "diagnostic", "enteredMainFile", "ppIncludedFile", "importedASTFile",
//                                    "startedTranslationUnit", "indexDeclaration", "indexEntityReference"});
//     }
// 
//     public interface EnteredMainFileCallback extends Callback {
//         @Nullable
//         Pointer apply(@Nullable Pointer clientData, @NotNull CXFile mainFile, @Nullable Pointer reserved);
//     }
// 
//     public interface StartedTranslationUnitCallback extends Callback {
//         void apply(@Nullable Pointer clientData, @Nullable Pointer reserved);
//     }
// 
//     public interface IndexDeclarationCallback extends Callback {
//         void apply(@Nullable Pointer clientData, @NotNull CXIdxDeclInfo.ByReference info);
//     }
// }
// 
// Path: src/org/udalov/jclang/util/Util.java
// public class Util {
//     private Util() {}
// 
//     public static <E extends Enum<E>> int buildOptionsMask(@NotNull E... values) {
//         int result = 0;
//         for (E value : values) {
//             result |= 1 << value.ordinal();
//         }
//         return result;
//     }
// }
// 
// Path: src/org/udalov/jclang/TranslationUnit.java
// public enum Flag {
//     DETAILED_PREPROCESSING_RECORD,
//     INCOMPLETE,
//     PRECOMPILED_PREAMBLE,
//     CACHE_COMPLETION_RESULTS,
//     FOR_SERIALIZATION,
//     @Deprecated CXX_CHAINED_PCH,
//     SKIP_FUNCTION_BODIES,
//     INCLUDE_BRIEF_COMMENTS_IN_CODE_COMPLETION
// }


// Path: src/org/udalov/jclang/Index.java
import com.sun.jna.PointerType;
import com.sun.jna.ptr.PointerByReference;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.udalov.jclang.structs.NativeIndexerCallbacks;
import org.udalov.jclang.util.Util;
import static org.udalov.jclang.TranslationUnit.Flag;

/*
 * Copyright 2013 Alexander Udalov
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.udalov.jclang;



public class Index extends PointerType {
    @NotNull
    public TranslationUnit parseTranslationUnit(@Nullable String sourceFilename, @NotNull String[] args, @NotNull Flag... options)
            throws TranslationException {
        int flags = Util.buildOptionsMask(options);