AStringUtils.h revision f296e2b262d2a8f7c570eaed454a28cca99eb976
1f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar/* 2f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar * Copyright 2014 The Android Open Source Project 3f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar * 4f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar * Licensed under the Apache License, Version 2.0 (the "License"); 5f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar * you may not use this file except in compliance with the License. 6f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar * You may obtain a copy of the License at 7f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar * 8f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar * http://www.apache.org/licenses/LICENSE-2.0 9f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar * 10f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar * Unless required by applicable law or agreed to in writing, software 11f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar * distributed under the License is distributed on an "AS IS" BASIS, 12f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar * See the License for the specific language governing permissions and 14f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar * limitations under the License. 15f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar */ 16f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar 17f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar#ifndef A_STRING_UTILS_H_ 18f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar#define A_STRING_UTILS_H_ 19f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar 20f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar#include <stdlib.h> 21f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar 22f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnarnamespace android { 23f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar 24f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnarstruct AStringUtils { 25f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar // similar to strncmp or strcasecmp, but case sensitivity is parametric 26f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar static int Compare(const char *a, const char *b, size_t len, bool ignoreCase); 27f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar 28f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar // matches a string (str) to a glob pattern that supports: 29f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar // * - matches any number of characters 30f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar static bool MatchesGlob( 31f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar const char *glob, size_t globLen, const char *str, size_t strLen, bool ignoreCase); 32f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar}; 33f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar 34f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar} // namespace android 35f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar 36f296e2b262d2a8f7c570eaed454a28cca99eb976Lajos Molnar#endif // A_STRING_UTILS_H_ 37