172877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley/*
272877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley * Copyright (C) 2015, The Android Open Source Project
372877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley *
472877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley * Licensed under the Apache License, Version 2.0 (the "License");
572877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley * you may not use this file except in compliance with the License.
672877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley * You may obtain a copy of the License at
772877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley *
872877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley *     http://www.apache.org/licenses/LICENSE-2.0
972877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley *
1072877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley * Unless required by applicable law or agreed to in writing, software
1172877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley * distributed under the License is distributed on an "AS IS" BASIS,
1272877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1372877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley * See the License for the specific language governing permissions and
1472877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley * limitations under the License.
1572877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley */
1672877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley
1772877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley#ifndef AIDL_IMPORT_RESOLVER_H_
1872877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley#define AIDL_IMPORT_RESOLVER_H_
1972877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley
2072877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley#include <string>
2172877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley#include <vector>
2272877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley
230a62067f35e957493bc37c4b42dfdcfc16353831Elliott Hughes#include <android-base/macros.h>
2472877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley
2572877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley#include "io_delegate.h"
2672877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley
2772877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wileynamespace android {
2872877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wileynamespace aidl {
2972877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley
3072877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wileyclass ImportResolver {
3172877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley public:
3272877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley  ImportResolver(const IoDelegate& io_delegate,
3372877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley                 const std::vector<std::string>& import_paths);
3472877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley  virtual ~ImportResolver() = default;
3572877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley
3672877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley  // Resolve the canonical name for a class to a file that exists
3772877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley  // in one of the import paths given to the ImportResolver.
3872877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley  std::string FindImportFile(const std::string& canonical_name) const;
3972877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley
4072877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley private:
4172877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley  const IoDelegate& io_delegate_;
4272877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley  std::vector<std::string> import_paths_;
4372877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley
4472877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley  DISALLOW_COPY_AND_ASSIGN(ImportResolver);
4572877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley};
4672877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley
4772877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley}  // namespace android
4872877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley}  // namespace aidl
4972877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley
5072877acd3b57462fcd452bff4a9d7ff936936a8eChristopher Wiley#endif // AIDL_IMPORT_RESOLVER_H_
51