2 * Copyright (c) 2019 Apple Inc. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * https://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #import "mdns_object.h"
19 #import <CoreUtils/CoreUtils.h>
20 #import <Foundation/Foundation.h>
21 #import <os/object_private.h>
23 //======================================================================================================================
24 // MARK: - Class Declarations
26 #define MDNS_OBJECT_CLASS_DECLARE(NAME) \
27 _OS_OBJECT_DECL_SUBCLASS_INTERFACE(mdns_ ## NAME, mdns_object) \
28 extern int _mdns_dummy_variable
30 _OS_OBJECT_DECL_SUBCLASS_INTERFACE(mdns_object, object)
32 MDNS_OBJECT_CLASS_DECLARE(interface_monitor);
34 //======================================================================================================================
35 // MARK: - Class Definitions
37 @implementation OS_OBJECT_CLASS(mdns_object)
40 mdns_object_finalize(self);
41 arc_safe_super_dealloc();
44 - (NSString *)description
46 return arc_safe_autorelease((NSString *)mdns_object_copy_description_as_cfstring(self, false, false));
49 - (NSString *)debugDescription
51 return arc_safe_autorelease((NSString *)mdns_object_copy_description_as_cfstring(self, true, false));
54 - (NSString *)redactedDescription
56 return arc_safe_autorelease((NSString *)mdns_object_copy_description_as_cfstring(self, false, true));
60 #define MDNS_CLASS(NAME) OS_OBJECT_CLASS(mdns_ ## NAME)
61 #define MDNS_OBJECT_CLASS_DEFINE(NAME) \
62 @implementation MDNS_CLASS(NAME) \
66 mdns_object_ ## NAME ## _alloc(const size_t size) \
68 return (mdns_## NAME ##_t)_os_object_alloc([MDNS_CLASS(NAME) class], size); \
70 extern int _mdns_dummy_variable
72 MDNS_OBJECT_CLASS_DEFINE(interface_monitor);